Click or drag to resize

IFulltextQueryTDocumentToFutureList Method

Get a lazily initialized list of results. Accessing the results will trigger the execution of all pending future results as a batch of queries in a single roundtrip to searchd.

Namespace:  SphinxConnector.FluentApi
Assembly:  SphinxConnector (in SphinxConnector.dll) Version: 5.3.0
Syntax
Lazy<IList<TDocument>> ToFutureList()

Return Value

Type: LazyIListTDocument
A lazily initialized list of results for the query.
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").        
                                  ToFutureList();

    var facets = fulltextSession.Query<Product>().
                                 Match("a product").
                                 GroupBy(p => p.CategoryId).
                                 Select(p => new 
                                 { 
                                       p.CategoryId,
                                       Count = Projection.Count()
                                 }).
                                 ToFutureList();

   //No query has been executed up to this point

   foreach (result in results.Value) //<-- accessing the result of a query will cause all pending future queries 
   {                                //to be executed in one roundtrip to Sphinx at this point
        //...
   }
}
See Also