/// <summary> /// Create a facet range parameter /// </summary> /// <param name="documentSearch">Document search engine</param> /// <param name="conditional">Conditional to add parameter</param> /// <param name="aliasName">Name of alias added in query</param> /// <param name="fieldExpression">Expression used to find field name</param> /// <param name="centerPoint">Center point to spatial filter</param> /// <param name="distance">Distance from center point</param> /// <param name="instance">Instance of parameter ready to configure</param> /// <returns>Document search engine</returns> public static DocumentSearch <TDocument> FacetSpatialIf <TDocument>(this DocumentSearch <TDocument> documentSearch, Func <bool> conditional, string aliasName, Expression <Func <TDocument, object> > fieldExpression, GeoCoordinate centerPoint, decimal distance, Action <IFacetSpatialParameter <TDocument> > instance = null) where TDocument : Document { Checker.IsNull(conditional); if (conditional.Invoke()) { documentSearch.FacetSpatial(aliasName, fieldExpression, centerPoint, distance, instance); } return(documentSearch); }