Loading TOC...

MarkLogic Server 11.0 Product Documentation
FacetsSearch.where

FacetsSearch.where(
   queries as cts.query
) as FacetsSearch

Summary

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.

Usage Notes

If your facet operation also includes a documents query, then the 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.

See Also

Example


// 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()
   

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.