public override DocIdSet GetDocIdSet(AtomicReaderContext context, IBits acceptDocs) { int inclusiveLowerPoint, inclusiveUpperPoint; if (lowerVal != null) { int i = (int)lowerVal; if (!includeLower && i == int.MaxValue) return null; inclusiveLowerPoint = includeLower ? i : (i + 1); } else { inclusiveLowerPoint = int.MinValue; } if (upperVal != null) { int i = (int)upperVal; if (!includeUpper && i == int.MinValue) return null; inclusiveUpperPoint = includeUpper ? i : (i - 1); } else { inclusiveUpperPoint = int.MaxValue; } if (inclusiveLowerPoint > inclusiveUpperPoint) return null; FieldCache.Int32s values = FieldCache.DEFAULT.GetInt32s(context.AtomicReader, field, (FieldCache.IInt32Parser)parser, false); // we only request the usage of termDocs, if the range contains 0 return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs); }
internal AnonymousClassFieldCacheDocIdSet(FieldCache.Int32s values, int inclusiveLowerPoint, int inclusiveUpperPoint, int maxDoc, IBits acceptDocs) : base(maxDoc, acceptDocs) { this.values = values; this.inclusiveLowerPoint = inclusiveLowerPoint; this.inclusiveUpperPoint = inclusiveUpperPoint; }
public override DocIdSet GetDocIdSet(AtomicReaderContext context, IBits acceptDocs) { int inclusiveLowerPoint, inclusiveUpperPoint; if (lowerVal != null) { int i = (int)lowerVal; if (!includeLower && i == int.MaxValue) { return(null); } inclusiveLowerPoint = includeLower ? i : (i + 1); } else { inclusiveLowerPoint = int.MinValue; } if (upperVal != null) { int i = (int)upperVal; if (!includeUpper && i == int.MinValue) { return(null); } inclusiveUpperPoint = includeUpper ? i : (i - 1); } else { inclusiveUpperPoint = int.MaxValue; } if (inclusiveLowerPoint > inclusiveUpperPoint) { return(null); } FieldCache.Int32s values = FieldCache.DEFAULT.GetInt32s(context.AtomicReader, field, (FieldCache.IInt32Parser)parser, false); // we only request the usage of termDocs, if the range contains 0 return(new FieldCacheDocIdSet(context.Reader.MaxDoc, acceptDocs, (doc) => { int value = values.Get(doc); return value >= inclusiveLowerPoint && value <= inclusiveUpperPoint; })); }