Loading TOC...

jsearch.makeBuckets

jsearch.makeBuckets(
   $configuration as object
) as BucketDefinition

Summary

Returns a list of bounds for grouping by subdividing an interval either with a fixed step size or a fixed number of division buckets within the min and max boundary values as input for the ValuesSearch.groupInto or FacetDefinition.groupInto method.

Parameters
$configurationThe options for generating the buckets.

Usage Notes

The configuration options specify the following parameters:
min
The smallest bound, which provides the ceiling for the first bucket. Required.
max
The largest bound, which provides the floor for the last bucket. Required.
step
The size of the buckets between the min and max; to make all buckets equal, the difference between the min and max should be divisible by an integer to yield the step. Exclusive with respect to divs, one of which is required.
divs
The number of buckets between the min and max. Exclusive with respect to step, one of which is required.
named
A boolean specifying whether to assign names to buckets. Optional.

Empty buckets are thrown away by default. The cost of throwing away hundreds of empty buckets is smaller than the cost of looking up a minimum or maximum in a range index, so it can yields better performance to overestimate the min and max instead of determining them exactly.

See Also

Example


// Define a set of buckets over dates, where each bucket covers one month
jsearch.makeBuckets({
  min: xs.date('2015-01-01'), 
  max: xs.date('2015-12-31'), 
  step: xs.yearMonthDuration('P1M')
})
   

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy