Package org.apache.lucene.codecs
Class PostingsConsumer
- java.lang.Object
 - 
- org.apache.lucene.codecs.PostingsConsumer
 
 
- 
- Direct Known Subclasses:
 PostingsWriterBase
public abstract class PostingsConsumer extends java.lang.ObjectAbstract API that consumes postings for an individual term.The lifecycle is:
- PostingsConsumer is returned for each term by
        
TermsConsumer.startTerm(BytesRef). startDoc(int, int)is called for each document where the term occurs, specifying id and term frequency for that document.- If positions are enabled for the field, then
        
addPosition(int, BytesRef, int, int)will be called for each occurrence in the document. finishDoc()is called when the producer is done adding positions to the document.
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddPosition(int position, BytesRef payload, int startOffset, int endOffset)Add a new position & payload, and start/end offset.abstract voidfinishDoc()Called when we are done adding positions & payloads for each doc.TermStatsmerge(MergeState mergeState, FieldInfo.IndexOptions indexOptions, DocsEnum postings, FixedBitSet visitedDocs)Default merge impl: append documents, mapping around deletesabstract voidstartDoc(int docID, int freq)Adds a new doc in this term. 
 - 
 
- 
- 
Method Detail
- 
startDoc
public abstract void startDoc(int docID, int freq) throws java.io.IOExceptionAdds a new doc in this term.freqwill be -1 when term frequencies are omitted for the field.- Throws:
 java.io.IOException
 
- 
addPosition
public abstract void addPosition(int position, BytesRef payload, int startOffset, int endOffset) throws java.io.IOExceptionAdd a new position & payload, and start/end offset. A null payload means no payload; a non-null payload with zero length also means no payload. Caller may reuse theBytesReffor the payload between calls (method must fully consume the payload).startOffsetandendOffsetwill be -1 when offsets are not indexed.- Throws:
 java.io.IOException
 
- 
finishDoc
public abstract void finishDoc() throws java.io.IOExceptionCalled when we are done adding positions & payloads for each doc.- Throws:
 java.io.IOException
 
- 
merge
public TermStats merge(MergeState mergeState, FieldInfo.IndexOptions indexOptions, DocsEnum postings, FixedBitSet visitedDocs) throws java.io.IOException
Default merge impl: append documents, mapping around deletes- Throws:
 java.io.IOException
 
 - 
 
 -