protected virtual IList <IFilter> GetFilters(CategoryIndexedSearchCriteria criteria) { var result = new List <IFilter>(); if (!string.IsNullOrEmpty(criteria.Keyword)) { var parseResult = _searchPhraseParser.Parse(criteria.Keyword); criteria.Keyword = parseResult.Keyword; result.AddRange(parseResult.Filters); } if (criteria.ObjectIds != null) { result.Add(new IdsFilter { Values = criteria.ObjectIds }); } if (!string.IsNullOrEmpty(criteria.CatalogId)) { result.Add(FiltersHelper.CreateTermFilter("catalog", criteria.CatalogId.ToLowerInvariant())); } result.Add(FiltersHelper.CreateOutlineFilter(criteria)); var terms = criteria.GetTerms(); result.AddRange(terms.Select(term => FiltersHelper.CreateTermFilter(term.Key, term.Values))); return(result); }
protected virtual IList <IFilter> GetPermanentFilters(ProductIndexedSearchCriteria criteria) { var result = new List <IFilter>(); if (!string.IsNullOrEmpty(criteria.Keyword)) { var parseResult = _searchPhraseParser.Parse(criteria.Keyword); criteria.Keyword = parseResult.Keyword; result.AddRange(parseResult.Filters); } if (criteria.ObjectIds != null) { result.Add(new IdsFilter { Values = criteria.ObjectIds }); } if (!string.IsNullOrEmpty(criteria.CatalogId)) { result.Add(FiltersHelper.CreateTermFilter("catalog", criteria.CatalogId.ToLowerInvariant())); } result.Add(FiltersHelper.CreateOutlineFilter(criteria)); if (criteria.StartDateFrom.HasValue) { result.Add(FiltersHelper.CreateDateRangeFilter("startdate", criteria.StartDateFrom, criteria.StartDate, false, true)); } if (criteria.EndDate.HasValue) { result.Add(FiltersHelper.CreateDateRangeFilter("enddate", criteria.EndDate, null, false, false)); } if (!criteria.ClassTypes.IsNullOrEmpty()) { result.Add(FiltersHelper.CreateTermFilter("__type", criteria.ClassTypes)); } if (!criteria.WithHidden) { result.Add(FiltersHelper.CreateTermFilter("status", "visible")); } if (criteria.PriceRange != null) { var range = criteria.PriceRange; result.Add(FiltersHelper.CreatePriceRangeFilter(criteria.Currency, criteria.Pricelists, range.Lower, range.Upper, range.IncludeLower, range.IncludeUpper)); } if (criteria.GeoDistanceFilter != null) { result.Add(criteria.GeoDistanceFilter); } return(result); }