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 samarth s <sa...@gmail.com> on 2010/12/23 16:27:02 UTC

Total number of groups after collapsing

Hi,

I have been using collapsing in my application. I have a requirement of
finding the no of groups matching some filter criteria.
Something like a COUNT(DISTINCT columnName). The only solution I can
currently think of is using the query:

q=*:*&rows=Integer.MAX_VALUE&start=0&fl=score&collapse.field=abc&collapse.threshold=1&collapse.type=normal

I get the number of groups from 'numFound', but this seems like a bad
solution in terms of performance. Is there a cleaner way?

Thanks,
Samarth

Re: Total number of groups after collapsing

Posted by samarth s <sa...@gmail.com>.
Hi,

I figured out a better way of doing it. The following query would be a
better option:
q=*:*&start=2147483647&rows=0&collapse=true&collapse.field=abc&collapse.threshold=1

Thanks,
Samarth

On Thu, Dec 23, 2010 at 8:57 PM, samarth s <sa...@gmail.com>wrote:

> Hi,
>
> I have been using collapsing in my application. I have a requirement of
> finding the no of groups matching some filter criteria.
> Something like a COUNT(DISTINCT columnName). The only solution I can
> currently think of is using the query:
>
>
> q=*:*&rows=Integer.MAX_VALUE&start=0&fl=score&collapse.field=abc&collapse.threshold=1&collapse.type=normal
>
> I get the number of groups from 'numFound', but this seems like a bad
> solution in terms of performance. Is there a cleaner way?
>
> Thanks,
> Samarth
>