Interface Rescorer

  • All Known Implementing Classes:
    QueryRescorer

    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.
    • Method Summary

      Modifier and Type Method Description
      org.apache.lucene.search.Explanation explain​(int topLevelDocId, org.apache.lucene.search.IndexSearcher searcher, RescoreContext rescoreContext, org.apache.lucene.search.Explanation sourceExplanation)
      Executes an Explanation phase on the rescorer.
      void extractTerms​(org.apache.lucene.search.IndexSearcher searcher, RescoreContext rescoreContext, java.util.Set<org.apache.lucene.index.Term> termsSet)
      Extracts all terms needed to execute this Rescorer.
      org.apache.lucene.search.TopDocs rescore​(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 given RescoreContext.
    • 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.IOException
        Modifies the result of the previously executed search (TopDocs) in place based on the given RescoreContext.
        Parameters:
        topDocs - the result of the previously executed search
        searcher - the searcher used for this search. This will never be null.
        rescoreContext - the RescoreContext. This will never be null
        Throws:
        java.io.IOException - if an IOException occurs 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.IOException
        Executes an Explanation phase on the rescorer.
        Parameters:
        topLevelDocId - the global / top-level document ID to explain
        searcher - the searcher used for this search. This will never be null.
        rescoreContext - context for this rescorer
        sourceExplanation - 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 an IOException occurs
      • extractTerms

        void extractTerms​(org.apache.lucene.search.IndexSearcher searcher,
                          RescoreContext rescoreContext,
                          java.util.Set<org.apache.lucene.index.Term> termsSet)
                   throws java.io.IOException
        Extracts all terms needed to execute this Rescorer. This method is executed in a distributed frequency collection roundtrip for SearchType.DFS_QUERY_THEN_FETCH
        Throws:
        java.io.IOException