Personally, I'd send three requests for solr, one for each group.
&rows=1&fq=category:A ... and so on.
But that'd depend on how many groups you have.
One can always hack custom request handlers to do this sort of thing
all as a single request, but I'd guess it ain't that much slower to
just make 3 requests. And there are fancier solutions out there that
might fit as well, like the field collapsing patch.
Erik
On Sep 16, 2008, at 4:13 PM, ristretto.rb wrote:
Hello All,
I'm looking for a way to filter results by some ranking mechanism.
For example...
Suppose you have 30 docs in an index, and they are in groups of 10,
like this
A, 1
A, 2
:
A, 10
B, 1
B, 2
:
B, 10
C, 1
C, 2
:
C, 10
I would like to get 3 records back such that I get a single, "best",
result from each logical group.
So, if I searched with a term that would match all the docs in the
index, I could be certain to get
a doc with A in it, one with B in it and one with C in it.
The the moment, I have a solr index that has a category field, and the
index will have between 1 and 2 million results
when we are done indexing.
I'm going to spend some time today researching this. If anyone can
send me some advice, I would be grateful.
I've considered post processing the results, but I'm not sure if this
is the wisest plan. And, I don't know how I would accurate
result counts, to do pagination.
cheers