Packages

object SearchScore

A modifier of the relevance score. You may use the $meta: "searchScore" expression, e.g., via Projections.metaSearchScore, to extract the relevance score assigned to each found document.

Annotations
@Beta()
Since

4.7

See also

Scoring

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SearchScore
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. def boost(path: FieldSearchPath): PathBoostSearchScore

    Returns a SearchScore that instructs to multiply the score by the value of the specified field.

    Returns a SearchScore that instructs to multiply the score by the value of the specified field.

    path

    The numeric field whose value to multiply the score by.

    returns

    The requested SearchScore.

    See also

    boost score modifier

    SearchScoreExpression.pathExpression

  2. def boost(value: Float): ValueBoostSearchScore

    Returns a SearchScore that instructs to multiply the score by the specified value.

    Returns a SearchScore that instructs to multiply the score by the specified value.

    value

    The positive value to multiply the score by.

    returns

    The requested SearchScore.

    See also

    boost score modifier

  3. def constant(value: Float): ConstantSearchScore

    Returns a SearchScore that instructs to replace the score with the specified value.

    Returns a SearchScore that instructs to replace the score with the specified value.

    value

    The positive value to replace the score with.

    returns

    The requested SearchScore.

    See also

    constant score modifier

    SearchScoreExpression.constantExpression

  4. def function(expression: SearchScoreExpression): FunctionSearchScore

    Returns a SearchScore that instructs to compute the score using the specified expression.

    Returns a SearchScore that instructs to compute the score using the specified expression.

    expression

    The expression to use when calculating the score.

    returns

    The requested SearchScore.

    See also

    function score modifier

  5. def of(score: Bson): SearchScore

    Creates a SearchScore from a Bson in situations when there is no builder method that better satisfies your needs.

    Creates a SearchScore from a Bson in situations when there is no builder method that better satisfies your needs. This method cannot be used to validate the syntax.

    Example
    The following code creates two functionally equivalent SearchScores, though they may not be equal.

    val score1: SearchScore = SearchScore.boost(
      SearchPath.fieldPath("fieldName"))
    val score2: SearchScore = SearchScore.of(Document("boost" ->
      Document("path" -> SearchPath.fieldPath("fieldName").toValue)))
    score

    A Bson representing the required SearchScore.

    returns

    The requested SearchScore.