final int startValue = range[0];
final int endValue = range[1];
if (startValue >= endValue) {
return EmptyDocIdSet.getInstance();
}
return new RandomAccessDocIdSet() {
@Override
public DocIdSetIterator iterator() throws IOException {
if (intArray != null) {
return new ActivityRangeIntFilterIterator(intArray, indexes, startValue, endValue);
} else {
return new ActivityRangeFloatFilterIterator(floatArray, indexes, startValue, endValue);
}
}
@Override
public boolean get(int docId) {
if (indexes[docId] == -1) return false;
if (intArray != null) {
int val = intArray[indexes[docId]];
return val >= startValue && val < endValue && val != Integer.MIN_VALUE;
}
float val = floatArray[indexes[docId]];
return val >= startValue && val < endValue && val != Integer.MIN_VALUE;
}
};
} else {
final long[] longRange = longArray != null ? parseRawLong(value) : null;
final long startValue = longRange[0];
final long endValue = longRange[1];
if (startValue >= endValue) {
return EmptyDocIdSet.getInstance();
}
return new RandomAccessDocIdSet() {
@Override
public DocIdSetIterator iterator() throws IOException {
return new ActivityRangeLongFilterIterator(longArray, indexes, startValue, endValue);
}