
FacetsSearch.where( queries as cts.query ) as FacetsSearch
Specify one or an array of cts.query's used to qualify the facet values and the document result set (if requested).
| Parameters | |
|---|---|
| queries | One or an array of cts.query objects. Some helper functions such as cts.parse() and jsearch.byExample() return a cts.query object. |
where clause of that query qualify only the documents.
By contrast, this where can be used to qualify both the
facet values and any returned documents.
// Generate facets for the author and format JSON properties. Include
// only those values that occur in documents where the price JSON
// property values is less than 15.
const jsearch = require('/MarkLogic/jsearch.sjs');
jsearch.facets([
jsearch.facet('Author', 'author'),
jsearch.facet('MediaFormat', 'format')])
.where(jsearch.byExample({price: {$lt: 15}}))
.result()