Class LTRRescorer

java.lang.Object
org.apache.lucene.search.Rescorer
org.apache.solr.ltr.LTRRescorer
Direct Known Subclasses:
LTRInterleavingRescorer

public class LTRRescorer extends org.apache.lucene.search.Rescorer
Implements the rescoring logic. The top documents returned by solr with their original scores, will be processed by a LTRScoringQuery that will assign a new score to each document. The top documents will be resorted based on the new score.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final Comparator<org.apache.lucene.search.ScoreDoc>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.lucene.search.Explanation
    explain(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.Explanation firstPassExplanation, int docID)
     
    protected static org.apache.lucene.search.Explanation
    getExplanation(org.apache.lucene.search.IndexSearcher searcher, int docID, LTRScoringQuery rerankingQuery)
     
    protected static org.apache.lucene.search.ScoreDoc[]
    getFirstPassDocsRanked(org.apache.lucene.search.TopDocs firstPassTopDocs)
     
    protected static void
    heapAdjust(org.apache.lucene.search.ScoreDoc[] hits, int size, int root)
     
    protected static void
    heapify(org.apache.lucene.search.ScoreDoc[] hits, int size)
     
    org.apache.lucene.search.TopDocs
    rescore(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.TopDocs firstPassTopDocs, int docsToRerank)
    rescores the documents:
    void
    scoreFeatures(int docsToRerank, LTRScoringQuery.ModelWeight modelWeight, org.apache.lucene.search.ScoreDoc[] hits, List<org.apache.lucene.index.LeafReaderContext> leaves, org.apache.lucene.search.ScoreDoc[] reranked)
     
    protected void
    scoreSingleHit(int docsToRerank, int docBase, int hitPosition, org.apache.lucene.search.ScoreDoc hit, LTRScoringQuery.ModelWeight.ModelScorer scorer, org.apache.lucene.search.ScoreDoc[] reranked)
    Scores a single document.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • scoreComparator

      protected static final Comparator<org.apache.lucene.search.ScoreDoc> scoreComparator
  • Constructor Details

    • LTRRescorer

      public LTRRescorer()
    • LTRRescorer

      public LTRRescorer(LTRScoringQuery scoringQuery)
  • Method Details

    • heapAdjust

      protected static void heapAdjust(org.apache.lucene.search.ScoreDoc[] hits, int size, int root)
    • heapify

      protected static void heapify(org.apache.lucene.search.ScoreDoc[] hits, int size)
    • rescore

      public org.apache.lucene.search.TopDocs rescore(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.TopDocs firstPassTopDocs, int docsToRerank) throws IOException
      rescores the documents:
      Specified by:
      rescore in class org.apache.lucene.search.Rescorer
      Parameters:
      searcher - current IndexSearcher
      firstPassTopDocs - documents to rerank;
      docsToRerank - documents to return;
      Throws:
      IOException
    • getFirstPassDocsRanked

      protected static org.apache.lucene.search.ScoreDoc[] getFirstPassDocsRanked(org.apache.lucene.search.TopDocs firstPassTopDocs)
    • scoreFeatures

      public void scoreFeatures(int docsToRerank, LTRScoringQuery.ModelWeight modelWeight, org.apache.lucene.search.ScoreDoc[] hits, List<org.apache.lucene.index.LeafReaderContext> leaves, org.apache.lucene.search.ScoreDoc[] reranked) throws IOException
      Throws:
      IOException
    • scoreSingleHit

      protected void scoreSingleHit(int docsToRerank, int docBase, int hitPosition, org.apache.lucene.search.ScoreDoc hit, LTRScoringQuery.ModelWeight.ModelScorer scorer, org.apache.lucene.search.ScoreDoc[] reranked) throws IOException
      Scores a single document.
      Throws:
      IOException
    • explain

      public org.apache.lucene.search.Explanation explain(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.Explanation firstPassExplanation, int docID) throws IOException
      Specified by:
      explain in class org.apache.lucene.search.Rescorer
      Throws:
      IOException
    • getExplanation

      protected static org.apache.lucene.search.Explanation getExplanation(org.apache.lucene.search.IndexSearcher searcher, int docID, LTRScoringQuery rerankingQuery) throws IOException
      Throws:
      IOException