
WordsSearch.where( queries as cts.query ) as WordsSearch
Limit the words returned by a word lexicon query to those in documents selected by a query.
| Parameters | |
|---|---|
| queries | One or an array of cts.query objects matching documents. Some helper functions such as cts.parse() and jsearch.byExample() return a cts.query object. |
Apply this method only to the output from jsearch.words.
You can construct the input queries using cts.parse,
jsearch.byExample, a cts.query constructor such as
cts.jsonPropertyWordQuery or
cts.elementValueQuery, or any other function that
returns a cts.query object.
Omit the where clause to retrieve words from all documents.
// Find all words in the database that are in documents where
// "format" JSON property has the value "hardback".
const jsearch = require('/MarkLogic/jsearch.sjs');
jsearch.words(jsearch.databaseLexicon())
.where(jsearch.byExample({'format': 'hardback'}))
.result()
/* Result: The first 10 matching words. Use slice to control the number
of results.
["13",
"a",
"A",
"account",
"adventure",
"adventures",
"Adventures",
"all",
"along",
"America"]
*/