Hi,
I have a requirement whereupon I'd like to pull search results back and
split them up based on some keyword field. So for example, says there's
a field named 'category', I'd like to be able to have the results
displayed as such:
Search Results for Category A:
1,
2,
3,
Search Results for Category B:
1,
2,
3.
The two ways I can think to do this are:
1) A post-process of the results collecting the first x amount of hits
for each category.
2) Running a different search per category.
This is probably a long shot, but I was wondering if the search itself
has the means to filter out documents based on a limit of occurances of
a value for a given search field. So for example if there are 5
categories, and we only want to show 5 results per category, then the
maximum amount of hits returned would be 25. This is because the value
'Category A' for the field 'category' can only appear 5 times and so
forth. Can anyone think of a way to achieve this?
Thanks.
|