ISphinx QLExecutorQuery Multi Method
Executes the given SphinxQL multi-query and returns an instance of MultiQueryResult that can be used to
retrieve the results for the queries.
Definition
Namespace: SphinxConnector.FluentApi
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
An instance of MultiQueryResult that can be used to retrieve the results for the queries.
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
C#
MultiQueryResult QueryMulti(
string multiQuery,
Object parameters = null
)VB
Function QueryMulti (
multiQuery As String,
Optional parameters As Object = Nothing
) As MultiQueryResultParameters
- 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.
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:
C#
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
public int CategoryId { get; set; }
public int VendorId { get; set; }
public int Weight { get; set; }
}
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:
C#
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.
Exceptions
| ArgumentException | Occurs if multiQuery is empty. |
| ArgumentNullException | Occurs if multiQuery is null. |