org.apache.lucene.misc

Class SweetSpotSimilarity

    • Method Detail

      • setHyperbolicTfFactors

        public void setHyperbolicTfFactors(float min,
                                           float max,
                                           double base,
                                           float xoffset)
        Sets the function variables for the hyperbolicTf functions
        Parameters:
        min - the minimum tf value to ever be returned (default: 0.0)
        max - the maximum tf value to ever be returned (default: 2.0)
        base - the base value to be used in the exponential for the hyperbolic function (default: 1.3)
        xoffset - the midpoint of the hyperbolic function (default: 10.0)
        See Also:
        hyperbolicTf(float)
      • setLengthNormFactors

        public void setLengthNormFactors(int min,
                                         int max,
                                         float steepness,
                                         boolean discountOverlaps)
        Sets the default function variables used by lengthNorm when no field specific variables have been set.
        See Also:
        computeLengthNorm(int)
      • lengthNorm

        public float lengthNorm(FieldInvertState state)
        Implemented as state.getBoost() * computeLengthNorm(numTokens) where numTokens does not count overlap tokens if discountOverlaps is true by default or true for this specific field.
        Overrides:
        lengthNorm in class ClassicSimilarity
        Parameters:
        state - statistics of the current field (such as length, boost, etc)
        Returns:
        an index-time normalization value
      • tf

        public float tf(float freq)
        Delegates to baselineTf
        Overrides:
        tf in class ClassicSimilarity
        Parameters:
        freq - the frequency of a term within a document
        Returns:
        a score factor based on a term's within-document frequency
        See Also:
        baselineTf(float)