Interface ScoreOptions

All Superinterfaces:
org.bson.conversions.Bson

public interface ScoreOptions extends org.bson.conversions.Bson
The options for a $score pipeline stage.
Since:
5.10
MongoDB documentation
$score
Since server release
8.2
  • Field Summary

    Fields inherited from interface org.bson.conversions.Bson

    DEFAULT_CODEC_REGISTRY
  • Method Summary

    Modifier and Type
    Method
    Description
    The method used to normalize the score to the range [0, 1].
    scoreDetails(boolean scoreDetails)
    Specifies whether to populate the scoreDetails metadata field, which contains details on how the score was computed.
    Returns ScoreOptions that 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

      static ScoreOptions scoreOptions()
      Returns ScoreOptions that represents server defaults.
      Returns:
      ScoreOptions that represents server defaults.
    • normalization

      ScoreOptions normalization(ScoreNormalization normalization)
      The method used to normalize the score to the range [0, 1]. If this option is not provided, the server default is ScoreNormalization.NONE.
      Parameters:
      normalization - the normalization method
      Returns:
      a new ScoreOptions with the provided option set
      Since:
      5.10
    • weight

      ScoreOptions weight(double weight)
      The factor to multiply the score by after normalization. Must be in the range [0, 1].
      Parameters:
      weight - the weight
      Returns:
      a new ScoreOptions with the provided option set
      Throws:
      IllegalArgumentException - if the weight is not in the range [0, 1]
      Since:
      5.10
      MongoDB documentation
      $score
    • scoreDetails

      ScoreOptions scoreDetails(boolean scoreDetails)
      Specifies whether to populate the scoreDetails metadata field, which contains details on how the score was computed. If this option is not provided, the server default is false.
      Parameters:
      scoreDetails - whether to populate the scoreDetails metadata field
      Returns:
      a new ScoreOptions with the provided option set
      Since:
      5.10