For the project I'm working on now it is important to group the results
of a query by a "product" field. Documents
belong to only one product and there will never be more than 10
different products alltogether.
When searching through the archives I identified 3 options:
1) [[Client-side XSLT]]
2) Faceting and querying all possible product facets
3) Field collapsing on product field (SOLR-236)
Option 1 is not feasable.
Option 2 would be possible, but 10 queries for every single initial
query is not really a good idea either.
Option 3 seems like the best option as far as I undestand it but it only
exists as a patch.
Is it possible to use faceting to not only get the facet count but also
the top-n documents for every facet
directly? If not, how hard would it be to implement this as an extension?
If its not possible at all, would field collapsing really be a solution
here and can it somehow be used
: Is it possible to use faceting to not only get the facet count but also the
: top-n documents for every facet
: directly? If not, how hard would it be to implement this as an extension?
not hard ... a custom request handler could subclass
StandardRequestHandler, call super.handleRequest, and then pull the field
faceting info out of the response object, and fetch a DocList for each of
the top N field constraints.