public RandomAccessDocIdSet getRandomAccessDocIdSet(final BoboSegmentReader reader)
throws IOException {
final FacetDataCache<?> dataCache = _facetHandler.getFacetData(reader);
final boolean multi = dataCache instanceof MultiValueFacetDataCache;
final BigNestedIntArray nestedArray = multi ? ((MultiValueFacetDataCache<?>) dataCache)._nestedArray
: null;
final int[] range = parse(dataCache, _rangeString);
if (range == null) return null;
if (range[0] > range[1]) {
return EmptyDocIdSet.getInstance();
}
if (range[0] == range[1] && range[0] < 0) {
return EmptyDocIdSet.getInstance();
}
return new RandomAccessDocIdSet() {
int _start = range[0];
int _end = range[1];
@Override
final public boolean get(int docId) {
if (multi) {
nestedArray.containsValueInRange(docId, _start, _end);
}
int index = dataCache.orderArray.get(docId);
return index >= _start && index <= _end;
}