IFulltext SessionQueryTDocument, TResult(IPrepared QueryTDocument, TResult) Method
Executes the given prepared query and returns the list of results
Definition
Namespace: SphinxConnector.FluentApi
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
The results of the query.
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
C#
IList<TResult> Query<TDocument, TResult>(
IPreparedQuery<TDocument, TResult> preparedQuery
)
VB
Function Query(Of TDocument, TResult) (
preparedQuery As IPreparedQuery(Of TDocument, TResult)
) As IList(Of TResult)Parameters
- preparedQuery IPreparedQueryTDocument, TResult
- The query to execute.
Type Parameters
- TDocument
- The type of document to execute a prepared query for.
- TResult
- The type of the result to return.
Return Value
IListTResultThe results of the query.
Example
Suppose you have the following prepared query:
C#
public class GetMatchingProductsQuery : IPreparedQuery<Product>
{
public string MatchClause { get; set; }
public int Skip { get; set; } = 0;
public int Take { get; set; } = 15;
public Expression<Func<IFulltextQuery<Product>, IFulltextQuery<Product>>> Query() => q => q.Match(MatchClause).Limit(Skip, Take);
}
C#
using (IFulltextSession fulltextSession = fulltextStore.StartSession())
{
var preparedQuery = new GetMatchingProductsQuery { MatchClause = "my query", Skip = 14, Take = 14 };
var results = fulltextSession.Query(preparedQuery).
}Exceptions
| ArgumentNullException | Occurs when preparedQuery is null. |
| ObjectDisposedException | Occurs when the session has already been disposed. |