Powerful filtering and faceting directly within the Examine fluent API.
This package requires Examine 1.1.0+.
Examine Facets integrates seamlessly with the Examine API. Read the Examine docs first.
Register the searcher
There are 2 facet engines available out of the box: Bobo Browse and Multi Facets. Both offer a similar choice of features and performance so it is really a matter of preference.
To perform facet queries the chosen facet engine's Searcher must be registered via ExamineManager. This requires only a few lines of configuration code.
if (_examineManager.TryGetIndex("CustomIndex", out IIndex index))
if (index is LuceneIndex luceneIndex)
var searcher = new BoboFacetSearcher(
Defining and querying facets is baked right into Examine's fluent API.
Begin a facet query by calling .Facet(string field) within a query, or filter results to a facet with a specific value by calling .Facet(string field, string values).
Further optional configuration – such as the minimum number of matches required for a facet to appear, or the maximum number of values to return – can also be configured configured through the fluent API.
_examineManager.TryGetSearcher("FacetSearcher", out ISearcher searcher);
var query = searcher.CreateQuery();
Facet searches behave the same as any other Examine search. To retreive information about facets there are some handy extension methods.
To get a list of all facets: results.GetFacets();
To get a list of values for a specific facet: results.GetFacet(string field);
To get the number of hits for a specific value: results.GetFacet(string field).GetHits(object value);