Looks like you are considering hierarchical facet of some sort.
Haven't looked at it in a while, but if you decide to go that way you
may open up a can of worms..

I would reconsider the datastructure first to see if that is really needed.

You could perhaps solve this with:

<field name="group" type="string" indexed="true" stored="true"
multiValued="true"/>

<field name="bucket" type="string" indexed="true" stored="true"
multiValued="true"/>

Then you get 2 facets, bucket and group when you search. Buckets will
not be grouped though..

Regards,
Ingar


On Wed, Sep 26, 2012 at 12:23 PM,  <johannes.schwendin...@blum.com> wrote:
> I think what you need is facetting, or is this another thing?
> http://searchhub.org/dev/2009/09/02/faceted-search-with-solr/
>
> Peter Kirk <p...@alpha-solutions.dk> schrieb am 26.09.2012 12:18:32:
>
>> Von:
>>
>> Peter Kirk <p...@alpha-solutions.dk>
>>
>> An:
>>
>> "solr-user@lucene.apache.org" <solr-user@lucene.apache.org>
>>
>> Datum:
>>
>> 26.09.2012 12:19
>>
>> Betreff:
>>
>> RE: Group.query
>>
>> Thanks. Yes I can do this - but doesn't it mean I need to execute a
>> query per group?
>>
>> What I really want to do (and I'm sorry I'm not so good at
>> explaining) is to execute one query for products, and receive
>> results grouped by the groups - but where a particular product may
>> be found in several groups.
>>
>> For example, I'd like to execute a query for all products which
>> match "bucket".
>> There are several products which are "buckets", each of which can
>> belong to several groups.
>> Would it be possible to generate a query which would return the
>> groups, each with a list of the buckets?
>>
>> Example result, with 3 groups, and several products (which may occur
>> in several groups).
>>
>> Children_sand_toys
>>   Castle bucket
>>   Plain bucket
>>
>> Boys_toys
>>   Castle bucket
>>   Truck bucket
>>
>> Girls_toys
>>   Castle bucket
>>   Large Pony bucket
>>
>> Thanks,
>> Peter
>>
>> -----Original Message-----
>> From: Ingar Hov [mailto:ingar....@gmail.com]
>> Sent: 26. september 2012 11:57
>> To: solr-user@lucene.apache.org
>> Subject: Re: Group.query
>>
>> I hope I understood the question, if so this may be a solution:
>>
>> Why don't you make the field group for product multiple?
>>
>> Example:
>>
>> <field name="group" type="string" indexed="true" stored="true"
>> multiValued="true"/>
>>
>> If the product is a member of group1 and group2, just add both for
>> the product document so that each product has an array of group.
>> Then you can easily get all products for group1 by doing query:
> group:group1
>>
>> Regards,
>> Ingar
>>
>>
>>
>> On Wed, Sep 26, 2012 at 10:48 AM, Peter Kirk <p...@alpha-solutions.dk>
> wrote:
>> > Thanks. Yes, the only solution I could think of was to execute
>> several queries.
>> > I would like it to be a single query if at all possible. If anyone
>> has ideas I could look into that would be great.
>> > Thanks,
>> > Peter
>> >
>> >
>> > -----Original Message-----
>> > From: Aditya [mailto:findbestopensou...@gmail.com]
>> > Sent: 26. september 2012 10:41
>> > To: solr-user@lucene.apache.org
>> > Subject: Re: Group.query
>> >
>> > Hi
>> >
>> > You are doing AND search, so you are getting results prod1 and
>> prod2. I guess, you should query only for group1 and another query for
> group2.
>> >
>> > Regards
>> > Aditya
>> > www.findbestopensource.com
>> >
>> >
>> >
>> > On Wed, Sep 26, 2012 at 12:26 PM, Peter Kirk <p...@alpha-solutions.dk>
> wrote:
>> >
>> >> Hi
>> >>
>> >> I have "products" which belong to one or more "groups".
>> >> Products are documents in Solr, while the groups are fields (eg.
>> >> group_1_bool:true).
>> >>
>> >> For example:
>> >>
>> >> Prod1 => group1, group2
>> >> Prod2 => group1, group2
>> >> Prod3 => group1
>> >> Prod4 => group2
>> >>
>> >> I would like to execute a query which results in the groups with
>> >> their products. That is, the result should be something like:
>> >>
>> >> Group1 => Prod1, Prod2, Prod3
>> >> Group2 => Prod1, Prod2, Prod4
>> >>
>> >> How can I do this?
>> >>
>> >> I've been looking at group.query, but I don't think this is what I
> want.
>> >>
>> >> For example,
> "q=*:*&group.query=group_1_bool:true+AND+group_2_bool:true"
>> >> Results in 1 group called "group_1_bool:true AND group_2_bool:true",
>> >> which contains prod1 and prod2.
>> >>
>> >>
>> >> Thanks,
>> >> Peter
>> >>
>> >>
>> >
>>
>>

Reply via email to