Sorts by descending relevance. NOTE: if you are sorting only by descending relevance and then secondarily by ascending docID, performance is faster using TopScoreDocCollector
directly (which IndexSearcher#search
uses when no Sort
is specified).
More...
#include <FieldComparator.h>
Sorts by descending relevance. NOTE: if you are sorting only by descending relevance and then secondarily by ascending docID, performance is faster using TopScoreDocCollector
directly (which IndexSearcher#search
uses when no Sort
is specified).
◆ RelevanceComparator()
Lucene::RelevanceComparator::RelevanceComparator |
( |
int32_t |
numHits | ) |
|
◆ ~RelevanceComparator()
virtual Lucene::RelevanceComparator::~RelevanceComparator |
( |
| ) |
|
|
virtual |
◆ _getClassName()
static String Lucene::RelevanceComparator::_getClassName |
( |
| ) |
|
|
inlinestatic |
◆ compare()
virtual int32_t Lucene::RelevanceComparator::compare |
( |
int32_t |
slot1, |
|
|
int32_t |
slot2 |
|
) |
| |
|
virtual |
Compare hit at slot1 with hit at slot2.
- Parameters
-
slot1 | first slot to compare |
slot2 | second slot to compare |
- Returns
- any N < 0 if slot2's value is sorted after slot1, any N > 0 if the slot2's value is sorted before slot1 and 0 if they are equal
Reimplemented from Lucene::NumericComparator< double >.
◆ compareBottom()
virtual int32_t Lucene::RelevanceComparator::compareBottom |
( |
int32_t |
doc | ) |
|
|
virtual |
Compare the bottom of the queue with doc. This will only invoked after setBottom has been called. This should return the same result as 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).
- Parameters
-
- Returns
- any N < 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.
Reimplemented from Lucene::NumericComparator< double >.
◆ copy()
virtual void Lucene::RelevanceComparator::copy |
( |
int32_t |
slot, |
|
|
int32_t |
doc |
|
) |
| |
|
virtual |
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.
- Parameters
-
slot | which slot to copy the hit to |
doc | docID relative to current reader |
Reimplemented from Lucene::NumericComparator< double >.
◆ getClassName()
virtual String Lucene::RelevanceComparator::getClassName |
( |
| ) |
|
|
inlinevirtual |
◆ setNextReader()
virtual void Lucene::RelevanceComparator::setNextReader |
( |
const IndexReaderPtr & |
reader, |
|
|
int32_t |
docBase |
|
) |
| |
|
virtual |
◆ setScorer()
virtual void Lucene::RelevanceComparator::setScorer |
( |
const ScorerPtr & |
scorer | ) |
|
|
virtual |
Sets the Scorer to use in case a document's score is needed.
- Parameters
-
scorer | Scorer instance that you should use to obtain the current hit's score, if necessary. |
Reimplemented from Lucene::FieldComparator.
◆ shared_from_this()
◆ scorer
ScorerPtr Lucene::RelevanceComparator::scorer |
|
protected |
The documentation for this class was generated from the following file: