public static List <List <FacetReturn> > GetFacets(List <SearchStringModel> _searchQuery)
        {
            var ret    = new List <List <FacetReturn> >();
            var facets = Context.ContentDatabase.GetItem(Constants.FacetFolder).Children;

            foreach (Item facet in facets)
            {
                if (facet.Fields["Enabled"].Value == "1")
                {
                    dynamic type = Activator.CreateInstance(Type.GetType(facet.Fields["Type"].Value));
                    if ((type as IFacet).IsNotNull())
                    {
                        var locationOverride = GetLocationOverride(_searchQuery);
                        using (var context = new SortableIndexSearchContext(SearchManager.GetIndex(BucketManager.GetContextIndex(Context.ContentDatabase.GetItem(locationOverride)))))
                        {
                            var query          = SearchHelper.GetBaseQuery(_searchQuery, locationOverride);
                            var queryBase      = IndexSearcher.ContructQuery(query);
                            var searchBitArray = new QueryFilter(queryBase).Bits(context.Searcher.GetIndexReader());
                            var res            = ((IFacet)type).Filter(queryBase, _searchQuery, locationOverride, searchBitArray);
                            ret.Add(res);
                        }
                    }
                }
            }

            return(ret);
        }
        private List <List <FacetReturn> > GetFacets()
        {
            var ret    = new List <List <FacetReturn> >();
            var facets = Context.ContentDatabase.GetItem(Constants.FacetFolder).Children;

            foreach (Item facet in facets)
            {
                if (facet.Fields["Enabled"].Value == "1")
                {
                    // pull the type off of the Sitecore item
                    string typeName = facet.Fields["Type"].Value;
                    object type     = Sitecore.Reflection.ReflectionUtil.CreateObject(typeName);

                    // pull any parameters out of the Sitecore item
                    string typeParameters = facet.Fields["Parameters"].Value;
                    if (!string.IsNullOrEmpty(typeParameters))
                    {
                        Sitecore.Reflection.ReflectionUtil.SetProperties(type, typeParameters);
                    }

                    if ((type as IFacet).IsNotNull())
                    {
                        var locationOverride = GetLocationOverride();
                        using (var context = new SortableIndexSearchContext(SearchManager.GetIndex(BucketManager.GetContextIndex(Context.ContentDatabase.GetItem(locationOverride)))))
                        {
                            var query          = SearchHelper.GetBaseQuery(this._searchQuery, locationOverride);
                            var queryBase      = IndexSearcher.ContructQuery(query);
                            var searchBitArray = new QueryFilter(queryBase).Bits(context.Searcher.GetIndexReader());
                            var res            = ((IFacet)type).Filter(queryBase, this._searchQuery, locationOverride, searchBitArray);
                            ret.Add(res);
                        }
                    }
                }
            }

            return(ret);
        }