示例#1
0
        public static SearchProductProjectionsCommand Limit(this SearchProductProjectionsCommand command, int limit)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.Limit = limit;

            return(command);
        }
示例#2
0
        public static SearchProductProjectionsCommand Offset(this SearchProductProjectionsCommand command, int offset)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.Offset = offset;

            return(command);
        }
示例#3
0
        public static SearchProductProjectionsCommand Sort(this SearchProductProjectionsCommand command, Expression <Func <ProductProjection, IComparable> > expression, SortDirection sortDirection = SortDirection.Ascending)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.Sort.Add(new Sort <ProductProjection>(expression, sortDirection).ToString());

            return(command);
        }
示例#4
0
        public static SearchProductProjectionsCommand Fuzzy(this SearchProductProjectionsCommand command, bool fuzzy)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.Fuzzy = fuzzy;

            return(command);
        }
示例#5
0
        public static SearchProductProjectionsCommand TermFacet(this SearchProductProjectionsCommand command, Expression <Func <ProductProjection, IComparable> > expression)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.Facets.Add(new TermFacet <ProductProjection>(expression).ToString());

            return(command);
        }
示例#6
0
        public static SearchProductProjectionsCommand FilterFacets(this SearchProductProjectionsCommand command, Expression <Func <ProductProjection, bool> > expression)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.FilterFacets.Add(new Filter <ProductProjection>(expression).ToString());

            return(command);
        }
示例#7
0
        public static SearchProductProjectionsCommand SetPriceCustomerGroup(this SearchProductProjectionsCommand command, string priceCustomerGroup)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.PriceCustomerGroup = priceCustomerGroup;

            return(command);
        }
示例#8
0
        public static SearchProductProjectionsCommand SetPriceChannel(this SearchProductProjectionsCommand command, string priceChannel)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.PriceChannel = priceChannel;

            return(command);
        }
示例#9
0
        public static SearchProductProjectionsCommand MarkMatchingVariants(this SearchProductProjectionsCommand command, bool markMatchingVariants)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.MarkMatchingVariants = markMatchingVariants;

            return(command);
        }
示例#10
0
        public static SearchProductProjectionsCommand SetPriceCountry(this SearchProductProjectionsCommand command, string priceCountry)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.PriceCountry = priceCountry;

            return(command);
        }
示例#11
0
        public static SearchProductProjectionsCommand RangeFacet(this SearchProductProjectionsCommand command, string expression)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.Facets.Add(expression);

            return(command);
        }
示例#12
0
        public static SearchProductProjectionsCommand FilterQuery(this SearchProductProjectionsCommand command, string expression)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.FilterQuery.Add(expression);

            return(command);
        }
示例#13
0
        public static SearchProductProjectionsCommand WithTotal(this SearchProductProjectionsCommand command, bool withTotal)
        {
            if (command.SearchParameters != null && command.SearchParameters is IPageable pageableParams)
            {
                pageableParams.WithTotal = withTotal;
            }

            return(command);
        }
示例#14
0
        public static SearchProductProjectionsCommand Offset(this SearchProductProjectionsCommand command, int offset)
        {
            if (command.SearchParameters != null && command.SearchParameters is IPageable pageableParams)
            {
                pageableParams.Offset = offset;
            }

            return(command);
        }
示例#15
0
        public static SearchProductProjectionsCommand FuzzyLevel(this SearchProductProjectionsCommand command, int fuzzyLevel)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.Fuzzy      = fuzzyLevel >= 0;
            p.FuzzyLevel = Math.Min(Math.Max(fuzzyLevel, 0), 2);

            return(command);
        }
示例#16
0
        public static SearchProductProjectionsCommand Sort(this SearchProductProjectionsCommand command, Expression <Func <ProductProjection, IComparable> > expression, SortDirection sortDirection = SortDirection.Ascending)
        {
            if (command.SearchParameters != null && command.SearchParameters is ISortable sortableParams)
            {
                sortableParams.Sort.Add(new Sort <ProductProjection>(expression, sortDirection).ToString());
            }

            return(command);
        }
示例#17
0
        public static SearchProductProjectionsCommand Sort(this SearchProductProjectionsCommand command, string expression)
        {
            if (command.SearchParameters != null && command.SearchParameters is ISortable sortableParams)
            {
                sortableParams.Sort.Add(expression);
            }

            return(command);
        }
示例#18
0
        public static SearchProductProjectionsCommand Limit(this SearchProductProjectionsCommand command, int limit)
        {
            if (command.SearchParameters != null && command.SearchParameters is IPageable pageableParams)
            {
                pageableParams.Limit = limit;
            }

            return(command);
        }
示例#19
0
        public static SearchProductProjectionsCommand RangeFacet(this SearchProductProjectionsCommand command, string alias, Expression <Func <ProductProjection, bool> > expression)
        {
            var p          = command.SearchParameters as ProductProjectionSearchParameters;
            var rangeFacet = new RangeFacet <ProductProjection>(expression);

            rangeFacet.Alias = alias;
            p.Facets.Add(rangeFacet.ToString());

            return(command);
        }
示例#20
0
        public static SearchProductProjectionsCommand FilteredFacet(this SearchProductProjectionsCommand command, string alias, Expression <Func <ProductProjection, bool> > expression, bool isCountingProducts = false)
        {
            var p             = command.SearchParameters as ProductProjectionSearchParameters;
            var filteredFacet = new FilterFacet <ProductProjection>(expression)
            {
                Alias = alias, IsCountingProducts = isCountingProducts
            };

            p.Facets.Add(filteredFacet.ToString());
            return(command);
        }
示例#21
0
        public static SearchProductProjectionsCommand RangeFacet(this SearchProductProjectionsCommand command, Expression <Func <ProductProjection, bool> > expression, bool isCountingProducts = false)
        {
            var p = command.SearchParameters as ProductProjectionSearchParameters;

            p.Facets.Add(new RangeFacet <ProductProjection>(expression)
            {
                IsCountingProducts = isCountingProducts
            }.ToString());

            return(command);
        }
示例#22
0
 public ClientProductProjectionSearchProvider(IClient client, SearchProductProjectionsCommand command)
 {
     this.client  = client;
     this.Command = command;
 }
示例#23
0
 public ClientQueryableCollection(IClient client, SearchProductProjectionsCommand command)
 {
     this.Provider   = new ClientProductProjectionSearchProvider(client, command);
     this.Expression = Expression.Constant(this);
 }