コード例 #1
0
            protected override SortedDocValues GetSortedDocValues(AtomicReaderContext context, string field)
            {
                SortedSetDocValues sortedSet = FieldCache.DEFAULT.GetDocTermOrds(context.AtomicReader, field);

                if (sortedSet.ValueCount >= int.MaxValue)
                {
                    throw new NotSupportedException("fields containing more than " + (int.MaxValue - 1) + " unique terms are unsupported");
                }

                SortedDocValues singleton = DocValues.UnwrapSingleton(sortedSet);

                if (singleton != null)
                {
                    // it's actually single-valued in practice, but indexed as multi-valued,
                    // so just sort on the underlying single-valued dv directly.
                    // regardless of selector type, this optimization is safe!
                    return(singleton);
                }
                else if (outerInstance.selector == Selector.MIN)
                {
                    return(new MinValue(sortedSet));
                }
                else
                {
                    if (sortedSet is RandomAccessOrds == false)
                    {
                        throw new NotSupportedException("codec does not support random access ordinals, cannot use selector: " + outerInstance.selector);
                    }
                    RandomAccessOrds randomOrds = (RandomAccessOrds)sortedSet;
                    switch (outerInstance.selector)
                    {
                    case Selector.MAX: return(new MaxValue(randomOrds));

                    case Selector.MIDDLE_MIN: return(new MiddleMinValue(randomOrds));

                    case Selector.MIDDLE_MAX: return(new MiddleMaxValue(randomOrds));

                    case Selector.MIN:
                    default:
                        if (Debugging.AssertsEnabled)
                        {
                            Debugging.Assert(false);
                        }
                        return(null);
                    }
                }
            }
コード例 #2
0
 internal MiddleMaxValue(RandomAccessOrds @in)
 {
     this.@in = @in;
 }