Grouping based on multiple criteria

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Grouping based on multiple criteria

Alan Woodward
Hi list,

I'd like to be able to present a list of results which are grouped on a single field, but then show various members of each group according to several different criteria.  So for example, for e-commerce search, we group at the top level by the vendor, but then show the most expensive item, least expensive item, most heavily discounted item, etc.

I can't find anything that would let me do this in the current grouping code.  I'm thinking I'd need to implement a form of TopFieldCollector that maintained multiple sort orders that could be used for the second pass collector, but there doesn't seem to be anywhere to plug that in easily.

Is there anything already out there that I'm missing, or do I have to do some actual work?  :-)

Thanks, Alan
Reply | Threaded
Open this post in threaded view
|

Re: Grouping based on multiple criteria

Marcio Ghiraldelli
I have a similar issue, and I am solving it by implementing my own
components and dealiing with the resultings doc IDs

public class MerchantShuffleComponent extends SearchComponent {
...
        ctx.docs = shuffledDocList;

        rb.rsp.getValues().remove("response");
        rb.rsp.add("response", ctx);
...

    <searchComponent name="merchant_shuffle_query"
class="solr.MerchantShuffleComponent" />

    <requestHandler name="/shuffle" class="solr.SearchHandler">
            <arr name="components">
            <str>query</str>
            <str>merchant_shuffle_query</str>
            <str>facet</str>
            <str>mlt</str>
            <str>highlight</str>
            <str>stats</str>
            <str>debug</str>
        </arr>

Atenciosamente,
Marcio Ghiraldelli


2012/10/30 Alan Woodward <[hidden email]>

> Hi list,
>
> I'd like to be able to present a list of results which are grouped on a
> single field, but then show various members of each group according to
> several different criteria.  So for example, for e-commerce search, we
> group at the top level by the vendor, but then show the most expensive
> item, least expensive item, most heavily discounted item, etc.
>
> I can't find anything that would let me do this in the current grouping
> code.  I'm thinking I'd need to implement a form of TopFieldCollector that
> maintained multiple sort orders that could be used for the second pass
> collector, but there doesn't seem to be anywhere to plug that in easily.
>
> Is there anything already out there that I'm missing, or do I have to do
> some actual work?  :-)
>
> Thanks, Alan