public abstract class DocValuesConsumer extends Object implements Closeable
The lifecycle is:
NormsFormat.normsConsumer(SegmentWriteState)
.
addNumericField(org.apache.lucene.index.FieldInfo, java.lang.Iterable<java.lang.Number>)
, addBinaryField(org.apache.lucene.index.FieldInfo, java.lang.Iterable<org.apache.lucene.util.BytesRef>)
,
addSortedField(org.apache.lucene.index.FieldInfo, java.lang.Iterable<org.apache.lucene.util.BytesRef>, java.lang.Iterable<java.lang.Number>)
, addSortedSetField(org.apache.lucene.index.FieldInfo, java.lang.Iterable<org.apache.lucene.util.BytesRef>, java.lang.Iterable<java.lang.Number>, java.lang.Iterable<java.lang.Number>)
,
or addSortedNumericField(org.apache.lucene.index.FieldInfo, java.lang.Iterable<java.lang.Number>, java.lang.Iterable<java.lang.Number>)
are called for each Numeric,
Binary, Sorted, SortedSet, or SortedNumeric docvalues field.
The API is a "pull" rather than "push", and the implementation
is free to iterate over the values multiple times
(Iterable.iterator()
).
Closeable.close()
d.
Modifier | Constructor and Description |
---|---|
protected |
DocValuesConsumer()
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addBinaryField(FieldInfo field,
Iterable<BytesRef> values)
Writes binary docvalues for a field.
|
abstract void |
addNumericField(FieldInfo field,
Iterable<Number> values)
Writes numeric docvalues for a field.
|
abstract void |
addSortedField(FieldInfo field,
Iterable<BytesRef> values,
Iterable<Number> docToOrd)
Writes pre-sorted binary docvalues for a field.
|
abstract void |
addSortedNumericField(FieldInfo field,
Iterable<Number> docToValueCount,
Iterable<Number> values)
Writes pre-sorted numeric docvalues for a field
|
abstract void |
addSortedSetField(FieldInfo field,
Iterable<BytesRef> values,
Iterable<Number> docToOrdCount,
Iterable<Number> ords)
Writes pre-sorted set docvalues for a field
|
static boolean |
isSingleValued(Iterable<Number> docToValueCount)
Helper: returns true if the given docToValue count contains only at most one value
|
void |
merge(MergeState mergeState)
Merges in the fields from the readers in
mergeState . |
void |
mergeBinaryField(FieldInfo fieldInfo,
MergeState mergeState,
List<BinaryDocValues> toMerge,
List<Bits> docsWithField)
Merges the binary docvalues from
toMerge . |
void |
mergeNumericField(FieldInfo fieldInfo,
MergeState mergeState,
List<NumericDocValues> toMerge,
List<Bits> docsWithField)
Merges the numeric docvalues from
toMerge . |
void |
mergeSortedField(FieldInfo fieldInfo,
MergeState mergeState,
List<SortedDocValues> toMerge)
Merges the sorted docvalues from
toMerge . |
void |
mergeSortedNumericField(FieldInfo fieldInfo,
MergeState mergeState,
List<SortedNumericDocValues> toMerge)
Merges the sorted docvalues from
toMerge . |
void |
mergeSortedSetField(FieldInfo fieldInfo,
MergeState mergeState,
List<SortedSetDocValues> toMerge)
Merges the sortedset docvalues from
toMerge . |
static Iterable<Number> |
singletonView(Iterable<Number> docToValueCount,
Iterable<Number> values,
Number missingValue)
Helper: returns single-valued view, using
missingValue when count is zero |
protected DocValuesConsumer()
public abstract void addNumericField(FieldInfo field, Iterable<Number> values) throws IOException
field
- field informationvalues
- Iterable of numeric values (one for each document). null
indicates
a missing value.IOException
- if an I/O error occurred.public abstract void addBinaryField(FieldInfo field, Iterable<BytesRef> values) throws IOException
field
- field informationvalues
- Iterable of binary values (one for each document). null
indicates
a missing value.IOException
- if an I/O error occurred.public abstract void addSortedField(FieldInfo field, Iterable<BytesRef> values, Iterable<Number> docToOrd) throws IOException
field
- field informationvalues
- Iterable of binary values in sorted order (deduplicated).docToOrd
- Iterable of ordinals (one for each document). -1
indicates
a missing value.IOException
- if an I/O error occurred.public abstract void addSortedNumericField(FieldInfo field, Iterable<Number> docToValueCount, Iterable<Number> values) throws IOException
field
- field informationdocToValueCount
- Iterable of the number of values for each document. A zero
count indicates a missing value.values
- Iterable of numeric values in sorted order (not deduplicated).IOException
- if an I/O error occurred.public abstract void addSortedSetField(FieldInfo field, Iterable<BytesRef> values, Iterable<Number> docToOrdCount, Iterable<Number> ords) throws IOException
field
- field informationvalues
- Iterable of binary values in sorted order (deduplicated).docToOrdCount
- Iterable of the number of values for each document. A zero ordinal
count indicates a missing value.ords
- Iterable of ordinal occurrences (docToOrdCount*maxDoc total).IOException
- if an I/O error occurred.public void merge(MergeState mergeState) throws IOException
mergeState
. The default implementation
calls mergeNumericField(org.apache.lucene.index.FieldInfo, org.apache.lucene.index.MergeState, java.util.List<org.apache.lucene.index.NumericDocValues>, java.util.List<org.apache.lucene.util.Bits>)
, mergeBinaryField(org.apache.lucene.index.FieldInfo, org.apache.lucene.index.MergeState, java.util.List<org.apache.lucene.index.BinaryDocValues>, java.util.List<org.apache.lucene.util.Bits>)
,
mergeSortedField(org.apache.lucene.index.FieldInfo, org.apache.lucene.index.MergeState, java.util.List<org.apache.lucene.index.SortedDocValues>)
, mergeSortedSetField(org.apache.lucene.index.FieldInfo, org.apache.lucene.index.MergeState, java.util.List<org.apache.lucene.index.SortedSetDocValues>)
,
or mergeSortedNumericField(org.apache.lucene.index.FieldInfo, org.apache.lucene.index.MergeState, java.util.List<org.apache.lucene.index.SortedNumericDocValues>)
for each field,
depending on its type.
Implementations can override this method
for more sophisticated merging (bulk-byte copying, etc).IOException
public void mergeNumericField(FieldInfo fieldInfo, MergeState mergeState, List<NumericDocValues> toMerge, List<Bits> docsWithField) throws IOException
toMerge
.
The default implementation calls addNumericField(org.apache.lucene.index.FieldInfo, java.lang.Iterable<java.lang.Number>)
, passing
an Iterable that merges and filters deleted documents on the fly.
IOException
public void mergeBinaryField(FieldInfo fieldInfo, MergeState mergeState, List<BinaryDocValues> toMerge, List<Bits> docsWithField) throws IOException
toMerge
.
The default implementation calls addBinaryField(org.apache.lucene.index.FieldInfo, java.lang.Iterable<org.apache.lucene.util.BytesRef>)
, passing
an Iterable that merges and filters deleted documents on the fly.
IOException
public void mergeSortedNumericField(FieldInfo fieldInfo, MergeState mergeState, List<SortedNumericDocValues> toMerge) throws IOException
toMerge
.
The default implementation calls addSortedNumericField(org.apache.lucene.index.FieldInfo, java.lang.Iterable<java.lang.Number>, java.lang.Iterable<java.lang.Number>)
, passing
iterables that filter deleted documents.
IOException
public void mergeSortedField(FieldInfo fieldInfo, MergeState mergeState, List<SortedDocValues> toMerge) throws IOException
toMerge
.
The default implementation calls addSortedField(org.apache.lucene.index.FieldInfo, java.lang.Iterable<org.apache.lucene.util.BytesRef>, java.lang.Iterable<java.lang.Number>)
, passing
an Iterable that merges ordinals and values and filters deleted documents .
IOException
public void mergeSortedSetField(FieldInfo fieldInfo, MergeState mergeState, List<SortedSetDocValues> toMerge) throws IOException
toMerge
.
The default implementation calls addSortedSetField(org.apache.lucene.index.FieldInfo, java.lang.Iterable<org.apache.lucene.util.BytesRef>, java.lang.Iterable<java.lang.Number>, java.lang.Iterable<java.lang.Number>)
, passing
an Iterable that merges ordinals and values and filters deleted documents .
IOException
public static boolean isSingleValued(Iterable<Number> docToValueCount)
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.