/// <summary> /// Create a facet query 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="query">Query used to make facet</param> /// <param name="instance">Instance of facet ready to configure</param> /// <returns>Document search engine</returns> public static DocumentSearch <TDocument> FacetQueryIf <TDocument>(this DocumentSearch <TDocument> documentSearch, Func <bool> conditional, string aliasName, Action <SearchQuery <TDocument> > query, Action <IFacetQueryParameter <TDocument> > instance = null) where TDocument : Document { Checker.IsNull(conditional); if (conditional.Invoke()) { documentSearch.FacetQuery(aliasName, query, instance); } return(documentSearch); }