Method Search

| MongoDB CSharp Driver API Reference (original) (raw)

Namespace

MongoDB.Driver.Linq

Assembly

MongoDB.Driver.dll

Search(IQueryable, SearchDefinition, SearchHighlightOptions, 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

A sequence of values.

searchDefinition SearchDefinition

The search definition.

highlight SearchHighlightOptions

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

The queryable with a new stage appended.

Type Parameters

TSource

The type of the elements of source.

Search(IQueryable, SearchDefinition, SearchOptions)

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

A sequence of values.

searchDefinition SearchDefinition

The search definition.

searchOptions SearchOptions

The search options.

Returns

IQueryable

The queryable with a new stage appended.

Type Parameters

TSource

The type of the elements of source.