public class ContextSimilarity
extends org.apache.lucene.search.similarities.ClassicSimilarity
| Constructor and Description |
|---|
ContextSimilarity() |
| Modifier and Type | Method and Description |
|---|---|
float |
coord(int overlap,
int maxOverlap)
Computes a score factor based on the fraction of all query terms that a
document contains.
|
float |
lengthNorm(org.apache.lucene.index.FieldInvertState state)
Compute an index-time normalization value for this field instance.
|
float |
queryNorm(float sumOfSquaredWeights)
Computes the normalization value for a query given the sum of the squared
weights of each of the query terms.
|
decodeNormValue, encodeNormValue, getDiscountOverlaps, idf, scorePayload, setDiscountOverlaps, sloppyFreq, tf, toStringpublic float lengthNorm(org.apache.lucene.index.FieldInvertState state)
This value will be stored in a single byte lossy representation by
ClassicSimilarity.encodeNormValue(float).
lengthNorm in class org.apache.lucene.search.similarities.ClassicSimilaritystate - statistics of the current field (such as length, boost, etc)public float queryNorm(float sumOfSquaredWeights)
This does not affect ranking, but the default implementation does make scores from different queries more comparable than they would be by eliminating the magnitude of the Query vector as a factor in the score.
queryNorm in class org.apache.lucene.search.similarities.ClassicSimilaritysumOfSquaredWeights - the sum of the squares of query term weightspublic float coord(int overlap,
int maxOverlap)
The presence of a large portion of the query terms indicates a better match with the query, so implementations of this method usually return larger values when the ratio between these parameters is large and smaller values when the ratio between them is small.
coord in class org.apache.lucene.search.similarities.ClassicSimilarityoverlap - the number of query terms matched in the documentmaxOverlap - the total number of terms in the queryCopyright © 2020. All rights reserved.