public class DefaultSimilarity extends Similarity
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
discountOverlaps |
NO_DOC_ID_PROVIDED| Constructor and Description |
|---|
DefaultSimilarity() |
| Modifier and Type | Method and Description |
|---|---|
float |
computeNorm(String field,
FieldInvertState state)
Implemented as
state.getBoost()*lengthNorm(numTerms), where
numTerms is FieldInvertState.getLength() if setDiscountOverlaps(boolean) is false, else it's FieldInvertState.getLength() - FieldInvertState.getNumOverlap(). |
float |
coord(int overlap,
int maxOverlap)
Implemented as
overlap / maxOverlap. |
boolean |
getDiscountOverlaps() |
float |
idf(int docFreq,
int numDocs)
Implemented as
log(numDocs/(docFreq+1)) + 1. |
float |
queryNorm(float sumOfSquaredWeights)
Implemented as
1/sqrt(sumOfSquaredWeights). |
void |
setDiscountOverlaps(boolean v)
Determines whether overlap tokens (Tokens with
0 position increment) are ignored when computing
norm.
|
float |
sloppyFreq(int distance)
Implemented as
1 / (distance + 1). |
float |
tf(float freq)
Implemented as
sqrt(freq). |
decodeNorm, decodeNormValue, encodeNorm, encodeNormValue, getDefault, getNormDecoder, idfExplain, idfExplain, idfExplain, lengthNorm, scorePayload, setDefault, tfpublic float computeNorm(String field, FieldInvertState state)
state.getBoost()*lengthNorm(numTerms), where
numTerms is FieldInvertState.getLength() if setDiscountOverlaps(boolean) is false, else it's FieldInvertState.getLength() - FieldInvertState.getNumOverlap().computeNorm in class Similarityfield - field namestate - current processing state for this fieldpublic float queryNorm(float sumOfSquaredWeights)
1/sqrt(sumOfSquaredWeights).queryNorm in class SimilaritysumOfSquaredWeights - the sum of the squares of query term weightspublic float tf(float freq)
sqrt(freq).tf in class Similarityfreq - the frequency of a term within a documentpublic float sloppyFreq(int distance)
1 / (distance + 1).sloppyFreq in class Similaritydistance - the edit distance of this sloppy phrase matchPhraseQuery.setSlop(int)public float idf(int docFreq,
int numDocs)
log(numDocs/(docFreq+1)) + 1.idf in class SimilaritydocFreq - the number of documents which contain the termnumDocs - the total number of documents in the collectionpublic float coord(int overlap,
int maxOverlap)
overlap / maxOverlap.coord in class Similarityoverlap - the number of query terms matched in the documentmaxOverlap - the total number of terms in the querypublic void setDiscountOverlaps(boolean v)
computeNorm(java.lang.String, org.apache.lucene.index.FieldInvertState)public boolean getDiscountOverlaps()
setDiscountOverlaps(boolean)