예제 #1
0
        public virtual List<SitecoreItem> GetItems(FieldValueSearchParam param)
        {
            var globalQuery = new CombinedQuery();

             ApplyLanguageClause(globalQuery, param.Language);
             if (!String.IsNullOrWhiteSpace(param.FullTextQuery))
             {
             ApplyFullTextClause(globalQuery, param.FullTextQuery);
             }
             ApplyRelationFilter(globalQuery, param.RelatedIds);
             ApplyTemplateFilter(globalQuery, param.TemplateIds);
             ApplyLocationFilter(globalQuery, param.LocationIds);
             ApplyRefinements(globalQuery, param.Refinements, param.Occurance);

             return RunQuery(globalQuery, param.ShowAllVersions);
        }
예제 #2
0
        protected override Item[] GetItems(Item current)
        {
            Assert.ArgumentNotNull(current, "current");

            //Split the source from the DataSource field
            var values = StringUtil.GetNameValues(Source, '=', '&');
            //Split the field FieldsFilter
            var refinements = new SafeDictionary<string>();
            if (values["FieldsFilter"] != null)
            {
                var splittedFields = StringUtil.GetNameValues(values["FieldsFilter"], ':', ',');

                foreach (string key in splittedFields.Keys)
                {
                    refinements.Add(key, splittedFields[key]);
                }
            }

            var searchParam = new FieldValueSearchParam
            {
                Refinements = refinements,
                //LocationIds = values["LocationFilter"],
                LocationIds = SelectedDropTreeValue,
                TemplateIds = values["TemplateFilter"],
                FullTextQuery = values["FullTextQuery"],
                Occurance = QueryOccurance.Must,
                ShowAllVersions = false,
                Language = values["Language"]
            };

            //Execute the search
            using (var searcher = new IndexSearcher("buckets"))
            {
                var items = searcher.GetItems(searchParam);
                return SearchHelper.GetItemListFromInformationCollection(items).ToArray();
            }
        }