Class NonNegativeScoresSimilarity

java.lang.Object
org.apache.lucene.search.similarities.Similarity
org.elasticsearch.index.similarity.NonNegativeScoresSimilarity

public final class NonNegativeScoresSimilarity extends org.apache.lucene.search.similarities.Similarity
A Similarity that rejects negative scores. This class exists so that users get an error instead of silently corrupt top hits. It should be applied to any custom or scripted similarity.
  • Nested Class Summary

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

    org.apache.lucene.search.similarities.Similarity.SimScorer
  • Constructor Summary

    Constructors
    Constructor
    Description
    NonNegativeScoresSimilarity(org.apache.lucene.search.similarities.Similarity in)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    computeNorm(org.apache.lucene.index.FieldInvertState state)
     
    org.apache.lucene.search.similarities.Similarity
     
    org.apache.lucene.search.similarities.Similarity.SimScorer
    scorer(float boost, org.apache.lucene.search.CollectionStatistics collectionStats, org.apache.lucene.search.TermStatistics... termStats)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NonNegativeScoresSimilarity

      public NonNegativeScoresSimilarity(org.apache.lucene.search.similarities.Similarity in)
  • Method Details

    • getDelegate

      public org.apache.lucene.search.similarities.Similarity getDelegate()
    • computeNorm

      public long computeNorm(org.apache.lucene.index.FieldInvertState state)
      Specified by:
      computeNorm in class org.apache.lucene.search.similarities.Similarity
    • scorer

      public org.apache.lucene.search.similarities.Similarity.SimScorer scorer(float boost, org.apache.lucene.search.CollectionStatistics collectionStats, org.apache.lucene.search.TermStatistics... termStats)
      Specified by:
      scorer in class org.apache.lucene.search.similarities.Similarity