public abstract class DocValuesConsumer extends Object
IndexableFields.
DocValuesConsumer are always associated with a specific field and
segments. Concrete implementations of this API write the given
IndexableField into a implementation specific format depending on
the fields meta-data.| Modifier and Type | Field and Description |
|---|---|
protected BytesRef |
spare
Spare
BytesRef that subclasses can reuse. |
| Modifier | Constructor and Description |
|---|---|
protected |
DocValuesConsumer()
Sole constructor.
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
add(int docID,
IndexableField value)
Adds the given
IndexableField instance to this
DocValuesConsumer |
abstract void |
finish(int docCount)
Called when the consumer of this API is done adding values.
|
protected abstract DocValues.Type |
getType()
Returns the
DocValues.Type of this consumer. |
abstract int |
getValueSize()
Returns the value size this consumer accepts or -1 iff this
consumer is value size agnostic ie.
|
protected void |
merge(DocValues reader,
int docBase,
int docCount,
Bits liveDocs)
Merges the given
DocValues into this DocValuesConsumer. |
void |
merge(MergeState mergeState,
DocValues[] docValues)
Merges the given
MergeState into
this DocValuesConsumer. |
protected void |
mergeDoc(Field scratchField,
DocValues.Source source,
int docID,
int sourceDoc)
Merges a document with the given
docID. |
protected DocValuesConsumer()
protected abstract DocValues.Type getType()
DocValues.Type of this consumer.public abstract void add(int docID,
IndexableField value)
throws IOException
IndexableField instance to this
DocValuesConsumerdocID - the document ID to add the value for. The docID must always
increase or be 0 if it is the first call to this method.value - the value to addIOException - if an IOException occurspublic abstract void finish(int docCount)
throws IOException
docCount - the total number of documents in this DocValuesConsumer.
Must be greater than or equal the last given docID to
add(int, IndexableField).IOException - If an I/O error occurspublic abstract int getValueSize()
NOTE: the return value is undefined until the consumer has successfully consumed at least one value.
public void merge(MergeState mergeState, DocValues[] docValues) throws IOException
MergeState into
this DocValuesConsumer.mergeState - the state to mergedocValues - docValues array containing one instance per reader (
MergeState.readers) or null if the reader has
no DocValues instance.IOException - if an IOException occursprotected void merge(DocValues reader, int docBase, int docCount, Bits liveDocs) throws IOException
DocValues into this DocValuesConsumer.IOException - if an IOException occursprotected void mergeDoc(Field scratchField, DocValues.Source source, int docID, int sourceDoc) throws IOException
docID. The methods
implementation obtains the value for the sourceDoc id from the
current DocValues.Source.
This method is used during merging to provide implementation agnostic default merge implementation.
All documents IDs between the given ID and the previously given ID or 0 if the method is call the first time are filled with default values depending on the implementation. The given document ID must always be greater than the previous ID or 0 if called the first time.
IOExceptionCopyright © 2000-2012 Apache Software Foundation. All Rights Reserved.