Module org.elasticsearch.server
Interface SortedFieldObserver
- All Known Implementing Classes:
PrefixedPartitionsWriter
public interface SortedFieldObserver
Observes the sorted field write process to produce additional metadata.
The lifecycle follows the sorted field write phases:
onTerm(org.apache.lucene.util.BytesRef, long): called once per term during the terms dictionary write passprepareForDocs(): called after all terms have been written, before the document pass begins. Implementations use this to compact term-phase data and prepare for document tracking.onDoc(int, long): called once per document during the numeric ordinals write passflush(org.apache.lucene.store.IndexOutput, org.apache.lucene.store.IndexOutput): called after both passes are complete. Implementations write their accumulated metadata to the data and meta outputs.
Implementations are mutable and single-use. A new instance must be created
for each field via SortedFieldObserverFactory.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SortedFieldObserverNo-op observer that ignores all events. -
Method Summary
Modifier and TypeMethodDescriptionvoidflush(org.apache.lucene.store.IndexOutput data, org.apache.lucene.store.IndexOutput meta) Writes accumulated metadata to the segment outputs.voidonDoc(int docId, long ord) Called once per document during the numeric ordinals write.voidonTerm(org.apache.lucene.util.BytesRef term, long ord) Called once per term during the terms dictionary write.voidCalled after all terms have been written and before the document pass begins.
-
Field Details
-
NOOP
No-op observer that ignores all events.
-
-
Method Details
-
onTerm
void onTerm(org.apache.lucene.util.BytesRef term, long ord) Called once per term during the terms dictionary write.- Parameters:
term- the term bytesord- the term ordinal
-
prepareForDocs
void prepareForDocs()Called after all terms have been written and before the document pass begins. -
onDoc
void onDoc(int docId, long ord) Called once per document during the numeric ordinals write.- Parameters:
docId- the document IDord- the ordinal value for this document
-
flush
void flush(org.apache.lucene.store.IndexOutput data, org.apache.lucene.store.IndexOutput meta) throws IOException Writes accumulated metadata to the segment outputs.- Parameters:
data- the data output streammeta- the metadata output stream- Throws:
IOException
-