19 using Lucene.Net.Index;
20 using Lucene.Net.Support;
26 namespace Lucene.Net.Search
56 public static class FieldCacheRangeFilter
59 private class AnonymousClassFieldCacheRangeFilter : FieldCacheRangeFilter<string>
61 private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
63 private void InitBlock(Lucene.Net.Search.StringIndex fcsi,
int inclusiveLowerPoint,
int inclusiveUpperPoint, FieldCacheRangeFilter<string> enclosingInstance)
66 this.inclusiveLowerPoint = inclusiveLowerPoint;
67 this.inclusiveUpperPoint = inclusiveUpperPoint;
68 this.enclosingInstance = enclosingInstance;
70 private Lucene.Net.Search.StringIndex fcsi;
71 private int inclusiveLowerPoint;
72 private int inclusiveUpperPoint;
73 private FieldCacheRangeFilter<string> enclosingInstance;
74 public FieldCacheRangeFilter<string> Enclosing_Instance
78 return enclosingInstance;
82 internal AnonymousClassFieldCacheDocIdSet(Lucene.Net.Search.StringIndex fcsi,
int inclusiveLowerPoint,
int inclusiveUpperPoint, FieldCacheRangeFilter<string> enclosingInstance, Lucene.Net.Index.IndexReader Param1,
bool Param2)
83 : base(Param1, Param2)
85 InitBlock(fcsi, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
87 internal override bool MatchDoc(
int doc)
89 return fcsi.order[doc] >= inclusiveLowerPoint && fcsi.order[doc] <= inclusiveUpperPoint;
92 internal AnonymousClassFieldCacheRangeFilter(
string field, Lucene.Net.Search.Parser parser,
string lowerVal,
string upperVal,
bool includeLower,
bool includeUpper)
93 : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
98 Lucene.Net.Search.StringIndex fcsi = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetStringIndex(reader, field);
99 int lowerPoint = fcsi.BinarySearchLookup(lowerVal);
100 int upperPoint = fcsi.BinarySearchLookup(upperVal);
102 int inclusiveLowerPoint;
103 int inclusiveUpperPoint;
111 System.Diagnostics.Debug.Assert(lowerVal == null);
112 inclusiveLowerPoint = 1;
114 else if (includeLower && lowerPoint > 0)
116 inclusiveLowerPoint = lowerPoint;
118 else if (lowerPoint > 0)
120 inclusiveLowerPoint = lowerPoint + 1;
124 inclusiveLowerPoint = System.Math.Max(1, -lowerPoint - 1);
129 System.Diagnostics.Debug.Assert(upperVal == null);
130 inclusiveUpperPoint = System.Int32.MaxValue;
132 else if (includeUpper && upperPoint > 0)
134 inclusiveUpperPoint = upperPoint;
136 else if (upperPoint > 0)
138 inclusiveUpperPoint = upperPoint - 1;
142 inclusiveUpperPoint = -upperPoint - 2;
145 if (inclusiveUpperPoint <= 0 || inclusiveLowerPoint > inclusiveUpperPoint)
148 System.Diagnostics.Debug.Assert(inclusiveLowerPoint > 0 && inclusiveUpperPoint > 0);
152 return new AnonymousClassFieldCacheDocIdSet(fcsi, inclusiveLowerPoint, inclusiveUpperPoint,
this, reader,
false);
156 private class AnonymousClassFieldCacheRangeFilter1 : FieldCacheRangeFilter<sbyte?>
158 private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
160 private void InitBlock(sbyte[] values, sbyte inclusiveLowerPoint, sbyte inclusiveUpperPoint, FieldCacheRangeFilter<sbyte?> enclosingInstance)
162 this.values = values;
163 this.inclusiveLowerPoint = inclusiveLowerPoint;
164 this.inclusiveUpperPoint = inclusiveUpperPoint;
165 this.enclosingInstance = enclosingInstance;
167 private sbyte[] values;
168 private sbyte inclusiveLowerPoint;
169 private sbyte inclusiveUpperPoint;
170 private FieldCacheRangeFilter<sbyte?> enclosingInstance;
171 public FieldCacheRangeFilter<sbyte?> Enclosing_Instance
175 return enclosingInstance;
179 internal AnonymousClassFieldCacheDocIdSet(sbyte[] values, sbyte inclusiveLowerPoint, sbyte inclusiveUpperPoint, FieldCacheRangeFilter<sbyte?> enclosingInstance, Lucene.Net.Index.IndexReader Param1,
bool Param2)
180 : base(Param1, Param2)
182 InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
184 internal override bool MatchDoc(
int doc)
186 return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
189 internal AnonymousClassFieldCacheRangeFilter1(
string field, Parser parser, sbyte? lowerVal, sbyte? upperVal,
bool includeLower,
bool includeUpper)
190 : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
195 sbyte inclusiveLowerPoint;
196 sbyte inclusiveUpperPoint;
197 if (lowerVal != null)
199 sbyte i = (sbyte)lowerVal;
200 if (!includeLower && i == sbyte.MaxValue)
202 inclusiveLowerPoint = (sbyte)(includeLower ? i : (i + 1));
206 inclusiveLowerPoint = sbyte.MinValue;
208 if (upperVal != null)
210 sbyte i = (sbyte)upperVal;
211 if (!includeUpper && i == sbyte.MinValue)
213 inclusiveUpperPoint = (sbyte)(includeUpper ? i : (i - 1));
217 inclusiveUpperPoint = sbyte.MaxValue;
220 if (inclusiveLowerPoint > inclusiveUpperPoint)
223 sbyte[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetBytes(reader, field, (Lucene.Net.Search.ByteParser)parser);
225 return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint,
this, reader, (inclusiveLowerPoint <= 0 && inclusiveUpperPoint >= 0));
229 private class AnonymousClassFieldCacheRangeFilter2 : FieldCacheRangeFilter<short?>
231 private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
233 private void InitBlock(
short[] values,
short inclusiveLowerPoint,
short inclusiveUpperPoint, FieldCacheRangeFilter<short?> enclosingInstance)
235 this.values = values;
236 this.inclusiveLowerPoint = inclusiveLowerPoint;
237 this.inclusiveUpperPoint = inclusiveUpperPoint;
238 this.enclosingInstance = enclosingInstance;
240 private short[] values;
241 private short inclusiveLowerPoint;
242 private short inclusiveUpperPoint;
243 private FieldCacheRangeFilter<short?> enclosingInstance;
244 public FieldCacheRangeFilter<short?> Enclosing_Instance
248 return enclosingInstance;
252 internal AnonymousClassFieldCacheDocIdSet(
short[] values,
short inclusiveLowerPoint,
short inclusiveUpperPoint, FieldCacheRangeFilter<short?> enclosingInstance, Lucene.Net.Index.IndexReader Param1,
bool Param2)
253 : base(Param1, Param2)
255 InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
257 internal override bool MatchDoc(
int doc)
259 return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
262 internal AnonymousClassFieldCacheRangeFilter2(
string field, Parser parser,
short? lowerVal,
short? upperVal,
bool includeLower,
bool includeUpper)
263 : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
268 short inclusiveLowerPoint;
269 short inclusiveUpperPoint;
270 if (lowerVal != null)
272 short i = (short)lowerVal;
273 if (!includeLower && i ==
short.MaxValue)
275 inclusiveLowerPoint = (short)(includeLower ? i : (i + 1));
279 inclusiveLowerPoint =
short.MinValue;
281 if (upperVal != null)
283 short i = (short)upperVal;
284 if (!includeUpper && i ==
short.MinValue)
286 inclusiveUpperPoint = (short)(includeUpper ? i : (i - 1));
290 inclusiveUpperPoint =
short.MaxValue;
293 if (inclusiveLowerPoint > inclusiveUpperPoint)
296 short[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetShorts(reader, field, (Lucene.Net.Search.ShortParser)parser);
298 return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint,
this, reader, (inclusiveLowerPoint <= 0 && inclusiveUpperPoint >= 0));
302 private class AnonymousClassFieldCacheRangeFilter3 : FieldCacheRangeFilter<int?>
304 private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
306 private void InitBlock(
int[] values,
int inclusiveLowerPoint,
int inclusiveUpperPoint, FieldCacheRangeFilter<int?> enclosingInstance)
308 this.values = values;
309 this.inclusiveLowerPoint = inclusiveLowerPoint;
310 this.inclusiveUpperPoint = inclusiveUpperPoint;
311 this.enclosingInstance = enclosingInstance;
313 private int[] values;
314 private int inclusiveLowerPoint;
315 private int inclusiveUpperPoint;
316 private FieldCacheRangeFilter<int?> enclosingInstance;
317 public FieldCacheRangeFilter<int?> Enclosing_Instance
321 return enclosingInstance;
325 internal AnonymousClassFieldCacheDocIdSet(
int[] values,
int inclusiveLowerPoint,
int inclusiveUpperPoint, FieldCacheRangeFilter<int?> enclosingInstance, Lucene.Net.Index.IndexReader Param1,
bool Param2)
326 : base(Param1, Param2)
328 InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
330 internal override bool MatchDoc(
int doc)
332 return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
335 internal AnonymousClassFieldCacheRangeFilter3(
string field, Lucene.Net.Search.Parser parser,
int? lowerVal,
int? upperVal,
bool includeLower,
bool includeUpper)
336 : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
341 int inclusiveLowerPoint;
342 int inclusiveUpperPoint;
343 if (lowerVal != null)
345 int i = (int)lowerVal;
346 if (!includeLower && i ==
int.MaxValue)
348 inclusiveLowerPoint = includeLower ? i : (i + 1);
352 inclusiveLowerPoint =
int.MinValue;
354 if (upperVal != null)
356 int i = (int)upperVal;
357 if (!includeUpper && i ==
int.MinValue)
359 inclusiveUpperPoint = includeUpper ? i : (i - 1);
363 inclusiveUpperPoint =
int.MaxValue;
366 if (inclusiveLowerPoint > inclusiveUpperPoint)
369 int[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetInts(reader, field, (Lucene.Net.Search.IntParser)parser);
371 return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint,
this, reader, (inclusiveLowerPoint <= 0 && inclusiveUpperPoint >= 0));
375 private class AnonymousClassFieldCacheRangeFilter4 : FieldCacheRangeFilter<long?>
377 private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
379 private void InitBlock(
long[] values,
long inclusiveLowerPoint,
long inclusiveUpperPoint, FieldCacheRangeFilter<long?> enclosingInstance)
381 this.values = values;
382 this.inclusiveLowerPoint = inclusiveLowerPoint;
383 this.inclusiveUpperPoint = inclusiveUpperPoint;
384 this.enclosingInstance = enclosingInstance;
386 private long[] values;
387 private long inclusiveLowerPoint;
388 private long inclusiveUpperPoint;
389 private FieldCacheRangeFilter<long?> enclosingInstance;
390 public FieldCacheRangeFilter<long?> Enclosing_Instance
394 return enclosingInstance;
398 internal AnonymousClassFieldCacheDocIdSet(
long[] values,
long inclusiveLowerPoint,
long inclusiveUpperPoint, FieldCacheRangeFilter<long?> enclosingInstance, Lucene.Net.Index.IndexReader Param1,
bool Param2)
399 : base(Param1, Param2)
401 InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
403 internal override bool MatchDoc(
int doc)
405 return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
408 internal AnonymousClassFieldCacheRangeFilter4(
string field, Lucene.Net.Search.Parser parser,
long? lowerVal,
long? upperVal,
bool includeLower,
bool includeUpper)
409 : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
414 long inclusiveLowerPoint;
415 long inclusiveUpperPoint;
416 if (lowerVal != null)
418 long i = (long)lowerVal;
419 if (!includeLower && i ==
long.MaxValue)
421 inclusiveLowerPoint = includeLower ? i : (i + 1L);
425 inclusiveLowerPoint =
long.MinValue;
427 if (upperVal != null)
429 long i = (long)upperVal;
430 if (!includeUpper && i ==
long.MinValue)
432 inclusiveUpperPoint = includeUpper ? i : (i - 1L);
436 inclusiveUpperPoint =
long.MaxValue;
439 if (inclusiveLowerPoint > inclusiveUpperPoint)
442 long[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetLongs(reader, field, (Lucene.Net.Search.LongParser)parser);
444 return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint,
this, reader, (inclusiveLowerPoint <= 0L && inclusiveUpperPoint >= 0L));
448 private class AnonymousClassFieldCacheRangeFilter5 : FieldCacheRangeFilter<float?>
450 private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
452 private void InitBlock(
float[] values,
float inclusiveLowerPoint,
float inclusiveUpperPoint, FieldCacheRangeFilter<float?> enclosingInstance)
454 this.values = values;
455 this.inclusiveLowerPoint = inclusiveLowerPoint;
456 this.inclusiveUpperPoint = inclusiveUpperPoint;
457 this.enclosingInstance = enclosingInstance;
459 private float[] values;
460 private float inclusiveLowerPoint;
461 private float inclusiveUpperPoint;
462 private FieldCacheRangeFilter<float?> enclosingInstance;
463 public FieldCacheRangeFilter<float?> Enclosing_Instance
467 return enclosingInstance;
471 internal AnonymousClassFieldCacheDocIdSet(
float[] values,
float inclusiveLowerPoint,
float inclusiveUpperPoint, FieldCacheRangeFilter<float?> enclosingInstance, Lucene.Net.Index.IndexReader Param1,
bool Param2)
472 : base(Param1, Param2)
474 InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
476 internal override bool MatchDoc(
int doc)
478 return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
481 internal AnonymousClassFieldCacheRangeFilter5(
string field, Lucene.Net.Search.Parser parser,
float? lowerVal,
float? upperVal,
bool includeLower,
bool includeUpper)
482 : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
489 float inclusiveLowerPoint;
490 float inclusiveUpperPoint;
491 if (lowerVal != null)
493 float f = (float)lowerVal;
494 if (!includeUpper && f > 0.0f &&
float.IsInfinity(f))
497 inclusiveLowerPoint =
NumericUtils.SortableIntToFloat(includeLower ? i : (i + 1));
501 inclusiveLowerPoint =
float.NegativeInfinity;
503 if (upperVal != null)
505 float f = (float)upperVal;
506 if (!includeUpper && f < 0.0f &&
float.IsInfinity(f))
509 inclusiveUpperPoint =
NumericUtils.SortableIntToFloat(includeUpper ? i : (i - 1));
513 inclusiveUpperPoint =
float.PositiveInfinity;
516 if (inclusiveLowerPoint > inclusiveUpperPoint)
519 float[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetFloats(reader, field, (Lucene.Net.Search.FloatParser)parser);
521 return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint,
this, reader, (inclusiveLowerPoint <= 0.0f && inclusiveUpperPoint >= 0.0f));
525 private class AnonymousClassFieldCacheRangeFilter6 : FieldCacheRangeFilter<double?>
527 private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
529 private void InitBlock(
double[] values,
double inclusiveLowerPoint,
double inclusiveUpperPoint, FieldCacheRangeFilter<double?> enclosingInstance)
531 this.values = values;
532 this.inclusiveLowerPoint = inclusiveLowerPoint;
533 this.inclusiveUpperPoint = inclusiveUpperPoint;
534 this.enclosingInstance = enclosingInstance;
536 private double[] values;
537 private double inclusiveLowerPoint;
538 private double inclusiveUpperPoint;
539 private FieldCacheRangeFilter<double?> enclosingInstance;
540 public FieldCacheRangeFilter<double?> Enclosing_Instance
544 return enclosingInstance;
548 internal AnonymousClassFieldCacheDocIdSet(
double[] values,
double inclusiveLowerPoint,
double inclusiveUpperPoint, FieldCacheRangeFilter<double?> enclosingInstance, Lucene.Net.Index.IndexReader Param1,
bool Param2)
549 : base(Param1, Param2)
551 InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
553 internal override bool MatchDoc(
int doc)
555 return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
558 internal AnonymousClassFieldCacheRangeFilter6(
string field, Lucene.Net.Search.Parser parser,
double? lowerVal,
double? upperVal,
bool includeLower,
bool includeUpper)
559 : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
566 double inclusiveLowerPoint;
567 double inclusiveUpperPoint;
568 if (lowerVal != null)
570 double f = (double)lowerVal;
571 if (!includeUpper && f > 0.0 &&
double.IsInfinity(f))
574 inclusiveLowerPoint =
NumericUtils.SortableLongToDouble(includeLower ? i : (i + 1L));
578 inclusiveLowerPoint =
double.NegativeInfinity;
580 if (upperVal != null)
582 double f = (double)upperVal;
583 if (!includeUpper && f < 0.0 &&
double.IsInfinity(f))
586 inclusiveUpperPoint =
NumericUtils.SortableLongToDouble(includeUpper ? i : (i - 1L));
590 inclusiveUpperPoint =
double.PositiveInfinity;
593 if (inclusiveLowerPoint > inclusiveUpperPoint)
596 double[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetDoubles(reader, field, (Lucene.Net.Search.DoubleParser)parser);
598 return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint,
this, reader, (inclusiveLowerPoint <= 0.0 && inclusiveUpperPoint >= 0.0));
606 public static FieldCacheRangeFilter<string> NewStringRange(
string field,
string lowerVal,
string upperVal,
bool includeLower,
bool includeUpper)
608 return new AnonymousClassFieldCacheRangeFilter(field, null, lowerVal, upperVal, includeLower, includeUpper);
615 public static FieldCacheRangeFilter<sbyte?> NewByteRange(
string field, sbyte? lowerVal, sbyte? upperVal,
bool includeLower,
bool includeUpper)
617 return NewByteRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
624 public static FieldCacheRangeFilter<sbyte?> NewByteRange(
string field, Lucene.Net.Search.ByteParser parser, sbyte? lowerVal, sbyte? upperVal,
bool includeLower,
bool includeUpper)
626 return new AnonymousClassFieldCacheRangeFilter1(field, parser, lowerVal, upperVal, includeLower, includeUpper);
633 public static FieldCacheRangeFilter<short?> NewShortRange(
string field,
short? lowerVal,
short? upperVal,
bool includeLower,
bool includeUpper)
635 return NewShortRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
642 public static FieldCacheRangeFilter<short?> NewShortRange(
string field, Lucene.Net.Search.ShortParser parser,
short? lowerVal,
short? upperVal,
bool includeLower,
bool includeUpper)
644 return new AnonymousClassFieldCacheRangeFilter2(field, parser, lowerVal, upperVal, includeLower, includeUpper);
651 public static FieldCacheRangeFilter<int?> NewIntRange(
string field,
int? lowerVal,
int? upperVal,
bool includeLower,
bool includeUpper)
653 return NewIntRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
660 public static FieldCacheRangeFilter<int?> NewIntRange(
string field, Lucene.Net.Search.IntParser parser,
int? lowerVal,
int? upperVal,
bool includeLower,
bool includeUpper)
662 return new AnonymousClassFieldCacheRangeFilter3(field, parser, lowerVal, upperVal, includeLower, includeUpper);
669 public static FieldCacheRangeFilter<long?> NewLongRange(
string field,
long? lowerVal,
long? upperVal,
bool includeLower,
bool includeUpper)
671 return NewLongRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
678 public static FieldCacheRangeFilter<long?> NewLongRange(
string field, Lucene.Net.Search.LongParser parser,
long? lowerVal,
long? upperVal,
bool includeLower,
bool includeUpper)
680 return new AnonymousClassFieldCacheRangeFilter4(field, parser, lowerVal, upperVal, includeLower, includeUpper);
687 public static FieldCacheRangeFilter<float?> NewFloatRange(
string field,
float? lowerVal,
float? upperVal,
bool includeLower,
bool includeUpper)
689 return NewFloatRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
696 public static FieldCacheRangeFilter<float?> NewFloatRange(
string field, Lucene.Net.Search.FloatParser parser,
float? lowerVal,
float? upperVal,
bool includeLower,
bool includeUpper)
698 return new AnonymousClassFieldCacheRangeFilter5(field, parser, lowerVal, upperVal, includeLower, includeUpper);
705 public static FieldCacheRangeFilter<double?> NewDoubleRange(
string field,
double? lowerVal,
double? upperVal,
bool includeLower,
bool includeUpper)
707 return NewDoubleRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
714 public static FieldCacheRangeFilter<double?> NewDoubleRange(
string field, Lucene.Net.Search.DoubleParser parser,
double? lowerVal,
double? upperVal,
bool includeLower,
bool includeUpper)
716 return new AnonymousClassFieldCacheRangeFilter6(field, parser, lowerVal, upperVal, includeLower, includeUpper);
721 public abstract class FieldCacheRangeFilter<T> :
Filter
723 internal System.String field;
724 internal Lucene.Net.Search.Parser parser;
727 internal bool includeLower;
728 internal bool includeUpper;
730 protected internal FieldCacheRangeFilter(System.String field, Lucene.Net.Search.Parser parser, T lowerVal, T upperVal,
bool includeLower,
bool includeUpper)
733 this.parser = parser;
734 this.lowerVal = lowerVal;
735 this.upperVal = upperVal;
736 this.includeLower = includeLower;
737 this.includeUpper = includeUpper;
743 public override System.String ToString()
745 System.Text.StringBuilder sb =
new System.Text.StringBuilder(field).Append(
":");
746 return sb.Append(includeLower?
'[':
'{').Append((lowerVal == null)?
"*":lowerVal.ToString()).Append(
" TO ").Append((upperVal == null)?
"*":upperVal.ToString()).Append(includeUpper?
']':
'}').ToString();
749 public override bool Equals(System.Object o)
755 FieldCacheRangeFilter<T> other = (FieldCacheRangeFilter<T>) o;
757 if (!this.field.Equals(other.field) || this.includeLower != other.includeLower || this.includeUpper != other.includeUpper)
761 if (this.lowerVal != null ?! this.lowerVal.Equals(other.lowerVal):other.lowerVal != null)
763 if (this.upperVal != null ?! this.upperVal.Equals(other.upperVal):other.upperVal != null)
765 if (this.parser != null ?! this.parser.Equals(other.parser):other.parser != null)
770 public override int GetHashCode()
772 int h = field.GetHashCode();
773 h ^= ((lowerVal != null)?lowerVal.GetHashCode():550356204);
775 h ^= ((upperVal != null)?upperVal.GetHashCode():- 1674416163);
776 h ^= ((parser != null)?parser.GetHashCode():- 1572457324);
777 h ^= (includeLower?1549299360:- 365038026) ^ (includeUpper?1721088258:1948649653);
784 public string GetField {
get {
return field; } }
789 public bool IncludesLower {
get {
return includeLower; } }
794 public bool IncludesUpper {
get {
return includeUpper; } }
799 public T LowerValue {
get {
return lowerVal; } }
804 public T UpperValue {
get {
return upperVal; } }
808 internal abstract class FieldCacheDocIdSet:
DocIdSet
812 public AnonymousClassDocIdSetIterator(Lucene.Net.Index.TermDocs termDocs, FieldCacheDocIdSet enclosingInstance)
814 InitBlock(termDocs, enclosingInstance);
816 private void InitBlock(Lucene.Net.Index.TermDocs termDocs, FieldCacheDocIdSet enclosingInstance)
818 this.termDocs = termDocs;
819 this.enclosingInstance = enclosingInstance;
821 private Lucene.Net.Index.TermDocs termDocs;
822 private FieldCacheDocIdSet enclosingInstance;
823 public FieldCacheDocIdSet Enclosing_Instance
827 return enclosingInstance;
831 private int doc = - 1;
833 public override int DocID()
838 public override int NextDoc()
842 if (!termDocs.Next())
843 return doc = NO_MORE_DOCS;
845 while (!Enclosing_Instance.MatchDoc(doc = termDocs.Doc));
849 public override int Advance(
int target)
851 if (!termDocs.SkipTo(target))
852 return doc = NO_MORE_DOCS;
853 while (!Enclosing_Instance.MatchDoc(doc = termDocs.Doc))
855 if (!termDocs.Next())
856 return doc = NO_MORE_DOCS;
863 public AnonymousClassDocIdSetIterator1(FieldCacheDocIdSet enclosingInstance)
865 InitBlock(enclosingInstance);
867 private void InitBlock(FieldCacheDocIdSet enclosingInstance)
869 this.enclosingInstance = enclosingInstance;
871 private FieldCacheDocIdSet enclosingInstance;
872 public FieldCacheDocIdSet Enclosing_Instance
876 return enclosingInstance;
880 private int doc = - 1;
882 public override int DocID()
887 public override int NextDoc()
895 while (!Enclosing_Instance.MatchDoc(doc));
898 catch (System.IndexOutOfRangeException)
900 return doc = NO_MORE_DOCS;
904 public override int Advance(
int target)
909 while (!Enclosing_Instance.MatchDoc(doc))
915 catch (System.IndexOutOfRangeException)
917 return doc = NO_MORE_DOCS;
922 private bool mayUseTermDocs;
924 internal FieldCacheDocIdSet(
IndexReader reader,
bool mayUseTermDocs)
926 this.reader = reader;
927 this.mayUseTermDocs = mayUseTermDocs;
931 internal abstract bool MatchDoc(
int doc);
934 public override bool IsCacheable
936 get {
return !(mayUseTermDocs && reader.
HasDeletions); }
948 termDocs = IsCacheable ? null : reader.
TermDocs(null);
950 if (termDocs != null)
953 return new AnonymousClassDocIdSetIterator(termDocs,
this);
959 return new AnonymousClassDocIdSetIterator1(
this);