
FacetDefinition.slice( start as integer, end as integer ) as FacetDefinition
Specifies a subsequence of values to retrieve as in a ValuesSearch definition.
| Parameters | |
|---|---|
| start | The zero-based index of the first value to return. |
| end | The zero-based index of the value after the last value to return. |
// Generate facets on the "author" JSON property, ordered by frequency.
// Return only the first 3 facets.
const jsearch = require('/MarkLogic/jsearch.sjs');
jsearch.facets(
jsearch.facet('Author', 'author')
.orderBy('frequency')
.slice(0, 3)
.where(jsearch.byExample({price: {$lt: 20}}))
.result()