public SearchContextBuilder(FacetValueValidator facetValueValidator, ISortOptionRepository sortOptionRepository,
                             ILogService log)
 {
     _facetValueValidator  = facetValueValidator;
     _sortOptionRepository = sortOptionRepository;
     _log = log;
 }
Example #2
0
        public FacetValuesAspect(string key, IEnumerable <string> value, FacetValueValidator facetValueValidator)
        {
            _facetValueValidator = facetValueValidator;

            Key   = key;
            Value = value ?? Enumerable.Empty <string>();
        }
Example #3
0
        public FacetValuesAspect(string key, string serializedValue, FacetValueValidator facetValueValidator)
        {
            _facetValueValidator = facetValueValidator;

            Key = key;
            Set(serializedValue);
        }
        private static ISearchAspect <IEnumerable <string> > ExcludedFacets(Item dataSource, FacetValueValidator facetValueValidator)
        {
            var value  = dataSource.GetListFieldValueItems(DSP.Foundation.SitecoreTemplates.Query_Tags_Excluded.QueryTagsExcluded.FieldName);
            var values = value.Select(item => item.ID.ToShortID().ToString());

            return(new FacetValuesAspect(Constants.SearchContext.Keys.ExcludedFacets, values, facetValueValidator));
        }
        private static ISearchAspect <IEnumerable <string> > Facets(Item dataSource, Item currentPage, FacetValueValidator facetValueValidator)
        {
            var value = dataSource.GetListFieldValueItems(DSP.Foundation.SitecoreTemplates.Query_Tags.QueryTags.FieldName);

            if (value == null || !value.Any())
            {
                // if Query Tags were not specified then use the current page as a source for Tags
                value = currentPage.GetListFieldValueItems(DSP.Foundation.SitecoreTemplates.Has_Tags.ContentTags.FieldName);
            }

            if (value == null)
            {
                value = new Item[0];
            }

            var values = value.Select(item => item.ID.ToShortID().ToString());

            return(new FacetValuesAspect(Constants.SearchContext.Keys.Facets, values, facetValueValidator));
        }