Parses user search queries.
Handles:
- Simple word queries:
learning phoenix - AND queries:
learning AND phoenixor 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.
Summary
Types
Functions
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}}