Package org.springframework.data.domain
Class Score
java.lang.Object
org.springframework.data.domain.Score
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Similarity
Value object representing a search result score computed via a
ScoringFunction
.
Encapsulates the numeric score and the scoring function used to derive it. Scores are primarily used to rank search
results. Depending on the used ScoringFunction
higher scores can indicate either a higher distance or a
higher similarity. Use the Similarity
class to indicate usage of a normalized score across representing
effectively the similarity.
Instances of this class are immutable and suitable for use in comparison, sorting, and range operations.
- Since:
- 4.0
- Author:
- Mark Paluch
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionCreates aRange
from the given minimum and maximumScore
values.boolean
Returns theScoringFunction
that was used to compute this score.double
getValue()
Returns the raw numeric value of the score.int
hashCode()
static Score
of
(double score) static Score
of
(double score, ScoringFunction function) toString()
-
Method Details
-
of
- Parameters:
score
- the score value without a specificScoringFunction
.- Returns:
- the new
Score
.
-
of
- Parameters:
score
- the score value.function
- the scoring function that has computed thescore
.- Returns:
- the new
Score
.
-
between
Creates aRange
from the given minimum and maximumScore
values. -
getValue
public double getValue()Returns the raw numeric value of the score.- Returns:
- the score value.
-
getFunction
Returns theScoringFunction
that was used to compute this score.- Returns:
- the associated scoring function.
-
equals
-
hashCode
public int hashCode() -
toString
-