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

Parses user search queries.

Handles:
  * Simple word queries: `learning phoenix`
  * AND queries: `learning AND phoenix` or implicit AND between words
  * OR queries: `learning OR phoenix`
  * NOT queries: `phoenix NOT framework`
  * Phrase queries: `"phoenix framework"` (V2)

Returns a parsed query structure representing the boolean logic.

# `ast_node`

```elixir
@type ast_node() ::
  AshScylla.Search.Query.Parser.Term.t()
  | AshScylla.Search.Query.Parser.Phrase.t()
  | AshScylla.Search.Query.Parser.Group.t()
  | AshScylla.Search.Query.Parser.NotExpr.t()
```

# `parse`

```elixir
@spec parse(String.t()) :: {:ok, ast_node()} | {:error, term()}
```

Parses a query string into a structured representation.

## Examples

    iex> Parser.parse("learning phoenix")
    {:ok, %Group{terms: [%Term{word: "learning"}, %Term{word: "phoenix"}], op: :and}}

    iex> Parser.parse("elixir OR phoenix")
    {:ok, %Group{terms: [%Term{word: "elixir"}, %Term{word: "phoenix"}], op: :or}}

    iex> Parser.parse("phoenix NOT framework")
    {:ok, %Group{terms: [%Term{word: "phoenix"}, %NotExpr{term: %Term{word: "framework"}}], op: :and}}

# `parse!`

```elixir
@spec parse!(String.t()) :: ast_node()
```

---

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