lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ingar Hov <ingar....@gmail.com>
Subject Re: Group.query
Date Wed, 26 Sep 2012 09:57:01 GMT
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 <pk@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:findbestopensource@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 <pk@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
>>
>>
>

Mime
View raw message