java.lang.Object
org.apache.lucene.facet.range.DynamicRangeUtil
Methods to create dynamic ranges for numeric fields.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Holds parameters of a dynamic numeric range.private static final class
Holds field value array, weight array, totalWeight, valid value index for each segmentprivate static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncomputeDynamicNumericRanges
(long[] values, long[] weights, int len, long totalWeight, int topN) Compute dynamic numeric ranges using weights.computeDynamicRanges
(String weightFieldName, LongValuesSource weightValueSource, LongValuesSource fieldValueSource, FacetsCollector facetsCollector, int topN, ExecutorService exec) Construct dynamic ranges using the specified weight field to generate equi-weight range for the specified numeric bin field
-
Constructor Details
-
DynamicRangeUtil
private DynamicRangeUtil()
-
-
Method Details
-
computeDynamicRanges
public static List<DynamicRangeUtil.DynamicRangeInfo> computeDynamicRanges(String weightFieldName, LongValuesSource weightValueSource, LongValuesSource fieldValueSource, FacetsCollector facetsCollector, int topN, ExecutorService exec) throws IOException Construct dynamic ranges using the specified weight field to generate equi-weight range for the specified numeric bin field- Parameters:
weightFieldName
- Name of the specified weight fieldweightValueSource
- Value source of the weight fieldfieldValueSource
- Value source of the value fieldfacetsCollector
- FacetsCollectortopN
- Number of requested rangesexec
- An executor service that is used to do the computation- Returns:
- A list of DynamicRangeInfo that contains count, relevance, min, max, and centroid for each range
- Throws:
IOException
-
computeDynamicNumericRanges
public static List<DynamicRangeUtil.DynamicRangeInfo> computeDynamicNumericRanges(long[] values, long[] weights, int len, long totalWeight, int topN) Compute dynamic numeric ranges using weights.- Parameters:
values
- an array that contains the values of matching documentsweights
- an array that contains the weights of matching documentslen
- actual length of values and weightstotalWeight
- the sum of weight valuestopN
- the requested top-n parameter- Returns:
- A list of DynamicRangeInfo that contains count, relevance, min, max, and centroid values for each range. The size of dynamic ranges may not be exactly equal to top-N. top-N is used to compute the equi-weight per bin.
-