Filtering group query results

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

Filtering group query results

Greenhorn Techie
Hi,

We have a requirement where we need to perform a group query in Solr where
results are grouped by user-name (which is a field in our indexes) . We
then need to filter the results based on numFound response parameter
present under each group. In essence, we want to return results only where
numFound=1.

Looking into the documentation, I couldn’t figure out any mechanism to
achieve this. So wondering if there is a possibility to achieve this
requirement with the existing building blocks of Solr query mechanism.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Filtering group query results

Shawn Heisey-2
On 10/4/2018 7:10 AM, Greenhorn Techie wrote:
> We have a requirement where we need to perform a group query in Solr where
> results are grouped by user-name (which is a field in our indexes) . We
> then need to filter the results based on numFound response parameter
> present under each group. In essence, we want to return results only where
> numFound=1.

I don't think this is possible in Solr.  I'm reasonably sure that the
document count isn't calculated until after all the querying and
filtering is done.

It would be easy enough to do on the client side -- just skip over any
group where the number of results is not what you're looking for.

I've got no idea how difficult it would be to write this kind of
capability into the server side.  Off hand I would guess that it's
probably not super difficult for someone who already knows that part of
the code.  I don't know that code, so I'd be spending a lot of time
learning it before I could make a change.

Thanks,
Shawn