OriginChainDB
Fts

Find words in order

← FTS examples

The language tabs use earlier client interfaces. Check SDK versions and connection setup before running them.

Match adjacent words in query order after the field’s analyzer has processed them.

Before you run it: Phrase mode is not fuzzy matching. Analysis can remove punctuation and change case.

The indexed sample contains the adjacent words noise cancellation, so p001 should match. An analyzer is the rule that splits and normalizes text before comparison. Phrase matching follows those processed words, not the original punctuation byte for byte.

Find words together in the same orderPhrase matching uses processed tokens, not fuzzy matching or arbitrary substrings.
  1. Index token positionsLoad the sample text containing noise cancellation.
  2. Search the phraseRequire those processed words next to each other.
  3. Read matching IDsOpen the documents that preserve the requested word order.

Follow the example

  1. Index the sample text.
  2. Choose a phrase.
  3. Set mode: phrase.
  4. Inspect the matching documents.

Run the request

First index the sample text. Use the same table and field in the search request; storing a row alone does not create its search entry.

curl -G "https://$OC_HOST/v1/tenants/$OC_TENANT/fts/shop.products/description" \
  -H "Authorization: Bearer $OC_TOKEN" \
  --data-urlencode "q=noise cancellation" \
  --data-urlencode "mode=phrase"

Check the result

The result contains IDs whose analyzed words contain the phrase.

["p001"]

Same shape as boolean: a bare array of doc_id strings, no wrapper, no scores. Phrase mode just narrows which docs qualify.

Understand the behavior

  • The query is tokenised the same way as the indexed text.
  • The engine pulls posting lists for each token along with token positions inside each document.
  • A doc matches only if the positions are consecutive: position(ti+1) = position(ti) + 1 for every adjacent token pair.

Important limits and checks

  • Expecting stemming to bridge word forms. The API analyzer is Unicode-tokenize + lowercase only - it does not stem. q=noise cancel will not match a doc that says "noise cancellation"; the literal token cancellation must be present.
  • Punctuation between tokens. Most analysers strip punctuation - "noise, cancellation" in the source text still phrase-matches q=noise cancellation.
  • Expecting fuzzy behaviour. Phrase is strict - one typo and the phrase doesn't match. Use BM25 with fuzzy=1 if you need typo tolerance.

Continue

Continue to rank text matches.

© 2026 Silicoyn Technologies Pvt Ltd

On this page