IFulltextQueryTDocumentHaving Method

Filter the aggregated results of this query by the given predicate. Supported with Sphinx 2.2.1 and up.

Definition

Namespace: SphinxConnector.FluentApi
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
C#
IFulltextQuery<TDocument> Having(
	Expression<Func<TDocument, bool>> predicate
)

Parameters

predicate  ExpressionFuncTDocument, Boolean

Return Value

IFulltextQueryTDocument
The current instance.

Example

C#
using (IFulltextSession fulltextSession = fulltextStore.StartSession())
{
    var results = fulltextSession.Query<Product>().
                                  Match("a product").
                                  GroupBy(p => p.VendorId).
                                  Select(p => new
                                  {
                                      p,
                                      Count = Projection.Count()        
                                  }).
                                  Having(p => p.Count > 1).
                                  ToList();
}

Exceptions

ArgumentNullExceptionOccurs when predicate is null.
InvalidOperationExceptionOccurs when this method called more than once for query.

See Also