Click or drag to resize

IFulltextQueryTDocumentMetadata Method

Returns query metadata (data is available after the query has been executed).

Namespace:  SphinxConnector.FluentApi
Assembly:  SphinxConnector (in SphinxConnector.dll) Version: 5.3.0
Syntax
IFulltextQuery<TDocument> Metadata(
	out QueryMetadata metadata
)

Parameters

metadata
Type: SphinxConnector.FluentApiQueryMetadata
The metadata for this query.

Return Value

Type: IFulltextQueryTDocument
The current instance.
Examples
Suppose you have the following class representing a document in your index:
And you want to retrieve the meta data along with the query:
using (IFulltextSession fulltextSession = fulltextStore.StartSession())
{                
    var results = fulltextSession.Query<Product>().
                                  Match("a product").
                                  Metadata(out QueryMetadata metadata).        
                                  ToList();
}

Retrieving metadata with future queries:
using (IFulltextSession fulltextSession = fulltextStore.StartSession())
{                                
    var results = fulltextSession.Query<Product>().
                                  Match("a product").  
                                  Metadata(out QueryMetadata resultsMetadata).       
                                  ToFutureList();

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

   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