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
ConstructorDescriptionNonNegativeScoresSimilarity(org.apache.lucene.search.similarities.Similarity in)
-
Method Summary
Modifier and TypeMethodDescriptionlong
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)
-
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 classorg.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 classorg.apache.lucene.search.similarities.Similarity
-