Find documents containing a word
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.
- Index the sample wordsMake wireless searchable in the chosen field.
- Search the wordThe field's text rules process the search term.
- Read matching IDsOpen the associated records; do not treat ID order as relevance.
Follow the example
- Index the sample documents.
- Reuse the same table and field names.
- Put one word in q.
- 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_idsfield. The response is the bare array -["p001", "p014"]- not an object. Accessing.doc_idson it returns undefined. - Expecting case sensitivity. The query token is lowercased to match indexing -
q=Wirelessandq=wirelessbehave identically. - Passing multiple tokens and expecting OR. Multi-token boolean is AND; see match every search term.