FacetDefinition.othersWhere( queries as cts.query ) as FacetDefinition
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. |
// 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()
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.