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