Click or drag to resize

ISphinxQLExecutorQueryMulti Method

Executes the given SphinxQL multi-query and returns an instance of MultiQueryResult that can be used to retrieve the results for the queries.

Namespace:  SphinxConnector.FluentApi
Assembly:  SphinxConnector (in SphinxConnector.dll) Version: 5.3.0
Syntax
MultiQueryResult QueryMulti(
	string multiQuery,
	Object parameters = null
)

Parameters

multiQuery
Type: SystemString
The multi-query to execute.
parameters (Optional)
Type: SystemObject
The (optional) parameters for the query.

Return Value

Type: MultiQueryResult
An instance of MultiQueryResult that can be used to retrieve the results for the queries.
Exceptions
ExceptionCondition
ArgumentExceptionOccurs if multiQuery is empty.
ArgumentNullExceptionOccurs if multiQuery is null.
Examples
Suppose you have the following class representing a document in your index:
You want to execute a full-text query over your products and retrieve some facets along with it by using Sphinx' FACET-clause that was introduced with Sphinx 2.2.3:
public class VendorFacet
{
    public int Count { get; set; }        
    public int VendorId { get; set; }
}

public class CategoryFacet
{
    public int Count { get; set; }
    public int CategoryId { get; set; }        
}

using (IFulltextSession fulltextSession = fulltextStore.StartSession())
{
    ISphinxQLExecutor sphinxQLExecutor = fulltextSession.Advanced.CreateSphinxQLExecutor();

    var parameters = new { query = "a product" };

    using (var multiQueryResult = sphinxQLExecutor.QueryMulti(@"SELECT * FROM products WHERE MATCH(@query) 
                                                                FACET CategoryId 
                                                                FACET VendorId", parameters))
    {
        var productMatches = multiQueryResult.Read<Product>();

        var categoryFacets = multiQueryResult.Read<CategoryFacet>();

        var vendorFacets = multiQueryResult.Read<VendorFacet>();
    }        
}
Remarks
Note that the method automatically maps the 'count(*)' result column from the facet result to the 'Count' column of the respective objects.
See Also