Click or drag to resize

IFulltextSessionQueryAsyncTDocument, TResult Method (IPreparedQueryTDocument, TResult, CancellationToken)

Asynchronously executes the given prepared query and returns the list of results

Namespace:  SphinxConnector.FluentApi
Assembly:  SphinxConnector (in SphinxConnector.dll) Version: 5.3.0
Syntax
Task<IList<TResult>> QueryAsync<TDocument, TResult>(
	IPreparedQuery<TDocument, TResult> preparedQuery,
	CancellationToken cancellationToken
)

Parameters

preparedQuery
Type: SphinxConnector.FluentApi.PreparedQueriesIPreparedQueryTDocument, TResult
The query to execute.
cancellationToken
Type: System.ThreadingCancellationToken
The token to monitor for cancellation requests.

Type Parameters

TDocument
The type of document to execute a prepared query for.
TResult
The type of the result to return.

Return Value

Type: TaskIListTResult
The results of the query.
Exceptions
ExceptionCondition
ArgumentNullExceptionOccurs when preparedQuery is null.
ObjectDisposedExceptionOccurs when the session has already been disposed.
FulltextExceptionOccurs when there is an error during the execution of the query.
OperationCanceledExceptionOccurs when cancellation has been requested.
Examples
Suppose you have the following prepared query:
using (IFulltextSession fulltextSession = fulltextStore.StartSession())
{
    var cts = new CancellationTokenSource()
    var preparedQuery = new GetMatchingProductsQuery { MatchClause = "my query", Skip = 14, Take = 14 };
    var results = await fulltextSession.QueryAsync(preparedQuery, cts.Token).
}
See Also