Search
Three search modes — portable ILIKE (default), Postgres tsvector full-text search (keyword matching), and pgvector embedding-similarity ordering. What each does and when to reach for it.
The library ships three search modes. They are distinct mechanisms — pick by what you're matching.
| Mode | Input | Matches | Config |
|---|---|---|---|
| ILIKE (default) | a text term | substring across searchable columns | searchable: [...] |
| Full-text search | a text term | keyword/lexeme match against a tsvector document | fullText: {...} |
| Vector similarity | a query embedding | nearest rows by embedding distance | vectorSimilarity: {...} |
Full-text search ≠ vector similarity
These two are easy to confuse — pgvector names its extension "vector", and plenty of prose calls tsvector search "vector search" too. They are not the same:
- Full-text search (
applyFullTextSearch) is keyword search — it matches a user's text query string against a Postgres tsvector document withwebsearch_to_tsquery/@@. Input: words. - Vector similarity (
applyVectorSimilarity) is embedding-similarity ordering — it ranks rows by distance between a stored embedding column and a query embedding vector (pgvector<=>/<->/<#>). Input: a numeric vector.
Keyword-in-text → full-text. Semantic "most similar to this embedding" → vector similarity. They are additive and can be combined (filter by keywords, rank by embedding).
The search term routing
The request's free-text search term routes to one text path, decided by the policy:
- Policy declares
fullText→ the term goes through tsvector full-text search. - Otherwise, if
searchableis set → the term goes through the portable ILIKE scan (OR-combined across the columns).
The ILIKE default is covered under Filter Classes and Getting Started; the two advanced modes have their own pages:
Cursor Pagination
Keyset (cursor) pagination — applyCursor / applyCursorFromRequest build a stable, seek-based page from the sort + a primary-key tiebreaker; buildCursorPage assembles the page and its opaque forward/backward cursors.
Full-Text Search
Postgres tsvector keyword search — route the request search term through websearch_to_tsquery / @@ against a tsvector column or to_tsvector-wrapped text columns, with optional ts_rank relevance ordering.