public class RandomSimilarityProvider extends PerFieldSimilarityWrapper
The choices are 'sticky', so the selected algorithm is always used for the same field.
Similarity.SimScorer, Similarity.SimWeight
Constructor and Description |
---|
RandomSimilarityProvider(Random random) |
Modifier and Type | Method and Description |
---|---|
float |
coord(int overlap,
int maxOverlap)
Hook to integrate coordinate-level matching.
|
Similarity |
get(String field)
Returns a
Similarity for scoring a field. |
float |
queryNorm(float sumOfSquaredWeights)
Computes the normalization value for a query given the sum of the
normalized weights
Similarity.SimWeight.getValueForNormalization() of
each of the query terms. |
String |
toString() |
computeNorm, computeWeight, simScorer
public RandomSimilarityProvider(Random random)
public float coord(int overlap, int maxOverlap)
Similarity
By default this is disabled (returns 1
), as with
most modern models this will only skew performance, but some
implementations such as TFIDFSimilarity
override this.
coord
in class Similarity
overlap
- the number of query terms matched in the documentmaxOverlap
- the total number of terms in the querypublic float queryNorm(float sumOfSquaredWeights)
Similarity
Similarity.SimWeight.getValueForNormalization()
of
each of the query terms. This value is passed back to the
weight (Similarity.SimWeight.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 TFIDFSimilarity
override this.
queryNorm
in class Similarity
sumOfSquaredWeights
- the sum of the term normalization valuespublic Similarity get(String field)
PerFieldSimilarityWrapper
Similarity
for scoring a field.get
in class PerFieldSimilarityWrapper
Copyright © 2000–2015 The Apache Software Foundation. All rights reserved.