Class BasicStats
java.lang.Object
org.apache.lucene.search.similarities.Similarity.SimWeight
org.apache.lucene.search.similarities.BasicStats
- Direct Known Subclasses:
LMSimilarity.LMStats
Stores all statistics commonly used ranking methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected float
The average field length.protected long
The document frequency.protected long
The number of documents.protected long
The total number of tokens in the field.protected final float
Query's inner boost.protected float
Any outer query's boost.protected float
For most Similarities, the immediate and the top level query boosts are not handled differently.protected long
The total number of occurrences of this term across all documents. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
Returns the average field length.long
Returns the document frequency.long
Returns the number of documents.long
Returns the total number of tokens in the field.float
Returns the total boost.long
Returns the total number of occurrences of this term across all documents.float
The square of the raw normalization value.void
normalize
(float queryNorm, float topLevelBoost) No normalization is done.protected float
Computes the raw normalization value.void
setAvgFieldLength
(float avgFieldLength) Sets the average field length.void
setDocFreq
(long docFreq) Sets the document frequency.void
setNumberOfDocuments
(long numberOfDocuments) Sets the number of documents.void
setNumberOfFieldTokens
(long numberOfFieldTokens) Sets the total number of tokens in the field.void
setTotalTermFreq
(long totalTermFreq) Sets the total number of occurrences of this term across all documents.
-
Field Details
-
numberOfDocuments
protected long numberOfDocumentsThe number of documents. -
numberOfFieldTokens
protected long numberOfFieldTokensThe total number of tokens in the field. -
avgFieldLength
protected float avgFieldLengthThe average field length. -
docFreq
protected long docFreqThe document frequency. -
totalTermFreq
protected long totalTermFreqThe total number of occurrences of this term across all documents. -
queryBoost
protected final float queryBoostQuery's inner boost. -
topLevelBoost
protected float topLevelBoostAny outer query's boost. -
totalBoost
protected float totalBoostFor most Similarities, the immediate and the top level query boosts are not handled differently. Hence, this field is just the product of the other two.
-
-
Constructor Details
-
BasicStats
Constructor. Sets the query boost.
-
-
Method Details
-
getNumberOfDocuments
public long getNumberOfDocuments()Returns the number of documents. -
setNumberOfDocuments
public void setNumberOfDocuments(long numberOfDocuments) Sets the number of documents. -
getNumberOfFieldTokens
public long getNumberOfFieldTokens()Returns the total number of tokens in the field.- See Also:
-
setNumberOfFieldTokens
public void setNumberOfFieldTokens(long numberOfFieldTokens) Sets the total number of tokens in the field.- See Also:
-
getAvgFieldLength
public float getAvgFieldLength()Returns the average field length. -
setAvgFieldLength
public void setAvgFieldLength(float avgFieldLength) Sets the average field length. -
getDocFreq
public long getDocFreq()Returns the document frequency. -
setDocFreq
public void setDocFreq(long docFreq) Sets the document frequency. -
getTotalTermFreq
public long getTotalTermFreq()Returns the total number of occurrences of this term across all documents. -
setTotalTermFreq
public void setTotalTermFreq(long totalTermFreq) Sets the total number of occurrences of this term across all documents. -
getValueForNormalization
public float getValueForNormalization()The square of the raw normalization value.- Specified by:
getValueForNormalization
in classSimilarity.SimWeight
- See Also:
-
rawNormalizationValue
protected float rawNormalizationValue()Computes the raw normalization value. This basic implementation returns the query boost. Subclasses may override this method to include other factors (such as idf), or to save the value for inclusion innormalize(float, float)
, etc. -
normalize
public void normalize(float queryNorm, float topLevelBoost) No normalization is done.topLevelBoost
is saved in the object, however.- Specified by:
normalize
in classSimilarity.SimWeight
-
getTotalBoost
public float getTotalBoost()Returns the total boost.
-