public static IEnumerable<Facet> facetSearch(Query query, IEnumerable<Facet> facets)
{
List<Facet> l = new List<Facet>();
foreach (Facet f in facets)
{
Facet c = new Facet();
c.Name = f.Name;
c.Text = f.Text;
c.Value = f.Value;
c.DisplayName = f.DisplayName;
c.Childrens = new List<Facet>();
SimpleFacetedSearch sfs = new SimpleFacetedSearch(_Reader, new string[] { "facet_" + f.Name });
SimpleFacetedSearch.Hits hits = sfs.Search(query);
int cCount = 0;
foreach (SimpleFacetedSearch.HitsPerFacet hpg in hits.HitsPerFacet)
{
if (!hpg.Name.ToString().Equals(""))
{
Facet cc = new Facet();
cc.Name = hpg.Name.ToString();
cc.Text = hpg.Name.ToString();
cc.Value = hpg.Name.ToString();
cc.Count = (int)hpg.HitCount;
if (cc.Count > 0) cCount++;
c.Childrens.Add(cc);
}
}
c.Count = cCount;
l.Add(c);
}
return l;
}