Full-text search examples
← All examplesFTS on OriginChainDB is a runtime endpoint: you POST documents to a field and query them back, and no schema declaration is required. Nine examples follow, each on its own page with side-by-side cURL / Python / TypeScript / Go, the response shape, and notes on common mistakes.
The native endpoint on this page covers BM25, boolean and phrase search. For fuzzy matching (typo tolerance), per-field analyzers with language stemming, and multi-field / boosted queries, use the Elasticsearch-compatible API — a drop-in for the @elastic clients that runs over these same substrate-native indexes. Connect a client →
The endpoint takes the form /v1/tenants/:t/fts/<schema>/<field>. Each field is its own independent inverted index. The doc_id you supply at index time is what comes back at search time - typically the row's primary key.
POST a doc_id + text to the FTS endpoint. Re-indexing the same doc_id atomically replaces the previous text.
Ask whether any doc contains a token. Returns matching doc_ids only, no ranking.
All tokens must match. Returns doc_ids. There is no OR in boolean mode - union client-side if you need it.
Tokens must appear in order, contiguously. Use for branded phrases, model numbers, log templates.
Lucene-default scoring (k1=1.2, b=0.75). Returns { doc_id, score } sorted by relevance. Use when ordering matters.
Index two fields separately, query each, merge results client-side with your own weights.
Bucket and measure the documents a query matched - terms, range, stats and cardinality folded over the whole match set, never the top-k.
Prefix completion, per-term spelling correction and whole-phrase rewriting from one endpoint, selected by the kind field.
Make tv and television interchangeable, or replace the built-in stopword list for one field. Both replace the stored record in full.