Require every query word
The language tabs use earlier client interfaces. Check SDK versions and connection setup before running them.
Find documents containing all query words, in any order and not necessarily next to each other.
Before you run it: Terms are combined with AND. Use phrase mode when order and adjacency matter.
First run the text-indexing setup. Its p001 text contains both wireless and headphones, so it matches this request. One missing query word excludes a document. The response example includes extra documents that must be indexed separately.
- Enter two termsSearch for wireless and headphones.
- Intersect their matchesKeep IDs found in both term lists.
- Open matching documentsDocuments containing only one term are excluded.
Follow the example
- Index the sample text.
- Put the required words in one query.
- Run boolean search.
- Check that each result contains every term.
Run the request
Tokens are space-separated in q. Some clients show this URL-encoded as wireless+headphones - same thing.
curl -G "https://$OC_HOST/v1/tenants/$OC_TENANT/fts/shop.products/description" \
-H "Authorization: Bearer $OC_TOKEN" \
--data-urlencode "q=wireless headphones" \
--data-urlencode "mode=boolean"Check the result
The response is a list of matching document IDs without scores.
["p001", "p027"]Bare array of doc_id strings (the intersection), sorted lexicographically. No wrapper object, no scores.
Understand the behavior
- The query is tokenised into a list - here
["wireless", "headphones"]. - The engine fetches the posting list for each token and intersects them. Smallest list first keeps the work bounded by the rarest term.
- The intersection is the answer. No scoring is computed.
Important limits and checks
- Assuming OR behaviour. Multi-token boolean is strictly AND - there is no OR mode. For OR, run two separate queries and union the returned arrays client-side.
- Expecting proximity. AND doesn't care where the tokens sit - "wireless mouse and wired headphones" matches "wireless headphones". Use phrase mode if you need them adjacent.
- Adding a rare token to "help match more". AND only narrows - every extra token can only remove docs, never add.