Table of Contents

Class SearchScoreFunctionBuilder<TDocument>

Namespace
MongoDB.Driver.Search
Assembly
MongoDB.Driver.dll

A builder for a score function.

public sealed class SearchScoreFunctionBuilder<TDocument>

Type Parameters

TDocument

The type of the document.

Inheritance
SearchScoreFunctionBuilder<TDocument>
Inherited Members

Methods

Add(params SearchScoreFunction<TDocument>[])

Creates a function that adds a series of numbers.

public SearchScoreFunction<TDocument> Add(params SearchScoreFunction<TDocument>[] operands)

Parameters

operands SearchScoreFunction<TDocument>[]

An array of expressions, which can have negative values.

Returns

SearchScoreFunction<TDocument>

An addition score function.

Add(IEnumerable<SearchScoreFunction<TDocument>>)

Creates a function that adds a series of numbers.

public SearchScoreFunction<TDocument> Add(IEnumerable<SearchScoreFunction<TDocument>> operands)

Parameters

operands IEnumerable<SearchScoreFunction<TDocument>>

An array of expressions, which can have negative values.

Returns

SearchScoreFunction<TDocument>

An addition score function.

Constant(double)

Creates a function that represents a constant number.

public SearchScoreFunction<TDocument> Constant(double value)

Parameters

value double

Number that indicates a fixed value.

Returns

SearchScoreFunction<TDocument>

A constant score function.

Gauss(SearchPathDefinition<TDocument>, double, double, double, double)

Creates a function that decays, or reduces by multiplying, the final scores of the documents based on the distance of a numeric field from a specified origin point.

public SearchScoreFunction<TDocument> Gauss(SearchPathDefinition<TDocument> path, double origin, double scale, double decay = 0.5, double offset = 0)

Parameters

path SearchPathDefinition<TDocument>

The path to the numeric field.

origin double

The point of origin from which to calculate the distance.

scale double

The distance from origin plus or minus offset at which scores must be multiplied.

decay double

The rate at which to multiply score values, which must be a positive number between 0 and 1 exclusive.

offset double

The number of use to determine the distance from origin.

Returns

SearchScoreFunction<TDocument>

A Guassian score function.

Gauss(Expression<Func<TDocument, double>>, double, double, double, double)

Creates a function that decays, or reduces by multiplying, the final scores of the documents based on the distance of a numeric field from a specified origin point.

public SearchScoreFunction<TDocument> Gauss(Expression<Func<TDocument, double>> path, double origin, double scale, double decay = 0.5, double offset = 0)

Parameters

path Expression<Func<TDocument, double>>

The path to the numeric field.

origin double

The point of origin from which to calculate the distance.

scale double

The distance from origin plus or minus offset at which scores must be multiplied.

decay double

The rate at which to multiply score values, which must be a positive number between 0 and 1 exclusive.

offset double

The number of use to determine the distance from origin.

Returns

SearchScoreFunction<TDocument>

A Guassian score function.

Log(SearchScoreFunction<TDocument>)

Creates a function that calculates the base-10 logarithm of a number.

public SearchScoreFunction<TDocument> Log(SearchScoreFunction<TDocument> operand)

Parameters

operand SearchScoreFunction<TDocument>

The number.

Returns

SearchScoreFunction<TDocument>

A logarithmic score function.

Log1p(SearchScoreFunction<TDocument>)

Creates a function that adds 1 to a number and then calculates its base-10 logarithm.

public SearchScoreFunction<TDocument> Log1p(SearchScoreFunction<TDocument> operand)

Parameters

operand SearchScoreFunction<TDocument>

The number.

Returns

SearchScoreFunction<TDocument>

A logarithmic score function.

Multiply(params SearchScoreFunction<TDocument>[])

Creates a function that multiplies a series of numbers.

public SearchScoreFunction<TDocument> Multiply(params SearchScoreFunction<TDocument>[] operands)

Parameters

operands SearchScoreFunction<TDocument>[]

An array of expressions, which can have negative values.

Returns

SearchScoreFunction<TDocument>

A mulitplication score function.

Multiply(IEnumerable<SearchScoreFunction<TDocument>>)

Creates a function that multiplies a series of numbers.

public SearchScoreFunction<TDocument> Multiply(IEnumerable<SearchScoreFunction<TDocument>> operands)

Parameters

operands IEnumerable<SearchScoreFunction<TDocument>>

An array of expressions, which can have negative values.

Returns

SearchScoreFunction<TDocument>

A multiplication score function.

Path(SearchPathDefinition<TDocument>, double)

Creates a function that incorporates an indexed numeric field value into the score.

public SearchScoreFunction<TDocument> Path(SearchPathDefinition<TDocument> path, double undefined = 0)

Parameters

path SearchPathDefinition<TDocument>

The path to the numeric field.

undefined double

The value to use if the numeric field specified using path is missing in the document.

Returns

SearchScoreFunction<TDocument>

A path score function.

Path(Expression<Func<TDocument, double>>, double)

Creates a function that incorporates an indexed numeric field value into the score.

public SearchScoreFunction<TDocument> Path(Expression<Func<TDocument, double>> path, double undefined = 0)

Parameters

path Expression<Func<TDocument, double>>

The path to the numeric field.

undefined double

The value to use if the numeric field specified using path is missing in the document.

Returns

SearchScoreFunction<TDocument>

A path score function.

Relevance()

Creates a function that represents the relevance score, which is the score Atlas Search assigns documents based on relevance.

public SearchScoreFunction<TDocument> Relevance()

Returns

SearchScoreFunction<TDocument>

A relevance score function.