# `AshScylla.Search.Query.Planner`
[🔗](https://github.com/ohhi-vn/ash_scylla/blob/main/lib/ash_scylla/search/query/planner.ex#L1)

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.

# `posting_entry`

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

# `plan`

```elixir
@spec plan(module(), String.t(), AshScylla.Search.Query.Parser.ast_node(), keyword()) ::
  {:ok, %{required(String.t()) =&gt; [{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}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
