| IFulltextQueryTDocumentToFutureListAsync Method (CancellationToken) |
Get an asynchronously, lazily initialized list of results. Accessing the results will trigger the execution of all pending future results as a batch of asynchronous queries in
a single roundtrip to searchd.
Namespace:
SphinxConnector.FluentApi
Assembly:
SphinxConnector (in SphinxConnector.dll) Version: 5.3.0
Syntax Lazy<Task<IList<TDocument>>> ToFutureListAsync(
CancellationToken cancellationToken
)
Function ToFutureListAsync (
cancellationToken As CancellationToken
) As Lazy(Of Task(Of IList(Of TDocument)))
Parameters
- cancellationToken
- Type: System.ThreadingCancellationToken
The token to monitor for cancellation requests.
Return Value
Type:
LazyTaskIListTDocument
A lazily initialized list of results for the query.
A task representing the asynchronous operation.
Exceptions Examples
Suppose you have the following class representing a document in your index:
Consider the following example:
using (IFulltextSession fulltextSession = fulltextStore.StartSession())
{
var results = fulltextSession.Query<Product>().
Match("a product").
ToFutureListAsync();
var facets = fulltextSession.Query<Product>().
Match("a product").
GroupBy(p => p.CategoryId).
Select(p => new
{
p.CategoryId,
Count = Projection.Count()
}).
ToFutureListAsync();
foreach (result in await results.Value)
{
}
}
See Also