This page covers functions that can be used to make queries involving a text search.
Text search functions operate on fields that have been tokenized into
arrays of strings; you may do so by creating a field mapping
SEARCH function only works in the
WHERE clause of a query on
a collection. It does not work if the target of a query is a subquery or a
JOIN, and it does not work in other parts of the query outside of the
SEARCH may be combined with other operators and functions in the
If you use the
SCORE() becomes available as a function
with no arguments, returning the score of the match.
Note that text search is currently an experimental feature. Please send us feedback.
Set the boost value (a positive floating point value) for a specific search
term. Unboosted terms have a default boost value of
CONTAINS(field, search_string[, locale])
Add terms to the query that correspond to the given search string,
tokenized in the given locale (default:
en_US). The terms will be placed
in a proximity range.
Search term that matches when the specified field contains the specified term value.
Create a proximity range for these terms. These terms will contribute 1
point to the final score, just like other terms in the
but will also contribute a score that depends on the longest consecutive
Set the proximity range boost value (a positive floating point value) for a specific search proximity range. This affects the range’s specific contribution to the score, not the contributions of the individual terms in the range.
proximity_range must be a proximity range created using either
SEARCH(term[, term]*) [OPTION(match_all=false)]
Return documents that match all of the terms (by default), or at least one of
the terms (with
OPTION(match_all=false)). The terms are arbitrary SQL boolean
expressions, optionally boosted.
The score of the match is the sum of the boost values (default 1) for all terms
that matched. For searches that include proximity ranges (see below), each
proximity range also adds to the score a value equal to
(longest match in the proximity range - 1) / 2 (multiplied by the range’s boost value).
text, interpreted as text in the language specified by
locale is specified using the ICU format. The default is
Returns an array of strings corresponding to the words in the text, normalized and lower-cased.