示例#1
0
        public override SortedSetDocValues GetSortedSetDocValues(string field)
        {
            EnsureOpen();
            OrdinalMap map = null;

            UninterruptableMonitor.Enter(cachedOrdMaps);
            try
            {
                if (!cachedOrdMaps.TryGetValue(field, out map))
                {
                    // uncached, or not a multi dv
                    SortedSetDocValues dv = MultiDocValues.GetSortedSetValues(@in, field);
                    if (dv is MultiSortedSetDocValues docValues)
                    {
                        map = docValues.Mapping;
                        if (map.owner == CoreCacheKey)
                        {
                            cachedOrdMaps[field] = map;
                        }
                    }
                    return(dv);
                }
            }
            finally
            {
                UninterruptableMonitor.Exit(cachedOrdMaps);
            }
            // cached ordinal map
            if (FieldInfos.FieldInfo(field).DocValuesType != DocValuesType.SORTED_SET)
            {
                return(null);
            }
            if (Debugging.AssertsEnabled)
            {
                Debugging.Assert(map != null);
            }
            int size   = @in.Leaves.Count;
            var values = new SortedSetDocValues[size];

            int[] starts = new int[size + 1];
            for (int i = 0; i < size; i++)
            {
                AtomicReaderContext context = @in.Leaves[i];
                SortedSetDocValues  v       = context.AtomicReader.GetSortedSetDocValues(field) ?? DocValues.EMPTY_SORTED_SET;
                values[i] = v;
                starts[i] = context.DocBase;
            }
            starts[size] = MaxDoc;
            return(new MultiSortedSetDocValues(values, starts, map));
        }
        public override SortedDocValues GetSortedDocValues(string field)
        {
            EnsureOpen();
            OrdinalMap map = null;

            lock (cachedOrdMaps)
            {
                if (!cachedOrdMaps.TryGetValue(field, out map))
                {
                    // uncached, or not a multi dv
                    SortedDocValues      dv        = MultiDocValues.GetSortedValues(@in, field);
                    MultiSortedDocValues docValues = dv as MultiSortedDocValues;
                    if (docValues != null)
                    {
                        map = docValues.Mapping;
                        if (map.owner == CoreCacheKey)
                        {
                            cachedOrdMaps[field] = map;
                        }
                    }
                    return(dv);
                }
            }
            // cached ordinal map
            if (FieldInfos.FieldInfo(field).DocValuesType != DocValuesType.SORTED)
            {
                return(null);
            }
            int size = @in.Leaves.Count;

            SortedDocValues[] values = new SortedDocValues[size];
            int[]             starts = new int[size + 1];
            for (int i = 0; i < size; i++)
            {
                AtomicReaderContext context = @in.Leaves[i];
                SortedDocValues     v       = context.AtomicReader.GetSortedDocValues(field) ?? DocValues.EMPTY_SORTED;
                values[i] = v;
                starts[i] = context.DocBase;
            }
            starts[size] = MaxDoc;
            return(new MultiSortedDocValues(values, starts, map));
        }
 public override IBits GetDocsWithField(string field)
 {
     EnsureOpen();
     return(MultiDocValues.GetDocsWithField(@in, field));
 }
 public override NumericDocValues GetNumericDocValues(string field)
 {
     EnsureOpen();
     return(MultiDocValues.GetNumericValues(@in, field));
 }
 public override BinaryDocValues GetBinaryDocValues(string field)
 {
     EnsureOpen();
     return(MultiDocValues.GetBinaryValues(@in, field));
 }