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:

  1. onTerm(org.apache.lucene.util.BytesRef, long): called once per term during the terms dictionary write pass
  2. prepareForDocs(): 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.
  3. onDoc(int, long): called once per document during the numeric ordinals write pass
  4. flush(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

    Fields
    Modifier and Type
    Field
    Description
    static final SortedFieldObserver
    No-op observer that ignores all events.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    flush(org.apache.lucene.store.IndexOutput data, org.apache.lucene.store.IndexOutput meta)
    Writes accumulated metadata to the segment outputs.
    void
    onDoc(int docId, long ord)
    Called once per document during the numeric ordinals write.
    void
    onTerm(org.apache.lucene.util.BytesRef term, long ord)
    Called once per term during the terms dictionary write.
    void
    Called after all terms have been written and before the document pass begins.
  • Field Details

  • 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 bytes
      ord - 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 ID
      ord - 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 stream
      meta - the metadata output stream
      Throws:
      IOException