MarkLogic 10 Product Documentation
FacetDefinition.othersWhere

FacetDefinition.othersWhere(
   queries as cts.query
) as FacetDefinition

Summary

Specify a query to apply to facets other than this one. If a documents query is included, this query also applies to the documents result set.

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.

See Also

Example


// Generate facets from documents where the price JSON property value
// is less than 20. For facets other than "format", only return facet
// values for documents where the format value is "paperback".
const jsearch = require('/MarkLogic/jsearch.sjs');
jsearch.facets([
    jsearch.facet('Author', 'author'),
    jsearch.facet('MediaFormat','format')
      .othersWhere(jsearch.byExample({format: 'paperback'}))],
    jsearch.documents()
      .where(jsearch.byExample({author: 'Mark Twain'})))
  .where(jsearch.byExample({price: {$lt: 20}}))
  .result()
   
Powered by MarkLogic Server | Terms of Use | Privacy Policy