Skip to main content
TIN adds the ==> operator. The query on the right-hand side of it is TINQL.
Rules
  • Keywords must be UPPER CASE (AND, OR, THEN). Lowercase is a search term (and matches the word “and”).
  • Matching folds case and accents under the default tokenizer (Jalapeño and jalapeno are the same term). Override with case_folding / accent_folding on the index.
  • Inputs that analyze to no tokens ('', whitespace, bare punctuation) match nothing. Explicit empty syntax ("", []) is a parse error.
  • Query boost factors (^N) must be in [0.0..10000.0]. The system rejects out-of-range values at parse time.
  • Token positions are 0-based. Prefer IN FIRST N WORDS / IN LAST N WORDS over raw IN WORDS ranges when you mean “the first/last N words.”
  • Juxtaposition defaults to AND: apple grape acts as apple AND grape.
  • Exclude terms with AND NOT: apple AND NOT peel.
  • Quote reserved words used as terms: "AND", "THEN".
  • A hyphen usually splits a term: wi-fi is searched as "wi fi".
  • Fuzzy match (apple~2) works on one word. wi-fi~2 errors because wi-fi is two words.

Terms

Allowed in terms: anything except whitespace and ( ) [ ] " ~ ^. Escape literal * / ? with \. Space in a regex: MATCHES foo\ bar. Because MATCHES is not folded, write patterns against the normalized dictionary form (usually lowercase, accents folded): MATCHES apple.*, not MATCHES Apple.*.

Phrases

Phrase escapes: \" \\ \_ \[ \]. Empty "" is invalid (parse error). Inputs that analyze to no tokens match nothing.

Boolean operators

NOT never stands alone. It only appears in AND NOT, NOT ENCLOSES, NOT ENCLOSED BY, and NOT OVERLAPPING.

Alternatives

Alternatives may hold expressions: ["big bad" house NEAR/2 brick].

Proximity

/N is required on THEN and NEAR. N is the maximum number of extra words allowed between the operands, and 0 means adjacent.

Span relations

Every TINQL expression produces spans (position ranges). Relation operators compare two span sets. ENCLOSES and ENCLOSED BY test the same relationship but return different spans: ENCLOSES returns the outer span and ENCLOSED BY returns the inner one.

Positional filters

Token positions are 0-based (the first token is position 0). Use IN FIRST / IN LAST when you care about word counts, and IN WORDS when you need an explicit position window.

Precedence (loose → tight)

Operators at the same level are left-associative. Use parentheses to override precedence. A OR B THEN/5 C AND DA OR ((B THEN/5 C) AND D). Postfix modifiers compose on the primary: apple~2^3, "big bad"~2^1.5.

Keyword index

All keywords are case-sensitive UPPER CASE. IN is special only before FIRST / LAST / MIDDLE / WORDS. AT only before LEAST. ALL only before OF. ENCLOSED / BY only together.

Special characters

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.