Package com.mongodb.client.model
Interface ScoreOptions
- All Superinterfaces:
Bson
The options for a
$score pipeline stage.-
Field Summary
Fields inherited from interface org.bson.conversions.Bson
DEFAULT_CODEC_REGISTRY -
Method Summary
Modifier and TypeMethodDescriptionnormalization(ScoreNormalization normalization) The method used to normalize the score to the range [0, 1].scoreDetails(boolean scoreDetails) Specifies whether to populate thescoreDetailsmetadata field, which contains details on how the score was computed.static ScoreOptionsReturnsScoreOptionsthat represents server defaults.weight(double weight) The factor to multiply the score by after normalization.Methods inherited from interface org.bson.conversions.Bson
toBsonDocument, toBsonDocument
-
Method Details
-
scoreOptions
ReturnsScoreOptionsthat represents server defaults.- Returns:
ScoreOptionsthat represents server defaults.
-
normalization
The method used to normalize the score to the range [0, 1]. If this option is not provided, the server default isScoreNormalization.NONE.- Parameters:
normalization- the normalization method- Returns:
- a new
ScoreOptionswith the provided option set - Since:
- 5.10
-
weight
The factor to multiply the score by after normalization. Must be in the range [0, 1].- Parameters:
weight- the weight- Returns:
- a new
ScoreOptionswith the provided option set - Throws:
IllegalArgumentException- if the weight is not in the range [0, 1]- Since:
- 5.10
- MongoDB documentation
- $score
-
scoreDetails
Specifies whether to populate thescoreDetailsmetadata field, which contains details on how the score was computed. If this option is not provided, the server default isfalse.- Parameters:
scoreDetails- whether to populate thescoreDetailsmetadata field- Returns:
- a new
ScoreOptionswith the provided option set - Since:
- 5.10
-