org.eml.sir.retr
Class AdjustableSimilarity

java.lang.Object
  extended byorg.apache.lucene.search.Similarity
      extended byorg.eml.sir.retr.AdjustableSimilarity

public class AdjustableSimilarity
extends org.apache.lucene.search.Similarity

Adjustable scoring implementation.


Field Summary
static char IDF_F
          Constant for idf factor of AdjustableSimilarity.
static char IDF_P
          Constant for idf factor of AdjustableSimilarity.
static char TF_1
          Constant for tf factor of AdjustableSimilarity.
static char TF_FREQ
          Constant for tf factor of AdjustableSimilarity.
static char TF_SQRT
          Constant for tf factor of AdjustableSimilarity.
 
Constructor Summary
AdjustableSimilarity()
           
AdjustableSimilarity(char tfAlg, char idfAlg)
          Create a new AdjustableSimilarity instance.
 
Method Summary
 float coord(int overlap, int maxOverlap)
          Implemented as overlap / maxOverlap.
 char getIdfAlg()
          Return the idf algorithm (factor) of this AdjustableSimilarity.
 char getTfAlg()
          Return the tf algorithm (factor) of this AdjustableSimilarity.
 float idf(int docFreq, int numDocs)
          Depends on the idf algorithm (factor) setting.
 float lengthNorm(java.lang.String fieldName, int numTerms)
          Implemented as 1/sqrt(numTerms).
 float queryNorm(float sumOfSquaredWeights)
          Implemented as 1/sqrt(sumOfSquaredWeights).
 void setIdfAlg(char idfAlg)
          Set the idf algorithm (factor) of this AdjustableSimilarity.
 void setTfAlg(char tfAlg)
          Set the tf algorithm (factor) of this AdjustableSimilarity.
 float sloppyFreq(int distance)
          Implemented as 1 / (distance + 1).
 float tf(float freq)
          Depends on the tf algorithm (factor) setting.
 
Methods inherited from class org.apache.lucene.search.Similarity
decodeNorm, encodeNorm, getDefault, idf, idf, setDefault, tf
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TF_1

public static final char TF_1
Constant for tf factor of AdjustableSimilarity. (tf = 1)

See Also:
Constant Field Values

TF_FREQ

public static final char TF_FREQ
Constant for tf factor of AdjustableSimilarity. (tf = frequency)

See Also:
Constant Field Values

TF_SQRT

public static final char TF_SQRT
Constant for tf factor of AdjustableSimilarity. (tf = sqrt(frequency))

See Also:
Constant Field Values

IDF_F

public static final char IDF_F
Constant for idf factor of AdjustableSimilarity. (idf = log(N/(n+1))+1)

See Also:
Constant Field Values

IDF_P

public static final char IDF_P
Constant for idf factor of AdjustableSimilarity. (idf = log((N-n)/(n+1)+1)+1)

See Also:
Constant Field Values
Constructor Detail

AdjustableSimilarity

public AdjustableSimilarity()

AdjustableSimilarity

public AdjustableSimilarity(char tfAlg,
                            char idfAlg)
Create a new AdjustableSimilarity instance.

Method Detail

getIdfAlg

public char getIdfAlg()
Return the idf algorithm (factor) of this AdjustableSimilarity.


setIdfAlg

public void setIdfAlg(char idfAlg)
Set the idf algorithm (factor) of this AdjustableSimilarity.


getTfAlg

public char getTfAlg()
Return the tf algorithm (factor) of this AdjustableSimilarity.


setTfAlg

public void setTfAlg(char tfAlg)
Set the tf algorithm (factor) of this AdjustableSimilarity.


lengthNorm

public float lengthNorm(java.lang.String fieldName,
                        int numTerms)
Implemented as 1/sqrt(numTerms).


queryNorm

public float queryNorm(float sumOfSquaredWeights)
Implemented as 1/sqrt(sumOfSquaredWeights).


tf

public float tf(float freq)
Depends on the tf algorithm (factor) setting.


sloppyFreq

public float sloppyFreq(int distance)
Implemented as 1 / (distance + 1).


idf

public float idf(int docFreq,
                 int numDocs)
Depends on the idf algorithm (factor) setting.


coord

public float coord(int overlap,
                   int maxOverlap)
Implemented as overlap / maxOverlap.