public interface LeafFieldComparator
FieldComparator
instance.
A leaf comparator must define these functions:
setBottom(int)
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(int)
Compare a new hit (docID)
against the "weakest" (bottom) entry in the queue.
compareTop(int)
Compare a new hit (docID)
against the top value previously set by a call to
FieldComparator.setTopValue(T)
.
copy(int, int)
Installs a new hit into the
priority queue. The FieldValueHitQueue
calls this method when a new hit is competitive.
FieldComparator
Modifier and Type | Method and Description |
---|---|
int |
compareBottom(int doc)
Compare the bottom of the queue with this doc.
|
int |
compareTop(int doc)
Compare the top value with this doc.
|
void |
copy(int slot,
int doc)
This method is called when a new hit is competitive.
|
void |
setBottom(int slot)
Set the bottom slot, ie the "weakest" (sorted last)
entry in the queue.
|
void |
setScorer(Scorer scorer)
Sets the Scorer to use in case a document's score is
needed.
|
void setBottom(int slot)
compareBottom(int)
is
called, you should compare against this slot. This
will always be called before compareBottom(int)
.slot
- the currently weakest (sorted last) slot in the queueint compareBottom(int doc) throws IOException
FieldComparator.compare(int,int)
} as if bottom were slot1 and the new
document were slot 2.
For a search that hits many results, this method will be the hotspot (invoked by far the most frequently).
doc
- that was hitN < 0
if the doc's value is sorted after
the bottom entry (not competitive), any N > 0
if the
doc's value is sorted before the bottom entry and 0
if
they are equal.IOException
int compareTop(int doc) throws IOException
FieldComparator.compare(int,int)
} as if topValue were slot1 and the new
document were slot 2. This is only called for searches that
use searchAfter (deep paging).doc
- that was hitN < 0
if the doc's value is sorted after
the top entry (not competitive), any N > 0
if the
doc's value is sorted before the top entry and 0
if
they are equal.IOException
void copy(int slot, int doc) throws IOException
slot
- which slot to copy the hit todoc
- docID relative to current readerIOException
void setScorer(Scorer scorer) throws IOException
scorer
- Scorer instance that you should use to
obtain the current hit's score, if necessary.IOException
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.