Table of Contents

Class SearchScoreDefinitionBuilder<TDocument>

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

A builder for a score modifier.

public sealed class SearchScoreDefinitionBuilder<TDocument>

Type Parameters

TDocument

The type of the document.

Inheritance
SearchScoreDefinitionBuilder<TDocument>
Inherited Members

Methods

Boost(SearchPathDefinition<TDocument>, double)

Creates a score modifier that multiples a result's base score by the value of a numeric field in the documents.

public SearchScoreDefinition<TDocument> Boost(SearchPathDefinition<TDocument> path, double undefined = 0)

Parameters

path SearchPathDefinition<TDocument>

The path to the numeric field whose value to multiply the default base score by.

undefined double

The numeric value to substitute if the numeric field is not found in the documents.

Returns

SearchScoreDefinition<TDocument>

A boost score modifier.

Boost(double)

Creates a score modifier that multiplies a result's base score by a given number.

public SearchScoreDefinition<TDocument> Boost(double value)

Parameters

value double

The number to multiply the default base score by.

Returns

SearchScoreDefinition<TDocument>

A boost score modifier.

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

Creates a score modifier that multiplies a result's base score by the value of a numeric field in the documents.

public SearchScoreDefinition<TDocument> Boost(Expression<Func<TDocument, double>> path, double undefined = 0)

Parameters

path Expression<Func<TDocument, double>>

The path to the numeric field whose value to multiply the default base score by.

undefined double

The numeric value to substitute if the numeric field is not found in the documents.

Returns

SearchScoreDefinition<TDocument>

A boost score modifier.

Constant(double)

Creates a score modifier that replaces the base score with a given number.

public SearchScoreDefinition<TDocument> Constant(double value)

Parameters

value double

The number to replace the base score with.

Returns

SearchScoreDefinition<TDocument>

A constant score modifier.

Function(SearchScoreFunction<TDocument>)

Creates a score modifier that computes the final score through an expression.

public SearchScoreDefinition<TDocument> Function(SearchScoreFunction<TDocument> function)

Parameters

function SearchScoreFunction<TDocument>

The expression used to compute the score.

Returns

SearchScoreDefinition<TDocument>

A function score modifier.