Table of Contents

Method Search

Namespace
MongoDB.Driver.Linq
Assembly
MongoDB.Driver.dll

Search<TSource>(IQueryable<TSource>, SearchDefinition<TSource>, SearchHighlightOptions<TSource>, string, SearchCountOptions, bool, bool)

Appends a $search stage to the LINQ pipeline.

public static IQueryable<TSource> Search<TSource>(this IQueryable<TSource> source, SearchDefinition<TSource> searchDefinition, SearchHighlightOptions<TSource> highlight = null, string indexName = null, SearchCountOptions count = null, bool returnStoredSource = false, bool scoreDetails = false)

Parameters

source IQueryable<TSource>

A sequence of values.

searchDefinition SearchDefinition<TSource>

The search definition.

highlight SearchHighlightOptions<TSource>

The highlight options.

indexName string

The index name.

count SearchCountOptions

The count options.

returnStoredSource bool

Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search.

scoreDetails bool

Flag that specifies whether to return a detailed breakdown of the score for each document in the result.

Returns

IQueryable<TSource>

The queryable with a new stage appended.

Type Parameters

TSource

The type of the elements of source.

Search<TSource>(IQueryable<TSource>, SearchDefinition<TSource>, SearchOptions<TSource>)

Appends a $search stage to the LINQ pipeline.

public static IQueryable<TSource> Search<TSource>(this IQueryable<TSource> source, SearchDefinition<TSource> searchDefinition, SearchOptions<TSource> searchOptions)

Parameters

source IQueryable<TSource>

A sequence of values.

searchDefinition SearchDefinition<TSource>

The search definition.

searchOptions SearchOptions<TSource>

The search options.

Returns

IQueryable<TSource>

The queryable with a new stage appended.

Type Parameters

TSource

The type of the elements of source.