You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by mark angelillo <li...@snooth.com> on 2007/09/20 03:44:04 UTC
Filter by Group
Hey all,
Let's say I have an index of one hundred documents, and these
documents are grouped into 4 groups A, B, C, and D. The groups do in
fact overlap. What would people recommend as the best way to apply a
search query and return only the documents that are in group A? Also,
how about if we run the same search query but return only those
documents in groups A, C and D?
I imagine that I could do this by indexing a text field populated
with the group names and adding something like "groups:A" to the
query but I'm wondering if there's a better solution.
Thanks in advance,
Mark
mark angelillo
snooth inc.
o: 646.723.4328
c: 484.437.9915
mark@snooth.com
snooth -- 1.7 million ratings and counting...
Re: Filter by Group
Posted by mark angelillo <li...@snooth.com>.
Thanks, Pieter. I'll go for that then.
Mark
On Sep 19, 2007, at 10:15 PM, Pieter Berkel wrote:
> Sounds like you're on the right track, if your groups overap (i.e. a
> document can be in group A and B), then you should ensure your
> "groups"
> field is multivalued.
>
> If you are searching for "foo" in documents contained in group "A",
> then it
> might be more efficient to use a filter query (fq) like:
>
> q=foo&fq=groups:A
>
> See the wiki page on common query parameters for more info:
> http://wiki.apache.org/solr/
> CommonQueryParameters#head-6522ef80f22d0e50d2f12ec487758577506d6002
>
> cheers,
> Piete
>
>
>
> On 20/09/2007, mark angelillo <li...@snooth.com> wrote:
>>
>> Hey all,
>>
>> Let's say I have an index of one hundred documents, and these
>> documents are grouped into 4 groups A, B, C, and D. The groups do in
>> fact overlap. What would people recommend as the best way to apply a
>> search query and return only the documents that are in group A? Also,
>> how about if we run the same search query but return only those
>> documents in groups A, C and D?
>>
>> I imagine that I could do this by indexing a text field populated
>> with the group names and adding something like "groups:A" to the
>> query but I'm wondering if there's a better solution.
>>
>> Thanks in advance,
>> Mark
>>
>> mark angelillo
>> snooth inc.
>> o: 646.723.4328
>> c: 484.437.9915
>> mark@snooth.com
>> snooth -- 1.7 million ratings and counting...
>>
>>
>>
mark angelillo
snooth inc.
o: 646.723.4328
c: 484.437.9915
mark@snooth.com
snooth -- 1.7 million ratings and counting...
Re: Filter by Group
Posted by Pieter Berkel <pi...@gmail.com>.
Sounds like you're on the right track, if your groups overap (i.e. a
document can be in group A and B), then you should ensure your "groups"
field is multivalued.
If you are searching for "foo" in documents contained in group "A", then it
might be more efficient to use a filter query (fq) like:
q=foo&fq=groups:A
See the wiki page on common query parameters for more info:
http://wiki.apache.org/solr/CommonQueryParameters#head-6522ef80f22d0e50d2f12ec487758577506d6002
cheers,
Piete
On 20/09/2007, mark angelillo <li...@snooth.com> wrote:
>
> Hey all,
>
> Let's say I have an index of one hundred documents, and these
> documents are grouped into 4 groups A, B, C, and D. The groups do in
> fact overlap. What would people recommend as the best way to apply a
> search query and return only the documents that are in group A? Also,
> how about if we run the same search query but return only those
> documents in groups A, C and D?
>
> I imagine that I could do this by indexing a text field populated
> with the group names and adding something like "groups:A" to the
> query but I'm wondering if there's a better solution.
>
> Thanks in advance,
> Mark
>
> mark angelillo
> snooth inc.
> o: 646.723.4328
> c: 484.437.9915
> mark@snooth.com
> snooth -- 1.7 million ratings and counting...
>
>
>