Packages

o

org.mongodb.scala.model.search

SearchScoreExpression

object SearchScoreExpression

Annotations
@Beta()
Since

4.7

See also

SearchScore.function

Expressions for the function score modifier

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

Value Members

  1. def addExpression(expressions: Iterable[_ <: SearchScoreExpression]): AddSearchScoreExpression

    Returns a SearchScoreExpression that evaluates into the sum of the values of the specified expressions.

    Returns a SearchScoreExpression that evaluates into the sum of the values of the specified expressions.

    expressions

    The expressions whose values to add. Must contain at least two expressions.

    returns

    The requested SearchScoreExpression.

  2. def constantExpression(value: Float): ConstantSearchScoreExpression

    Returns a SearchScoreExpression that evaluates into the specified value.

    Returns a SearchScoreExpression that evaluates into the specified value.

    value

    The value to use as the result of the expression. Unlike SearchScore.constant, does not have constraints.

    returns

    The requested SearchScoreExpression.

    See also

    SearchScore.constant

  3. def gaussExpression(origin: Double, path: PathSearchScoreExpression, scale: Double): GaussSearchScoreExpression

    Returns a SearchScoreExpression that represents a Gaussian function whose output is within the interval [0, 1].

    Returns a SearchScoreExpression that represents a Gaussian function whose output is within the interval [0, 1]. Roughly speaking, the further the value of the path expression is from the origin, the smaller the output of the function.

    The scale and decay are parameters of the Gaussian function, they define the rate at which the function decays. The input of the Gaussian function is the output of another function: max(0, abs(pathValue - origin) - offset), where pathValue is the value of the path expression.

    origin

    The point of origin, see GaussSearchScoreExpression.offset. The value of the Gaussian function is 1 if the value of the path expression is origin.

    path

    The expression whose value is used to calculate the input of the Gaussian function.

    scale

    The non-zero distance from the points origin ± offset at which the output of the Gaussian function must decay by the factor of decay.

    returns

    The requested SearchScoreExpression.

  4. def log1pExpression(expression: SearchScoreExpression): Log1pSearchScoreExpression

    Returns a SearchScoreExpression that evaluates into log10(expressionValue + 1), where expressionValue is the value of the expression.

    Returns a SearchScoreExpression that evaluates into log10(expressionValue + 1), where expressionValue is the value of the expression.

    expression

    The expression whose value is used to calculate the input of the log10 function.

    returns

    The requested SearchScoreExpression.

  5. def logExpression(expression: SearchScoreExpression): LogSearchScoreExpression

    Returns a SearchScoreExpression that evaluates into log10(expressionValue), where expressionValue is the value of the expression.

    Returns a SearchScoreExpression that evaluates into log10(expressionValue), where expressionValue is the value of the expression.

    expression

    The expression whose value is the input of the log10 function.

    returns

    The requested SearchScoreExpression.

  6. def multiplyExpression(expressions: Iterable[_ <: SearchScoreExpression]): MultiplySearchScoreExpression

    Returns a SearchScoreExpression that evaluates into the product of the values of the specified expressions.

    Returns a SearchScoreExpression that evaluates into the product of the values of the specified expressions.

    expressions

    The expressions whose values to multiply. Must contain at least two expressions.

    returns

    The requested SearchScoreExpression.

  7. def of(expression: Bson): SearchScoreExpression

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

    Creates a SearchScoreExpression 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 SearchScoreExpressions, though they may not be equal.

    val expression1: SearchScoreExpression = SearchScoreExpression.pathExpression(
      SearchPath.fieldPath("fieldName"))
      .undefined(-1.5f)
    val expression2: SearchScoreExpression = SearchScoreExpression.of(Document("path" ->
      Document("value" -> SearchPath.fieldPath("fieldName").toValue,
        "undefined" -> -1.5)))
    expression

    A Bson representing the required SearchScoreExpression.

    returns

    The requested SearchScoreExpression.

  8. def pathExpression(path: FieldSearchPath): PathSearchScoreExpression

    Returns a SearchScoreExpression that evaluates into the value of the specified field.

    Returns a SearchScoreExpression that evaluates into the value of the specified field.

    path

    The numeric field whose value to use as the result of the expression.

    returns

    The requested SearchScoreExpression.

    See also

    SearchScore.boost(FieldSearchPath)

  9. def relevanceExpression(): RelevanceSearchScoreExpression

    Returns a SearchScoreExpression that evaluates into the relevance score of a document.

    Returns a SearchScoreExpression that evaluates into the relevance score of a document.

    returns

    The requested SearchScoreExpression.