AshScylla.Search.Query.Planner (AshScylla v1.6.1)

Copy Markdown View Source

Query planner that executes search queries against the inverted index.

Takes a parsed query AST and:

  1. Analyzes each term from the query
  2. Looks up posting lists from search_post_terms
  3. Applies boolean operations (AND/OR/NOT)
  4. Returns combined posting list with term scores

The planner handles sharded term lookups by querying all shards for each term and merging results.

Summary

Functions

Plans and executes a parsed query against the inverted index.

Types

posting_entry()

@type posting_entry() :: {String.t(), non_neg_integer(), non_neg_integer()}

Functions

plan(repo, keyspace, ast, opts \\ [])

@spec plan(module(), String.t(), AshScylla.Search.Query.Parser.ast_node(), keyword()) ::
  {:ok, %{required(String.t()) => [{String.t(), non_neg_integer()}]}}
  | {:error, term()}

Plans and executes a parsed query against the inverted index.

Returns a map of %{post_id => [{term, tf}]} for downstream ranking.

Options

  • :num_shards — number of shards per term (default: 16)
  • :analyzer_opts — options forwarded to the analyzer

Returns {:ok, results} or {:error, reason}.