}
if (inclusiveLowerPoint > inclusiveUpperPoint)
return DocSet.EMPTY_DOC_SET;
final ShortFieldData fieldData = (ShortFieldData) this.fieldDataCache.cache(FieldDataType.DefaultTypes.SHORT, reader, field);
return new GetDocSet(reader.maxDoc()) {
@Override public boolean isCacheable() {
// not cacheable for several reasons:
// 1. It is only relevant when _cache is set to true, and then, we really want to create in mem bitset
// 2. Its already fast without in mem bitset, since it works with field data
return false;
}
@Override public boolean get(int doc) throws IOException {
if (!fieldData.hasValue(doc)) {
return false;
}
if (fieldData.multiValued()) {
short[] values = fieldData.values(doc);
for (short value : values) {
if (value >= inclusiveLowerPoint && value <= inclusiveUpperPoint) {
return true;
}
}
return false;
} else {
short value = fieldData.value(doc);
return value >= inclusiveLowerPoint && value <= inclusiveUpperPoint;
}
}
};
}