Ejemplo n.º 1
0
        private void testEnum(int lower, int upper)
        {
            NumericRangeQuery <int> q        = NumericRangeQuery.NewIntRange("field4", 4, lower, upper, true, true);
            FilteredTermEnum        termEnum = q.GetEnum(searcher.IndexReader, null);

            try
            {
                int count = 0;
                do
                {
                    Term t = termEnum.Term;
                    if (t != null)
                    {
                        int val = NumericUtils.PrefixCodedToInt(t.Text);
                        Assert.True(val >= lower && val <= upper, "value not in bounds");
                        count++;
                    }
                    else
                    {
                        break;
                    }
                } while (termEnum.Next(null));
                Assert.False(termEnum.Next(null));
                Console.WriteLine("TermEnum on 'field4' for range [" + lower + "," + upper + "] contained " + count +
                                  " terms.");
            }
            finally
            {
                termEnum.Close();
            }
        }
Ejemplo n.º 2
0
 public virtual float ParseFloat(System.String val)
 {
     int shift = val[0] - NumericUtils.SHIFT_START_INT;
     if (shift > 0 && shift <= 31)
         throw new FieldCacheImpl.StopFillCacheException();
     return NumericUtils.SortableIntToFloat(NumericUtils.PrefixCodedToInt(val));
 }
Ejemplo n.º 3
0
        public virtual int ParseInt(string val)
        {
            int shift = val[0] - NumericUtils.SHIFT_START_INT;

            if (shift > 0 && shift <= 31)
            {
                throw new FieldCacheImpl.StopFillCacheException();
            }
            return(NumericUtils.PrefixCodedToInt(val));
        }