Find data with lexicographical matching
Hybrid search, lexical search, and reranking are currently in public preview. Development is ongoing, and the features and functionality are subject to change. Astra DB Serverless, and the use of such, is subject to the DataStax Preview Terms. |
You can use lexicographical matching to find a document.
Use lexicographical matching with the Data API
There are two ways to use lexicographical matching to find documents with the Data API:
-
Sort on the
$lexical
field to find the documents whose$lexical
field value is most relevant to a given string of space-separated keywords or terms -
Filter on the
$lexical
field with the$match
operator to find the documents whose$lexical
field value is a lexicographical match to the specified string of space-separated keywords or terms
You can use these strategies together or separately.
You can only use lexicographical matching on collections that have lexical enabled. For more information, see Create a collection that supports lexicographical matching.
Documents must have the $lexical
field populated to be included in lexicographical matching.
For examples, see Insert a document for retrieval with lexicographical matching and Insert documents for retrieval with lexicographical matching.