Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class QueryRescorer

    A Rescorer that uses a provided Query to assign scores to the first-pass hits.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Inheritance
    object
    Rescorer
    QueryRescorer
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class QueryRescorer : Rescorer

    Constructors

    QueryRescorer(Query)

    Sole constructor, passing the 2nd pass query to assign scores to the 1st pass hits.

    Declaration
    protected QueryRescorer(Query query)
    Parameters
    Type Name Description
    Query query

    Methods

    Combine(float, bool, float)

    Implement this in a subclass to combine the first pass and second pass scores. If secondPassMatches is false then the second pass query failed to match a hit from the first pass query, and you should ignore the secondPassScore.

    Declaration
    protected abstract float Combine(float firstPassScore, bool secondPassMatches, float secondPassScore)
    Parameters
    Type Name Description
    float firstPassScore
    bool secondPassMatches
    float secondPassScore
    Returns
    Type Description
    float

    Explain(IndexSearcher, Explanation, int)

    Explains how the score for the specified document was computed.

    Declaration
    public override Explanation Explain(IndexSearcher searcher, Explanation firstPassExplanation, int docID)
    Parameters
    Type Name Description
    IndexSearcher searcher
    Explanation firstPassExplanation
    int docID
    Returns
    Type Description
    Explanation
    Overrides
    Rescorer.Explain(IndexSearcher, Explanation, int)

    Rescore(IndexSearcher, TopDocs, Query, double, int)

    Sugar API, calling Rescore(IndexSearcher, TopDocs, int) using a simple linear combination of firstPassScore + weight * secondPassScore

    Declaration
    public static TopDocs Rescore(IndexSearcher searcher, TopDocs topDocs, Query query, double weight, int topN)
    Parameters
    Type Name Description
    IndexSearcher searcher
    TopDocs topDocs
    Query query
    double weight
    int topN
    Returns
    Type Description
    TopDocs

    Rescore(IndexSearcher, TopDocs, int)

    Rescore an initial first-pass TopDocs.

    Declaration
    public override TopDocs Rescore(IndexSearcher searcher, TopDocs firstPassTopDocs, int topN)
    Parameters
    Type Name Description
    IndexSearcher searcher

    IndexSearcher used to produce the first pass topDocs

    TopDocs firstPassTopDocs

    Hits from the first pass search. It's very important that these hits were produced by the provided searcher; otherwise the doc IDs will not match!

    int topN

    How many re-scored hits to return

    Returns
    Type Description
    TopDocs
    Overrides
    Rescorer.Rescore(IndexSearcher, TopDocs, int)
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.