Term Search
Basic Usage
Searches for the presence of a specific term. Terms must be prefixed by the field name.
SELECT * FROM search_idx.search('description:keyboard');
If the provided term can be tokenized further, the tokenization is automatically applied at search time using the same tokenizer as the prefixed field.
Multiple Terms
Multiple terms can be wrapped inside parentheses.
SELECT * FROM search_idx.search('description:(shoes keyboard)');
This query matches all documents that contain shoes
, keyboard
, or both.
Negative Term
By prepending a term with -
, a term can be excluded from the search.
SELECT * FROM search_idx.search('description:(shoes -running)');
Must Term
By prepending a term with +
, a term can be made required for search.
SELECT * FROM search_idx.search('description:(shoes +running)');
Boolean Operators
AND
, OR
, and NOT
can be used to combine and filter multiple terms.
SELECT * FROM search_idx.search('description:keyboard OR category:toy');
Use parentheses to group terms and control the order of operations.
SELECT * FROM search_idx.search(
'(description:keyboard OR category:toy) AND description:metal'
);
Special Characters
The special characters +
, ^
, ```, :
, {
, }
, "
, [
, ]
, (
, )
, ~
, !
, \\
, \*
, and SPACE
must be escaped by a\
inside the query term.
Was this page helpful?