/// <summary> /// Creates a multi-valued view over the provided <see cref="Index.SortedDocValues"/> </summary> public SingletonSortedSetDocValues(SortedDocValues @in) { this.@in = @in; Debug.Assert(NO_MORE_ORDS == -1); // this allows our nextOrd() to work for missing values without a check }
private void MergeDocValues(SegmentWriteState segmentWriteState) { DocValuesConsumer consumer = codec.DocValuesFormat.FieldsConsumer(segmentWriteState); bool success = false; try { foreach (FieldInfo field in mergeState.FieldInfos) { DocValuesType type = field.DocValuesType; if (type != DocValuesType.NONE) { if (type == DocValuesType.NUMERIC) { IList <NumericDocValues> toMerge = new List <NumericDocValues>(); IList <IBits> docsWithField = new List <IBits>(); foreach (AtomicReader reader in mergeState.Readers) { NumericDocValues values = reader.GetNumericDocValues(field.Name); IBits bits = reader.GetDocsWithField(field.Name); if (values == null) { values = DocValues.EMPTY_NUMERIC; bits = new Lucene.Net.Util.Bits.MatchNoBits(reader.MaxDoc); } toMerge.Add(values); docsWithField.Add(bits); } consumer.MergeNumericField(field, mergeState, toMerge, docsWithField); } else if (type == DocValuesType.BINARY) { IList <BinaryDocValues> toMerge = new List <BinaryDocValues>(); IList <IBits> docsWithField = new List <IBits>(); foreach (AtomicReader reader in mergeState.Readers) { BinaryDocValues values = reader.GetBinaryDocValues(field.Name); IBits bits = reader.GetDocsWithField(field.Name); if (values == null) { values = DocValues.EMPTY_BINARY; bits = new Lucene.Net.Util.Bits.MatchNoBits(reader.MaxDoc); } toMerge.Add(values); docsWithField.Add(bits); } consumer.MergeBinaryField(field, mergeState, toMerge, docsWithField); } else if (type == DocValuesType.SORTED) { IList <SortedDocValues> toMerge = new List <SortedDocValues>(); foreach (AtomicReader reader in mergeState.Readers) { SortedDocValues values = reader.GetSortedDocValues(field.Name); if (values == null) { values = DocValues.EMPTY_SORTED; } toMerge.Add(values); } consumer.MergeSortedField(field, mergeState, toMerge); } else if (type == DocValuesType.SORTED_SET) { IList <SortedSetDocValues> toMerge = new List <SortedSetDocValues>(); foreach (AtomicReader reader in mergeState.Readers) { SortedSetDocValues values = reader.GetSortedSetDocValues(field.Name); if (values == null) { values = DocValues.EMPTY_SORTED_SET; } toMerge.Add(values); } consumer.MergeSortedSetField(field, mergeState, toMerge); } else { throw new InvalidOperationException("type=" + type); } } } success = true; } finally { if (success) { IOUtils.Dispose(consumer); } else { IOUtils.DisposeWhileHandlingException(consumer); } } }
/// <summary> /// Creates a new <see cref="TermsEnum"/> over the provided values </summary> public SortedDocValuesTermsEnum(SortedDocValues values) { this.values = values; }
public BitsAnonymousClass(SortedDocValues dv, int maxDoc) { this.dv = dv; this.maxDoc = maxDoc; }
/// <summary> /// Returns a <see cref="IBits"/> representing all documents from <paramref name="dv"/> that have a value. /// </summary> public static IBits DocsWithValue(SortedDocValues dv, int maxDoc) { return(new BitsAnonymousClass(dv, maxDoc)); }
/// <summary> /// Returns a multi-valued view over the provided <see cref="SortedDocValues"/> /// </summary> public static SortedSetDocValues Singleton(SortedDocValues dv) { return(new SingletonSortedSetDocValues(dv)); }