Hello everyone, I'm trying to use Lucene in a webproject to search for products. The problem is that I have to display the search results grouped by category. There are about 500.000 products and every product belongs to a category. There are 150 categories. Now for every search I would like to display the result like this:
Matches where found in category A and B: Category A (500 matches) - < a list of the 10 best matches in this category > Category B (12 matches) - < a list of the 10 best matches in this category > So I'm trying to figure out the best way to accomplish this? I would like to avoid iterating over all matching products to find their categories (There can be about 50.000). Is it reasonable to the search on all categories first and then apply a filter for each category (150 filters)? How fast are filters? or would it be better to have a separate index for each category? or maybe iterate over all the matching product and store them in a hashmap with category as key? Thanks, William