Documentation of 'org.apache.lucene.search.DefaultSimilarity' Java class
DefaultSimilarity
org.apache.lucene.search

Class DefaultSimilarity

  • All Implemented Interfaces:
    java.io.Serializable


    public class DefaultSimilarity
    extends Similarity
    Expert: Default scoring implementation.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      float coord(int overlap, int maxOverlap)
      Implemented as overlap / maxOverlap.
      float idf(int docFreq, int numDocs)
      Implemented as log(numDocs/(docFreq+1)) + 1.
      float lengthNorm(java.lang.String fieldName, int numTerms)
      Implemented as 1/sqrt(numTerms).
      float queryNorm(float sumOfSquaredWeights)
      Implemented as 1/sqrt(sumOfSquaredWeights).
      float sloppyFreq(int distance)
      Implemented as 1 / (distance + 1).
      float tf(float freq)
      Implemented as sqrt(freq).
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultSimilarity

        public DefaultSimilarity()
    • Method Detail

      • lengthNorm

        public float lengthNorm(java.lang.String fieldName,
                                int numTerms)
        Implemented as 1/sqrt(numTerms).
        Specified by:
        lengthNorm in class Similarity
        Parameters:
        fieldName - the name of the field
        numTerms - the total number of tokens contained in fields named fieldName of doc.
        Returns:
        a normalization factor for hits on this field of this document
        See Also:
        AbstractField.setBoost(float)
      • queryNorm

        public float queryNorm(float sumOfSquaredWeights)
        Implemented as 1/sqrt(sumOfSquaredWeights).
        Specified by:
        queryNorm in class Similarity
        Parameters:
        sumOfSquaredWeights - the sum of the squares of query term weights
        Returns:
        a normalization factor for query weights
      • tf

        public float tf(float freq)
        Implemented as sqrt(freq).
        Specified by:
        tf in class Similarity
        Parameters:
        freq - the frequency of a term within a document
        Returns:
        a score factor based on a term's within-document frequency
      • sloppyFreq

        public float sloppyFreq(int distance)
        Implemented as 1 / (distance + 1).
        Specified by:
        sloppyFreq in class Similarity
        Parameters:
        distance - the edit distance of this sloppy phrase match
        Returns:
        the frequency increment for this match
        See Also:
        PhraseQuery.setSlop(int)
      • idf

        public float idf(int docFreq,
                         int numDocs)
        Implemented as log(numDocs/(docFreq+1)) + 1.
        Specified by:
        idf in class Similarity
        Parameters:
        docFreq - the number of documents which contain the term
        numDocs - the total number of documents in the collection
        Returns:
        a score factor based on the term's document frequency
      • coord

        public float coord(int overlap,
                           int maxOverlap)
        Implemented as overlap / maxOverlap.
        Specified by:
        coord in class Similarity
        Parameters:
        overlap - the number of query terms matched in the document
        maxOverlap - the total number of terms in the query
        Returns:
        a score factor based on term overlap with the query

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.