OriginChainDB
Fts

Find documents containing a word

← FTS examples

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

Search an indexed field for a word. This mode returns document IDs without relevance scores.

Before you run it: The analyzer normalizes words. This is a word match, not a ranking of likely answers.

The indexing recipe adds only p001. With that data, searching wireless should return that ID. The larger response below illustrates the same format with additional documents; it is not a promise that those IDs were created for you. Lexicographic order means text order by ID, not best-match order.

Find documents that contain one wordBoolean search returns matching IDs, not a relevance ranking.
  1. Index the sample wordsMake wireless searchable in the chosen field.
  2. Search the wordThe field's text rules process the search term.
  3. Read matching IDsOpen the associated records; do not treat ID order as relevance.

Follow the example

  1. Index the sample documents.
  2. Reuse the same table and field names.
  3. Put one word in q.
  4. Open the returned IDs in the source data.

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=wireless" \
  --data-urlencode "mode=boolean"

Check the result

The response is a bare array of IDs in lexicographic order.

["p001", "p014", "p027"]

The body is the array itself - there is no { "mode": ..., "doc_ids": [...] } wrapper. Parse it and iterate directly.

Understand the behavior

  • The query is tokenised with the same analyser used at index time - lowercased and split on whitespace/punctuation.
  • The single token is looked up in the inverted index. The posting list for that token is the answer.
  • Because there's no scoring step, boolean mode is the cheapest query shape - constant work per matching doc, no per-doc maths.

Important limits and checks

  • Expecting a ranked order. The returned array is sorted lexicographically by doc_id, not by relevance. Don't read any ranking into the order.
  • Looking for a .doc_ids field. The response is the bare array - ["p001", "p014"] - not an object. Accessing .doc_ids on it returns undefined.
  • Expecting case sensitivity. The query token is lowercased to match indexing - q=Wireless and q=wireless behave identically.
  • Passing multiple tokens and expecting OR. Multi-token boolean is AND; see match every search term.

Continue

Continue to require every query word.

© 2026 Silicoyn Technologies Pvt Ltd

On this page