Loading TOC...

WordsSearch.where

WordsSearch.where(
   $queries as cts.query
) as WordsSearch

Summary

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.

Usage Notes

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.

See Also

Example


// 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"]
*/
   

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy