Use histogram facets with numerical and date fields to retrieve the number of documents whose field value falls within an interval. For example, in a search of products, use a histogram facet to retrieve the number of products whose price ranges from 0 to 100, 101 to 200, and so on.
Use the HistogramFacetFor method to request histogram facets for numerical and date fields. .
- The first parameter takes an expression which determines the field for which to build the histogram. For example, PublishDate.
- The second parameter requires an interval, either a numerical value or a value of the enum type DateInterval (located in the EPiServer.Find.Api.Facets namespace). This parameter is based on the field defined in the first parameter.
After the search is executed, extract histogram facets from the search results object using the method with the same name, HistogramFacetFor.