Query planner that executes search queries against the inverted index.
Takes a parsed query AST and:
- Analyzes each term from the query
- Looks up posting lists from
search_post_terms - Applies boolean operations (AND/OR/NOT)
- 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
@type posting_entry() :: {String.t(), non_neg_integer(), non_neg_integer()}
Functions
@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}.