Class CustomSimilarity


  • public class CustomSimilarity
    extends org.apache.lucene.search.similarities.ClassicSimilarity
    Custom scoring implementation.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.lucene.search.similarities.Similarity

        org.apache.lucene.search.similarities.Similarity.SimScorer, org.apache.lucene.search.similarities.Similarity.SimWeight
    • Field Summary

      • Fields inherited from class org.apache.lucene.search.similarities.TFIDFSimilarity

        discountOverlaps
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float lengthNorm​(int numTerms)
      We do not want long text to be less important than short text.
      • Methods inherited from class org.apache.lucene.search.similarities.ClassicSimilarity

        idf, idfExplain, scorePayload, sloppyFreq, tf, toString
      • Methods inherited from class org.apache.lucene.search.similarities.TFIDFSimilarity

        computeNorm, computeWeight, getDiscountOverlaps, idfExplain, setDiscountOverlaps, simScorer
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CustomSimilarity

        public CustomSimilarity()
    • Method Detail

      • lengthNorm

        public float lengthNorm​(int numTerms)
        We do not want long text to be less important than short text. Therefore always return 1 for this normalization value to have no impact. This value is computed during indexing and stored in the index.
        Overrides:
        lengthNorm in class org.apache.lucene.search.similarities.ClassicSimilarity