Get one document from each category

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

Get one document from each category

Tomasz Kępski
Hi,

I have the following case:

In my index I do have documents categorized (category_id - int sortable
field). I would like to get three top documents matching user query BUT
each have to be from different category.:

for example from returned set (doc_id : category id):

1:1
2:1
3:1
4:2
5:1
6:2
7:3
8:4

I would like to get docs 1, 4 and 7.
Is that possible without quering 3 times? Often lot of (more than my
limit) the docs at the beginning are from the same category.
I'm using PHP Apache Solr so I would like to avoid processing large sets
of data in my PHP based application.

Tomek
Reply | Threaded
Open this post in threaded view
|

Re: Get one document from each category

Andrew Klochkov
This post was updated on .
CONTENTS DELETED
The author has deleted this message.