Last active
August 3, 2016 18:48
-
-
Save soen/445c20ce1c27b054682bdd60194d8b95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext()) | |
{ | |
var facets = new FacetResults(); | |
facets = context.GetQueryable<SearchResultItem>() | |
.FacetOn(x => x.Language) | |
.GetFacets(); | |
foreach (var facetCategories in facets.Categories) | |
{ | |
foreach (var facet in facetCategories.Values) | |
{ | |
// The name of the language, i.e. EN, UK or DK | |
var facetName = facet.Name; | |
// The total amount of items for given language | |
var facetAggregateCount = facet.AggregateCount; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment