Exemple #1
0
        public virtual double ParseDouble(System.String val)
        {
            int shift = val[0] - NumericUtils.SHIFT_START_LONG;

            if (shift > 0 && shift <= 63)
            {
                throw new FieldCacheImpl.StopFillCacheException();
            }
            return(NumericUtils.SortableLongToDouble(NumericUtils.PrefixCodedToLong(val)));
        }
            public override DocIdSet GetDocIdSet(IndexReader reader)
            {
                // we transform the floating point numbers to sortable integers
                // using NumericUtils to easier find the next bigger/lower value
                double inclusiveLowerPoint;
                double inclusiveUpperPoint;

                if (lowerVal != null)
                {
                    double f = System.Convert.ToDouble(((System.ValueType)lowerVal));
                    if (!includeUpper && f > 0.0 && System.Double.IsInfinity(f))
                    {
                        return(DocIdSet.EMPTY_DOCIDSET);
                    }
                    long i = NumericUtils.DoubleToSortableLong(f);
                    inclusiveLowerPoint = NumericUtils.SortableLongToDouble(includeLower?i:(i + 1L));
                }
                else
                {
                    inclusiveLowerPoint = System.Double.NegativeInfinity;
                }
                if (upperVal != null)
                {
                    double f = System.Convert.ToDouble(((System.ValueType)upperVal));
                    if (!includeUpper && f < 0.0 && System.Double.IsInfinity(f))
                    {
                        return(DocIdSet.EMPTY_DOCIDSET);
                    }
                    long i = NumericUtils.DoubleToSortableLong(f);
                    inclusiveUpperPoint = NumericUtils.SortableLongToDouble(includeUpper?i:(i - 1L));
                }
                else
                {
                    inclusiveUpperPoint = System.Double.PositiveInfinity;
                }

                if (inclusiveLowerPoint > inclusiveUpperPoint)
                {
                    return(DocIdSet.EMPTY_DOCIDSET);
                }

                double[] values = Mono.Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetDoubles(reader, field, (Mono.Lucene.Net.Search.DoubleParser)parser);
                // we only request the usage of termDocs, if the range contains 0
                return(new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0.0 && inclusiveUpperPoint >= 0.0)));
            }