Couchbase .NET SDK __CB_SDK_VERSION__

Show / Hide Table of Contents

Class SearchOptions

Represents a number of query options that can be applied to a FTS query request.

Inheritance
object
SearchOptions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Couchbase.Search
Assembly: Couchbase.NetClient.dll
Syntax
public class SearchOptions

Constructors

View Source

SearchOptions()

Declaration
public SearchOptions()

Fields

View Source

DefaultReadOnly

Declaration
public static readonly SearchOptions.ReadOnly DefaultReadOnly
Field Value
Type Description
SearchOptions.ReadOnly

Methods

View Source

AsReadOnly()

Declaration
public SearchOptions.ReadOnly AsReadOnly()
Returns
Type Description
SearchOptions.ReadOnly
View Source

CancellationToken(CancellationToken)

Declaration
public SearchOptions CancellationToken(CancellationToken token)
Parameters
Type Name Description
CancellationToken token
Returns
Type Description
SearchOptions
View Source

Collections(params string[])

The name or names of the collections to target for search results.

Declaration
public SearchOptions Collections(params string[] collectionNames)
Parameters
Type Name Description
string[] collectionNames

The collection names.

Returns
Type Description
SearchOptions
View Source

ConsistentWith(MutationState)

Declaration
public SearchOptions ConsistentWith(MutationState mutationState)
Parameters
Type Name Description
MutationState mutationState
Returns
Type Description
SearchOptions
View Source

Deconstruct(out int?, out int?, out bool?, out string?, out IReadOnlyList<string>, out IReadOnlyList<string>?, out IReadOnlyList<ISearchFacet>?, out SearchScanConsistency?, out JArray, out IReadOnlyDictionary<string, object>, out IReadOnlyDictionary<string, Dictionary<string, List<object>>>, out bool, out string?, out string[]?, out bool, out MutationState?, out CancellationToken, out TimeSpan?, out IRetryStrategy?, out IRequestSpan?)

Declaration
public void Deconstruct(out int? limit, out int? skip, out bool? explain, out string? highLightStyle, out IReadOnlyList<string> fields, out IReadOnlyList<string>? highLightFields, out IReadOnlyList<ISearchFacet>? facets, out SearchScanConsistency? scanConsistency, out JArray sort, out IReadOnlyDictionary<string, object> rawParameters, out IReadOnlyDictionary<string, Dictionary<string, List<object>>> scanVectors, out bool disableScoring, out string? scopeName, out string[]? collectionNames, out bool includeLocations, out MutationState? mutationState, out CancellationToken token, out TimeSpan? timeoutValue, out IRetryStrategy? retryStrategyValue, out IRequestSpan? requestSpanValue)
Parameters
Type Name Description
int? limit
int? skip
bool? explain
string highLightStyle
IReadOnlyList<string> fields
IReadOnlyList<string> highLightFields
IReadOnlyList<ISearchFacet> facets
SearchScanConsistency? scanConsistency
JArray sort
IReadOnlyDictionary<string, object> rawParameters
IReadOnlyDictionary<string, Dictionary<string, List<object>>> scanVectors
bool disableScoring
string scopeName
string[] collectionNames
bool includeLocations
MutationState mutationState
CancellationToken token
TimeSpan? timeoutValue
IRetryStrategy retryStrategyValue
IRequestSpan requestSpanValue
View Source

DisableScoring(bool)

Declaration
public SearchOptions DisableScoring(bool disableScoring)
Parameters
Type Name Description
bool disableScoring
Returns
Type Description
SearchOptions
View Source

Explain(bool)

If true, the response will include additional search score explanations.

Declaration
public SearchOptions Explain(bool explain)
Parameters
Type Name Description
bool explain
Returns
Type Description
SearchOptions
View Source

Facets(params ISearchFacet[])

ISearchFacets used to aggregate information collected on a particular result set.

Declaration
public SearchOptions Facets(params ISearchFacet[] searchFacets)
Parameters
Type Name Description
ISearchFacet[] searchFacets

The ISearchFacet to aggregate information on.

Returns
Type Description
SearchOptions
View Source

Fields(params string[])

List of fields values that should be returned in the result assuming that they were indexed.

Declaration
public SearchOptions Fields(params string[] fields)
Parameters
Type Name Description
string[] fields

The indexed fields to return.

Returns
Type Description
SearchOptions
View Source

Highlight(HighLightStyle)

Allows setting of additional highlighting on the result set of matching terms.

Declaration
public SearchOptions Highlight(HighLightStyle highLightStyle)
Parameters
Type Name Description
HighLightStyle highLightStyle

The HighLightStyle to use.

Returns
Type Description
SearchOptions
View Source

Highlight(HighLightStyle, params string[])

Allows setting of additional highlighting on the result set of matching terms.

Declaration
public SearchOptions Highlight(HighLightStyle highLightStyle, params string[] fields)
Parameters
Type Name Description
HighLightStyle highLightStyle

The HighLightStyle to use.

string[] fields

The specific terms or fields to highlight.

Returns
Type Description
SearchOptions
View Source

IncludeLocations(bool)

If set to true, will include the SearchRowLocations.

Declaration
[InterfaceStability(Level.Uncommitted)]
public SearchOptions IncludeLocations(bool includeLocations)
Parameters
Type Name Description
bool includeLocations

bool indicating that the locations will be returned. The default is false.

Returns
Type Description
SearchOptions

SearchOptions for chaining method calls.

View Source

Limit(int)

Limits the number of matching results from a returned result-set.

Declaration
public SearchOptions Limit(int limit)
Parameters
Type Name Description
int limit
Returns
Type Description
SearchOptions
View Source

Raw(string, object)

Declaration
public SearchOptions Raw(string name, object value)
Parameters
Type Name Description
string name
object value
Returns
Type Description
SearchOptions
View Source

RequestSpan(IRequestSpan)

A parent or external span for tracing.

Declaration
public SearchOptions RequestSpan(IRequestSpan span)
Parameters
Type Name Description
IRequestSpan span

An external IRequestSpan implementation for tracing.

Returns
Type Description
SearchOptions
View Source

RetryStrategy(IRetryStrategy)

Overrides the global IRetryStrategy defined in ClusterOptions for a request.

Declaration
public SearchOptions RetryStrategy(IRetryStrategy retryStrategy)
Parameters
Type Name Description
IRetryStrategy retryStrategy

The IRetryStrategy to use for a single request.

Returns
Type Description
SearchOptions

The options.

View Source

ScanConsistency(SearchScanConsistency)

The SearchScanConsistency you require for you ISearchResults.

Declaration
public SearchOptions ScanConsistency(SearchScanConsistency consistency)
Parameters
Type Name Description
SearchScanConsistency consistency

The SearchScanConsistency for documents to be included in the query results.

Returns
Type Description
SearchOptions
View Source

Scope(string)

The name of the scope to target for search results.

Declaration
public SearchOptions Scope(string scopeName)
Parameters
Type Name Description
string scopeName

The name of the scope.

Returns
Type Description
SearchOptions
View Source

Skip(int)

Skip indicates how many matching results to skip on the result set before returning matches.

Declaration
public SearchOptions Skip(int skip)
Parameters
Type Name Description
int skip
Returns
Type Description
SearchOptions
View Source

Sort(ISearchSort)

Configures the sorting criteria for the search results using an implementation of ISearchSort.

Declaration
[RequiresUnreferencedCode("Couchbase FTS might require types that cannot be statically analyzed. Make sure all required types are preserved.")]
[RequiresDynamicCode("Couchbase FTS might require types that cannot be statically analyzed and might need runtime code generation. Do not use for native AOT applications.")]
public SearchOptions Sort(ISearchSort sort)
Parameters
Type Name Description
ISearchSort sort

The sort.

Returns
Type Description
SearchOptions
View Source

Sort(JObject)

Configures the sorting criteria for the search results using a custom Newtonsoft.Json.Linq.JObject.

Declaration
[RequiresUnreferencedCode("Couchbase FTS might require types that cannot be statically analyzed. Make sure all required types are preserved.")]
[RequiresDynamicCode("Couchbase FTS might require types that cannot be statically analyzed and might need runtime code generation. Do not use for native AOT applications.")]
public SearchOptions Sort(JObject sort)
Parameters
Type Name Description
JObject sort

The sort.

Returns
Type Description
SearchOptions
View Source

Sort(params string[])

Configures the list of fields which are used for sorting the search result. Fields with a prefix of "-" indicate a descending nature. If no sort is provided, it is equal to sort("-_score"), since the server will sort it by score in descending order by default.

Declaration
public SearchOptions Sort(params string[] sort)
Parameters
Type Name Description
string[] sort

The field names to sort by.

Returns
Type Description
SearchOptions
View Source

Timeout(TimeSpan)

The server side timeout allows to specify an upper boundary of request execution so that it potentially doesn't run infinitely.

Declaration
public SearchOptions Timeout(TimeSpan timeout)
Parameters
Type Name Description
TimeSpan timeout

The max length of time that that will be given to execute the query.

Returns
Type Description
SearchOptions
View Source

ToJson(string?)

Declaration
[RequiresUnreferencedCode("Couchbase FTS might require types that cannot be statically analyzed. Make sure all required types are preserved.")]
[RequiresDynamicCode("Couchbase FTS might require types that cannot be statically analyzed and might need runtime code generation. Do not use for native AOT applications.")]
public JObject ToJson(string? indexName = null)
Parameters
Type Name Description
string indexName
Returns
Type Description
JObject
View Source

ToString(string)

Declaration
[RequiresUnreferencedCode("Couchbase FTS might require types that cannot be statically analyzed. Make sure all required types are preserved.")]
[RequiresDynamicCode("Couchbase FTS might require types that cannot be statically analyzed and might need runtime code generation. Do not use for native AOT applications.")]
public string ToString(string indexName)
Parameters
Type Name Description
string indexName
Returns
Type Description
string
  • View Source
In this article
Back to top Copyright © 2020 Couchbase, Inc. All rights reserved.