We are using UnifiedSearch in our solution and giving facets for SearchSection:
var q = SearchClient.Instance.UnifiedSearchFor(request.Query).TermsFacetFor(p => p.SearchSection);
Also there is a "filter" option to drill into specific search section:
q = q.FilterHits(sc => sc.SearchSection.Match(request.Term));
SearchSection facet is used as list of filters showing also total matching hits for that facet. The issue is for results.TotalMatching property. We have to show also "Show all (x)" facet together with totally matched hits. If user is not using filtering TotalMatching property contains number of hits for that particular query - which is fine and I can use this number showing "Show all" filter. When we need to filter by search section, facets returned as result contains correct number of matching hits, however I still need to render "Show All (x)" link that will show how much *was* TotalMatching hits for the query without filter.
What is the best practice to get this number? At the moment I'm caching from the search without any filter.
You can use FilterFacet for this. For an example see this link and look for the line ".FilterFacet("AllSections", x => ".
Great success. Sometimes it's hard to find the answer :)