Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class PerFieldSimilarityWrapper

    Provides the ability to use a different Similarity for different fields.

    Subclasses should implement Get(string) to return an appropriate Similarity (for example, using field-specific parameter values) for the field.

    Note

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

    Inheritance
    object
    Similarity
    PerFieldSimilarityWrapper
    Inherited Members
    Similarity.Coord(int, int)
    Similarity.QueryNorm(float)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Search.Similarities
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class PerFieldSimilarityWrapper : Similarity

    Constructors

    PerFieldSimilarityWrapper()

    Sole constructor. (For invocation by subclass constructors, typically implicit.)

    Declaration
    protected PerFieldSimilarityWrapper()

    Methods

    ComputeNorm(FieldInvertState)

    Computes the normalization value for a field, given the accumulated state of term processing for this field (see FieldInvertState).

    Matches in longer fields are less precise, so implementations of this method usually set smaller values when state.Length is large, and larger values when
    state.Length
    is small.

    Note

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

    Declaration
    public override sealed long ComputeNorm(FieldInvertState state)
    Parameters
    Type Name Description
    FieldInvertState state

    current processing state for this field

    Returns
    Type Description
    long

    computed norm value

    Overrides
    Similarity.ComputeNorm(FieldInvertState)

    ComputeWeight(float, CollectionStatistics, params TermStatistics[])

    Compute any collection-level weight (e.g. IDF, average document length, etc) needed for scoring a query.

    Declaration
    public override sealed Similarity.SimWeight ComputeWeight(float queryBoost, CollectionStatistics collectionStats, params TermStatistics[] termStats)
    Parameters
    Type Name Description
    float queryBoost

    the query-time boost.

    CollectionStatistics collectionStats

    collection-level statistics, such as the number of tokens in the collection.

    TermStatistics[] termStats

    term-level statistics, such as the document frequency of a term across the collection.

    Returns
    Type Description
    Similarity.SimWeight

    Similarity.SimWeight object with the information this Similarity needs to score a query.

    Overrides
    Similarity.ComputeWeight(float, CollectionStatistics, params TermStatistics[])

    Get(string)

    Returns a Similarity for scoring a field.

    Declaration
    public abstract Similarity Get(string name)
    Parameters
    Type Name Description
    string name
    Returns
    Type Description
    Similarity

    GetSimScorer(SimWeight, AtomicReaderContext)

    Creates a new Similarity.SimScorer to score matching documents from a segment of the inverted index.

    Declaration
    public override sealed Similarity.SimScorer GetSimScorer(Similarity.SimWeight weight, AtomicReaderContext context)
    Parameters
    Type Name Description
    Similarity.SimWeight weight

    collection information from ComputeWeight(float, CollectionStatistics, params TermStatistics[])

    AtomicReaderContext context

    segment of the inverted index to be scored.

    Returns
    Type Description
    Similarity.SimScorer

    Sloppy Similarity.SimScorer for scoring documents across context

    Overrides
    Similarity.GetSimScorer(Similarity.SimWeight, AtomicReaderContext)
    Exceptions
    Type Condition
    IOException

    if there is a low-level I/O error

    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.