 | 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.4.1
SyntaxMultiQueryResult QueryMulti(
string multiQuery,
Object parameters = null
)
Function QueryMulti (
multiQuery As String,
Optional parameters As Object = Nothing
) As MultiQueryResult
Parameters
- multiQuery
- Type: SystemString
The multi-query to execute. - parameters (Optional)
- Type: SystemObject
The (optional) parameters for the query.
Return Value
Type:
MultiQueryResultAn instance of
MultiQueryResult that can be used to retrieve the results for the queries.
Exceptions
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