Custom Index Field in Umbraco
So I looked into the Umbraco API, and worked it out. If you knew Examine, you can ignore this part, and jump to the solution straightaway. Otherwise, I want to give you a little intro to what is Examine.
Faceted search is a technique for accessing information organized according to a faceted classification system, allowing users to explore a collection of information by applying multiple filters (Cited by Wikipedia). There are lots of resources about the great feature in Sitecore 7, however few of them is actually explain how it can be implement in terms of coding. This article is intended to use a simple example to explain how it works in Sitecore 7.
As per the concept above, let's take an example, saying you have a car sale website, one of the categories of a car will be body type i.e.Sedan, Hachback. Also, there are 100 cars that body type is Sedan, and 200 are hatchback.
The below query is to search cars that made before 2013, and set facets for BodyType, Color, and Transmission.
Based on the above query, the Facets category values will be the actual BodyType, Color, and Transmission, the aggregate will be the number of cars under that category. For instance, Category is BodyType, Category.Values is Sedan, Category.Values.aggregate is 100.