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.Inherited Members
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 (returns1
), 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
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
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 (returns1
), 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
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. |