

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object org.apache.lucene.search.Similarity org.apache.lucene.search.DefaultSimilarity
public class DefaultSimilarity
Expert: Default scoring implementation.
Field Summary  

protected boolean 
discountOverlaps

Fields inherited from class org.apache.lucene.search.Similarity 

NO_DOC_ID_PROVIDED 
Constructor Summary  

DefaultSimilarity()

Method Summary  

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) . 
Methods inherited from class org.apache.lucene.search.Similarity 

decodeNorm, decodeNormValue, encodeNorm, encodeNormValue, getDefault, getNormDecoder, idfExplain, idfExplain, idfExplain, lengthNorm, scorePayload, setDefault, tf 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 

protected boolean discountOverlaps
Constructor Detail 

public DefaultSimilarity()
Method Detail 

public 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 Similarity
field
 field namestate
 current processing state for this field
public float queryNorm(float sumOfSquaredWeights)
1/sqrt(sumOfSquaredWeights)
.
queryNorm
in class Similarity
sumOfSquaredWeights
 the sum of the squares of query term weights
public float tf(float freq)
sqrt(freq)
.
tf
in class Similarity
freq
 the frequency of a term within a document
public float sloppyFreq(int distance)
1 / (distance + 1)
.
sloppyFreq
in class Similarity
distance
 the edit distance of this sloppy phrase match
PhraseQuery.setSlop(int)
public float idf(int docFreq, int numDocs)
log(numDocs/(docFreq+1)) + 1
.
idf
in class Similarity
docFreq
 the number of documents which contain the termnumDocs
 the total number of documents in the collection
public float coord(int overlap, int maxOverlap)
overlap / maxOverlap
.
coord
in class Similarity
overlap
 the number of query terms matched in the documentmaxOverlap
 the total number of terms in the query
public void setDiscountOverlaps(boolean v)
computeNorm(java.lang.String, org.apache.lucene.index.FieldInvertState)
public boolean getDiscountOverlaps()
setDiscountOverlaps(boolean)


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 