问题
Say I have the given document structure in RavenDb
public class Car {
public string Manufacturer {get;set;}
public int BuildYear {get;set;}
public string Colour {get;set;}
public string Id {get;set;}
}
When the user searches for all cars of colour Red and build year 2010, I want to show them a grouping for manufacturer as such:
Toyota (12)
Mazda (30)
Given there are 12 toyotas and 30 mazdas that are red in colour and build year 2010.
This is a simplified use case. The user can really specify tons of criteria for the cars they want to match. Once I have a list of cars matching that criteria then I need to group that result set on every feature and show a count. Its like a MapReduce but on a subset of data.
回答1:
Afif, what you mean is called a faceted search. Thanks to the underlying Lucene.NET component RavenDB is very good at that. Take a look here: http://ravendb.net/documentation/faceted-search
来源:https://stackoverflow.com/questions/7843739/ravendb-mapreduce-over-subset-of-data