protected RangeFacetCountCollector( String name, FacetDataCache dataCache, int docBase, FacetSpec ospec, List<String> predefinedRanges) { _name = name; _dataCache = dataCache; _count = new int[_dataCache.freqs.length]; _array = _dataCache.orderArray; _docBase = docBase; _ospec = ospec; if (predefinedRanges != null) { _predefinedRanges = new ArrayList<String>(predefinedRanges); Collections.sort(_predefinedRanges); } else { _predefinedRanges = null; } if (_predefinedRanges != null) { _predefinedRangeIndexes = new int[_predefinedRanges.size()][]; int i = 0; for (String range : _predefinedRanges) { _predefinedRangeIndexes[i++] = FacetRangeFilter.parse(_dataCache, range); } } }
public BrowseFacet getFacet(String value) { BrowseFacet facet = null; int[] range = FacetRangeFilter.parse(_dataCache, value); if (range != null) { int sum = 0; for (int i = range[0]; i <= range[1]; ++i) { sum += _count[i]; } facet = new BrowseFacet(value, sum); } return facet; }