- All Known Implementing Classes:
QueryRescorer,ScriptRescorer
public interface Rescorer
A query rescorer interface used to re-rank the Top-K results of a previously
executed search.
Subclasses should borrow heavily from
QueryRescorer because it is
fairly well behaved and documents that tradeoffs that it is making. There
is also an ExampleRescorer that is worth looking at.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.lucene.search.Explanationexplain(int topLevelDocId, org.apache.lucene.search.IndexSearcher searcher, RescoreContext rescoreContext, org.apache.lucene.search.Explanation sourceExplanation) Executes anExplanationphase on the rescorer.org.apache.lucene.search.TopDocsrescore(org.apache.lucene.search.TopDocs topDocs, org.apache.lucene.search.IndexSearcher searcher, RescoreContext rescoreContext) Modifies the result of the previously executed search (TopDocs) in place based on the givenRescoreContext.static org.apache.lucene.search.TopDocstopN(org.apache.lucene.search.TopDocs in, int topN) Returns a newTopDocswith the topN from the incoming one, or the same TopDocs if the number of hits is already <= topN.
-
Field Details
-
SCORE_DOC_COMPARATOR
-
-
Method Details
-
rescore
org.apache.lucene.search.TopDocs rescore(org.apache.lucene.search.TopDocs topDocs, org.apache.lucene.search.IndexSearcher searcher, RescoreContext rescoreContext) throws IOException Modifies the result of the previously executed search (TopDocs) in place based on the givenRescoreContext.- Parameters:
topDocs- the result of the previously executed searchsearcher- the searcher used for this search. This will never benull.rescoreContext- theRescoreContext. This will never benull- Throws:
IOException- if anIOExceptionoccurs during rescoring
-
explain
org.apache.lucene.search.Explanation explain(int topLevelDocId, org.apache.lucene.search.IndexSearcher searcher, RescoreContext rescoreContext, org.apache.lucene.search.Explanation sourceExplanation) throws IOException Executes anExplanationphase on the rescorer.- Parameters:
topLevelDocId- the global / top-level document ID to explainsearcher- the searcher used for this search. This will never benull.rescoreContext- context for this rescorersourceExplanation- explanation of the source of the documents being fed into this rescore- Returns:
- the explain for the given top level document ID.
- Throws:
IOException- if anIOExceptionoccurs
-
topN
static org.apache.lucene.search.TopDocs topN(org.apache.lucene.search.TopDocs in, int topN) Returns a newTopDocswith the topN from the incoming one, or the same TopDocs if the number of hits is already <= topN.
-