LeafFieldComparator

Expert: comparator that gets instantiated on each leaf from a top-level FieldComparator instance.

A leaf comparator must define these functions:

  • .setBottom This method is called by FieldValueHitQueue to notify the FieldComparator of the current weakest ("bottom") slot. Note that this slot may not hold the weakest value according to your comparator, in cases where your comparator is not the primary one (ie, is only used to break ties from the comparators before it).

  • .compareBottom Compare a new hit (docID) against the "weakest" (bottom) entry in the queue.

  • .compareTop Compare a new hit (docID) against the top value previously set by a call to FieldComparator.setTopValue.

  • .copy Installs a new hit into the priority queue. The FieldValueHitQueue calls this method when a new hit is competitive.

See also

Inheritors

Functions

Link copied to clipboard
abstract fun compareBottom(doc: Int): Int

Compare the bottom of the queue with this doc. This will only invoked after setBottom has been called. This should return the same result as FieldComparator.compare} as if bottom were slot1 and the new document were slot 2.

Link copied to clipboard
abstract fun compareTop(doc: Int): Int

Compare the top value with this doc. This will only invoked after setTopValue has been called. This should return the same result as FieldComparator.compare} as if topValue were slot1 and the new document were slot 2. This is only called for searches that use searchAfter (deep paging).

Link copied to clipboard

Returns a competitive iterator

Link copied to clipboard
abstract fun copy(slot: Int, doc: Int)

This method is called when a new hit is competitive. You should copy any state associated with this document that will be required for future comparisons, into the specified slot.

Link copied to clipboard
abstract fun setBottom(slot: Int)

Set the bottom slot, ie the "weakest" (sorted last) entry in the queue. When .compareBottom is called, you should compare against this slot. This will always be called before .compareBottom.

Link copied to clipboard

Informs this leaf comparator that hits threshold is reached. This method is called from a collector when hits threshold is reached.

Link copied to clipboard
abstract fun setScorer(scorer: Scorable)

Sets the Scorer to use in case a document's score is needed.