コード例 #1
0
        /// <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="gap">Size of each range bucket to make facet</param>
        /// <param name="start">Lower bound to make facet</param>
        /// <param name="end">Upper bound to make facet</param>
        /// <param name="instance">Instance of parameter ready to configure</param>
        /// <returns>Document search engine</returns>
        public static DocumentSearch <TDocument> FacetRangeIf <TDocument>(this DocumentSearch <TDocument> documentSearch, Func <bool> conditional, string aliasName, Expression <Func <TDocument, object> > fieldExpression, string gap, string start, string end, Action <IFacetRangeParameter <TDocument> > instance = null)
            where TDocument : Document
        {
            Checker.IsNull(conditional);

            if (conditional.Invoke())
            {
                documentSearch.FacetRange(aliasName, fieldExpression, gap, start, end, instance);
            }

            return(documentSearch);
        }