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.
  • 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 field
      weightValueSource - Value source of the weight field
      fieldValueSource - Value source of the value field
      facetsCollector - FacetsCollector
      topN - Number of requested ranges
      exec - 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 documents
      weights - an array that contains the weights of matching documents
      len - actual length of values and weights
      totalWeight - the sum of weight values
      topN - 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.