Interface ScoreOptions

All Superinterfaces:
Bson

public interface ScoreOptions extends Bson
The options for a $score pipeline stage.
Since:
5.10
MongoDB documentation
$score
Since server release
8.2
  • 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