private void  InitBlock(Mono.Lucene.Net.Search.StringIndex fcsi, int inclusiveLowerPoint, int inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter enclosingInstance)
 {
     this.fcsi = fcsi;
     this.inclusiveLowerPoint = inclusiveLowerPoint;
     this.inclusiveUpperPoint = inclusiveUpperPoint;
     this.enclosingInstance   = enclosingInstance;
 }
            public override DocIdSet GetDocIdSet(IndexReader reader)
            {
                Mono.Lucene.Net.Search.StringIndex fcsi = Mono.Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetStringIndex(reader, field);
                int lowerPoint = fcsi.BinarySearchLookup((System.String)lowerVal);
                int upperPoint = fcsi.BinarySearchLookup((System.String)upperVal);

                int inclusiveLowerPoint;
                int inclusiveUpperPoint;

                // Hints:
                // * binarySearchLookup returns 0, if value was null.
                // * the value is <0 if no exact hit was found, the returned value
                //   is (-(insertion point) - 1)
                if (lowerPoint == 0)
                {
                    System.Diagnostics.Debug.Assert(lowerVal == null);
                    inclusiveLowerPoint = 1;
                }
                else if (includeLower && lowerPoint > 0)
                {
                    inclusiveLowerPoint = lowerPoint;
                }
                else if (lowerPoint > 0)
                {
                    inclusiveLowerPoint = lowerPoint + 1;
                }
                else
                {
                    inclusiveLowerPoint = System.Math.Max(1, -lowerPoint - 1);
                }

                if (upperPoint == 0)
                {
                    System.Diagnostics.Debug.Assert(upperVal == null);
                    inclusiveUpperPoint = System.Int32.MaxValue;
                }
                else if (includeUpper && upperPoint > 0)
                {
                    inclusiveUpperPoint = upperPoint;
                }
                else if (upperPoint > 0)
                {
                    inclusiveUpperPoint = upperPoint - 1;
                }
                else
                {
                    inclusiveUpperPoint = -upperPoint - 2;
                }

                if (inclusiveUpperPoint <= 0 || inclusiveLowerPoint > inclusiveUpperPoint)
                {
                    return(DocIdSet.EMPTY_DOCIDSET);
                }

                System.Diagnostics.Debug.Assert(inclusiveLowerPoint > 0 && inclusiveUpperPoint > 0);

                // for this DocIdSet, we never need to use TermDocs,
                // because deleted docs have an order of 0 (null entry in StringIndex)
                return(new AnonymousClassFieldCacheDocIdSet(fcsi, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, false));
            }
Exemple #3
0
        /*(non-Javadoc) @see Mono.Lucene.Net.Search.Function.ValueSource#getValues(Mono.Lucene.Net.Index.IndexReader) */
        public override DocValues GetValues(IndexReader reader)
        {
            Mono.Lucene.Net.Search.StringIndex sindex = Mono.Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetStringIndex(reader, field);

            int[] arr = sindex.order;
            int   end = sindex.lookup.Length;

            return(new AnonymousClassDocValues(end, arr, this));
        }
Exemple #4
0
 public FieldCacheTermsFilterDocIdSet(FieldCacheTermsFilter enclosingInstance, Mono.Lucene.Net.Search.StringIndex fcsi)
 {
     InitBlock(enclosingInstance);
     this.fcsi  = fcsi;
     openBitSet = new OpenBitSet(this.fcsi.lookup.Length);
     for (int i = 0; i < Enclosing_Instance.terms.Length; i++)
     {
         int termNumber = this.fcsi.BinarySearchLookup(Enclosing_Instance.terms[i]);
         if (termNumber > 0)
         {
             openBitSet.FastSet(termNumber);
         }
     }
 }
Exemple #5
0
            public override void  SetNextReader(IndexReader reader, int docBase)
            {
                StringIndex currentReaderValues = Mono.Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetStringIndex(reader, field);

                currentReaderGen++;
                order  = currentReaderValues.order;
                lookup = currentReaderValues.lookup;
                System.Diagnostics.Debug.Assert(lookup.Length > 0);
                if (bottomSlot != -1)
                {
                    Convert(bottomSlot);
                    bottomOrd = ords[bottomSlot];
                }
            }
 internal AnonymousClassFieldCacheDocIdSet(Mono.Lucene.Net.Search.StringIndex fcsi, int inclusiveLowerPoint, int inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter enclosingInstance, Mono.Lucene.Net.Index.IndexReader Param1, bool Param2) : base(Param1, Param2)
 {
     InitBlock(fcsi, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
 }
Exemple #7
0
 /// <summary> Returns a comparator for sorting hits according to a field containing strings.</summary>
 /// <param name="reader"> Index to use.
 /// </param>
 /// <param name="fieldname"> Fieldable containing string values.
 /// </param>
 /// <returns>  Comparator for sorting hits.
 /// </returns>
 /// <throws>  IOException If an error occurs reading the index. </throws>
 internal static ScoreDocComparator comparatorString(IndexReader reader, System.String fieldname)
 {
     System.String field = String.Intern(fieldname);
     Mono.Lucene.Net.Search.StringIndex index = Mono.Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetStringIndex(reader, field);
     return(new AnonymousClassScoreDocComparator6(index));
 }
Exemple #8
0
 private void  InitBlock(Mono.Lucene.Net.Search.StringIndex index)
 {
     this.index = index;
 }
Exemple #9
0
 public AnonymousClassScoreDocComparator6(Mono.Lucene.Net.Search.StringIndex index)
 {
     InitBlock(index);
 }
			public FieldCacheTermsFilterDocIdSet(FieldCacheTermsFilter enclosingInstance, Mono.Lucene.Net.Search.StringIndex fcsi)
			{
				InitBlock(enclosingInstance);
				this.fcsi = fcsi;
				openBitSet = new OpenBitSet(this.fcsi.lookup.Length);
				for (int i = 0; i < Enclosing_Instance.terms.Length; i++)
				{
					int termNumber = this.fcsi.BinarySearchLookup(Enclosing_Instance.terms[i]);
					if (termNumber > 0)
					{
						openBitSet.FastSet(termNumber);
					}
				}
			}