Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class RandomSimilarityProvider

    Similarity implementation that randomizes Similarity implementations per-field.

    The choices are 'sticky', so the selected algorithm is always used for the same field.
    Inheritance
    object
    Similarity
    PerFieldSimilarityWrapper
    RandomSimilarityProvider
    Inherited Members
    PerFieldSimilarityWrapper.ComputeNorm(FieldInvertState)
    PerFieldSimilarityWrapper.ComputeWeight(float, CollectionStatistics, params TermStatistics[])
    PerFieldSimilarityWrapper.GetSimScorer(Similarity.SimWeight, AtomicReaderContext)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.TestFramework.dll
    Syntax
    public class RandomSimilarityProvider : PerFieldSimilarityWrapper

    Constructors

    RandomSimilarityProvider(Random)

    Similarity implementation that randomizes Similarity implementations per-field.

    The choices are 'sticky', so the selected algorithm is always used for the same field.
    Declaration
    public RandomSimilarityProvider(Random random)
    Parameters
    Type Name Description
    Random random

    Methods

    Coord(int, int)

    Hook to integrate coordinate-level matching.

    By default this is disabled (returns 1), as with most modern models this will only skew performance, but some implementations such as Lucene.Net.Search.Similarities.TFIDFSimilarity override this.
    Declaration
    public override float Coord(int overlap, int maxOverlap)
    Parameters
    Type Name Description
    int overlap

    the number of query terms matched in the document

    int maxOverlap

    the total number of terms in the query

    Returns
    Type Description
    float

    a score factor based on term overlap with the query

    Overrides
    Similarity.Coord(int, int)

    Get(string)

    Returns a Lucene.Net.Search.Similarities.Similarity for scoring a field.

    Declaration
    public override Similarity Get(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    Similarity
    Overrides
    PerFieldSimilarityWrapper.Get(string)

    QueryNorm(float)

    Computes the normalization value for a query given the sum of the normalized weights Lucene.Net.Search.Similarities.Similarity.SimWeight.GetValueForNormalization() of each of the query terms. this value is passed back to the weight (Normalize(float, float) of each query term, to provide a hook to attempt to make scores from different queries comparable.

    By default this is disabled (returns 1), but some implementations such as Lucene.Net.Search.Similarities.TFIDFSimilarity override this.
    Declaration
    public override float QueryNorm(float sumOfSquaredWeights)
    Parameters
    Type Name Description
    float sumOfSquaredWeights
    Returns
    Type Description
    float

    a normalization factor for query weights

    Overrides
    Similarity.QueryNorm(float)

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    object.ToString()
    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.