 | ISphinxQLExecutorQueryT Method (String, QueryMetadata, Object) |
Executes the given SphinxQL query and returns a list of results of the given type along with the query metadata. Note: 'SHOW META' is automatically appended to the query.
Namespace:
SphinxConnector.FluentApi
Assembly:
SphinxConnector (in SphinxConnector.dll) Version: 5.4.1
SyntaxIList<T> Query<T>(
string query,
out QueryMetadata metadata,
Object parameters = null
)
Function Query(Of T) (
query As String,
<OutAttribute> ByRef metadata As QueryMetadata,
Optional parameters As Object = Nothing
) As IList(Of T)
Parameters
- query
- Type: SystemString
The query to execute. - metadata
- Type: SphinxConnector.FluentApiQueryMetadata
The metadata for the query. - parameters (Optional)
- Type: SystemObject
Optional parameters for the query.
Type Parameters
- T
- The result type.
Return Value
Type:
IListTA list of results of the given type. If the type is a built-in type like int, string, etc only the data from the first column is returned,
otherwise an instance is created per row, and a case insensitive, direct mapping between column-name and member-name is assumed.
Exceptions
Examples
The following example shows how to execute a query that returns metadata:
using (IFulltextSession fulltextSession = fulltextStore.StartSession())
{
ISphinxQLExecutor sphinxQLExecutor = fulltextSession.Advanced.CreateSphinxQLExecutor();
var parameters = new { query = "a product" };
QueryMetadata metadata;
var results = sphinxQLExecutor.Query<Product>("SELECT * FROM products WHERE MATCH(@query)", out metadata, parameters);
}
See Also