Skip to main content

Module fts_query

Module fts_query 

Source
Expand description

Full-text search query-string parser.

§Grammar

    query      = or_expr
    or_expr    = and_expr ( 'OR' and_expr )*
    and_expr   = unary ( ('AND' | <implicit>) unary )*
    unary      = 'NOT' unary | primary
    primary    = '(' or_expr ')'
               | TERM ':' PHRASE          -- field:"phrase"
               | TERM ':' VECTOR          -- field:[0.1, 0.2]
               | TERM ':' TERM            -- field:term
               | PHRASE                   -- "phrase"
               | TERM                     -- bare term

Operators AND / OR / NOT are case-insensitive keywords. Adjacent terms without an explicit operator are treated as implicit AND. Precedence: NOT > AND > OR.

This module stops at the syntax AST. Physical retrieval lowering belongs to the engine/planner boundary, so the SQL crate remains independent of storage, scoring, fusion, and operator implementations.

Structs§

FTSParser
FTSToken

Enums§

FTSNode
FTSTokenType

Functions§

parse_query_string
Tokenize and parse a full-text query string without choosing a physical retrieval representation.
tokenize