Package org.elasticsearch.search.rescore
Interface Rescorer
-
- All Known Implementing Classes:
QueryRescorer
public interface RescorerA query rescorer interface used to re-rank the Top-K results of a previously executed search. Subclasses should borrow heavily fromQueryRescorerbecause it is fairly well behaved and documents that tradeoffs that it is making. There is also anExampleRescorerthat is worth looking at.
-
-
Method Summary
Modifier and Type Method Description org.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.voidextractTerms(org.apache.lucene.search.IndexSearcher searcher, RescoreContext rescoreContext, java.util.Set<org.apache.lucene.index.Term> termsSet)Extracts all terms needed to execute thisRescorer.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.
-
-
-
Method Detail
-
rescore
org.apache.lucene.search.TopDocs rescore(org.apache.lucene.search.TopDocs topDocs, org.apache.lucene.search.IndexSearcher searcher, RescoreContext rescoreContext) throws java.io.IOExceptionModifies 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:
java.io.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 java.io.IOExceptionExecutes 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:
java.io.IOException- if anIOExceptionoccurs
-
extractTerms
void extractTerms(org.apache.lucene.search.IndexSearcher searcher, RescoreContext rescoreContext, java.util.Set<org.apache.lucene.index.Term> termsSet) throws java.io.IOExceptionExtracts all terms needed to execute thisRescorer. This method is executed in a distributed frequency collection roundtrip forSearchType.DFS_QUERY_THEN_FETCH- Throws:
java.io.IOException
-
-