lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Kirk ...@alpha-solutions.dk>
Subject RE: Group.query
Date Wed, 26 Sep 2012 10:18:32 GMT
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.hov@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 <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