Package org.apache.lucene.facet.range
Class DynamicRangeUtil
- java.lang.Object
-
- org.apache.lucene.facet.range.DynamicRangeUtil
-
public final class DynamicRangeUtil extends Object
Methods to create dynamic ranges for numeric fields.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DynamicRangeUtil.DynamicRangeInfo
Holds parameters of a dynamic numeric range.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<DynamicRangeUtil.DynamicRangeInfo>
computeDynamicNumericRanges(long[] values, long[] weights, int len, long totalWeight, int topN)
Compute dynamic numeric ranges using weights.static List<DynamicRangeUtil.DynamicRangeInfo>
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
-
-
-
Method Detail
-
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.
-
-