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 Zheng Lin Edwin Yeo <ed...@gmail.com> on 2019/01/10 03:40:40 UTC

Single query to get the count for all individual collections

Hi,

I would like to find out, is there any way that I can send a single query
to retrieve the numFound for all the individual collections?

I have tried with this query
http://localhost:8983/solr/collection1/select?q=*:*&collection=collection1,collection2
However, this query is doing the sum of all the collections, instead of
showing the count for each of the collection.

I am using Solr 7.5.0.

Regards,
Edwin

Re: Single query to get the count for all individual collections

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Thanks for the reply.

I have tried out on adding a new field to contains the collection id, and
use json facet query to get the count. This is working.

Regards,
Edwin

On Thu, 10 Jan 2019 at 23:33, Hullegård, Jimi <
jimi.hullegard@svensktnaringsliv.se> wrote:

> Unless someone else has a cleaver solution, maybe one option could be to
> add a new field that simply contains the collection id. Then you could do a
> facet query on that field to get the count per collection.
>
> /Jimi
>
> -----Ursprungligt meddelande-----
> Från: Zheng Lin Edwin Yeo <ed...@gmail.com>
> Skickat: den 10 januari 2019 10:41
> Till: solr-user@lucene.apache.org
> Ämne: Single query to get the count for all individual collections
>
> Hi,
>
> I would like to find out, is there any way that I can send a single query
> to retrieve the numFound for all the individual collections?
>
> I have tried with this query
>
> http://localhost:8983/solr/collection1/select?q=*:*&collection=collection1,collection2
> However, this query is doing the sum of all the collections, instead of
> showing the count for each of the collection.
>
> I am using Solr 7.5.0.
>
> Regards,
> Edwin
> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här
> kan du läsa mer om vår behandling och dina rättigheter, Integritetspolicy<
> https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&utm_medium=email
> >
>

SV: Single query to get the count for all individual collections

Posted by Hullegård, Jimi <ji...@svensktnaringsliv.se>.
Unless someone else has a cleaver solution, maybe one option could be to add a new field that simply contains the collection id. Then you could do a facet query on that field to get the count per collection.

/Jimi

-----Ursprungligt meddelande-----
Från: Zheng Lin Edwin Yeo <ed...@gmail.com>
Skickat: den 10 januari 2019 10:41
Till: solr-user@lucene.apache.org
Ämne: Single query to get the count for all individual collections

Hi,

I would like to find out, is there any way that I can send a single query to retrieve the numFound for all the individual collections?

I have tried with this query
http://localhost:8983/solr/collection1/select?q=*:*&collection=collection1,collection2
However, this query is doing the sum of all the collections, instead of showing the count for each of the collection.

I am using Solr 7.5.0.

Regards,
Edwin
Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan du läsa mer om vår behandling och dina rättigheter, Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email&utm_medium=email>

Re: Single query to get the count for all individual collections

Posted by Jan Høydahl <ja...@cominvent.com>.
Just to a series of cheap http://localhost:8983/solr/mycoll/select?q=*:*&rows=0 requests :)

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

> 10. jan. 2019 kl. 04:40 skrev Zheng Lin Edwin Yeo <ed...@gmail.com>:
> 
> Hi,
> 
> I would like to find out, is there any way that I can send a single query
> to retrieve the numFound for all the individual collections?
> 
> I have tried with this query
> http://localhost:8983/solr/collection1/select?q=*:*&collection=collection1,collection2
> However, this query is doing the sum of all the collections, instead of
> showing the count for each of the collection.
> 
> I am using Solr 7.5.0.
> 
> Regards,
> Edwin


Re: Single query to get the count for all individual collections

Posted by Jan Høydahl <ja...@cominvent.com>.
+1 for the most elegant solution so far :)

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

> 22. jan. 2019 kl. 03:15 skrev Joel Bernstein <jo...@gmail.com>:
> 
> Streaming Expressions can do this:
> 
> plist(stats(collection1, q="*:*", count(*)),
>        stats(collection2, q="*:*", count(*)),
>        stats(collection2, q="*:*", count(*)))
> 
> The plist function is a parallel list of expressions. It will spin each
> expression off in it's own thread and concatenate the results of each
> expression into a single result set.
> Here are the docs:
> https://lucene.apache.org/solr/guide/7_6/stream-source-reference.html#stats
> https://lucene.apache.org/solr/guide/7_6/stream-decorator-reference.html#plist
> 
> plist is quite new, but "list" has been around for a while if you have an
> older version of Solr
> 
> https://lucene.apache.org/solr/guide/7_6/stream-decorator-reference.html#list_expression
> 
> 
> 
> 
> 
> 
> 
> 
> Joel Bernstein
> http://joelsolr.blogspot.com/
> 
> 
> On Mon, Jan 21, 2019 at 12:53 PM Jens Brandt <br...@docoloc.de> wrote:
> 
>> Hi,
>> 
>> maybe adding &shards.info=true might help. In case of SolrCloud this
>> gives you numFound for each shard.
>> 
>> Regards,
>>  Jens
>> 
>>> Am 10.01.2019 um 04:40 schrieb Zheng Lin Edwin Yeo <edwinyeozl@gmail.com
>>> :
>>> 
>>> Hi,
>>> 
>>> I would like to find out, is there any way that I can send a single query
>>> to retrieve the numFound for all the individual collections?
>>> 
>>> I have tried with this query
>>> 
>> http://localhost:8983/solr/collection1/select?q=*:*&collection=collection1,collection2
>>> However, this query is doing the sum of all the collections, instead of
>>> showing the count for each of the collection.
>>> 
>>> I am using Solr 7.5.0.
>>> 
>>> Regards,
>>> Edwin
>> 
>> 


Re: Single query to get the count for all individual collections

Posted by Joel Bernstein <jo...@gmail.com>.
Streaming Expressions can do this:

plist(stats(collection1, q="*:*", count(*)),
        stats(collection2, q="*:*", count(*)),
        stats(collection2, q="*:*", count(*)))

The plist function is a parallel list of expressions. It will spin each
expression off in it's own thread and concatenate the results of each
expression into a single result set.
Here are the docs:
https://lucene.apache.org/solr/guide/7_6/stream-source-reference.html#stats
https://lucene.apache.org/solr/guide/7_6/stream-decorator-reference.html#plist

plist is quite new, but "list" has been around for a while if you have an
older version of Solr

https://lucene.apache.org/solr/guide/7_6/stream-decorator-reference.html#list_expression








Joel Bernstein
http://joelsolr.blogspot.com/


On Mon, Jan 21, 2019 at 12:53 PM Jens Brandt <br...@docoloc.de> wrote:

> Hi,
>
> maybe adding &shards.info=true might help. In case of SolrCloud this
> gives you numFound for each shard.
>
> Regards,
>   Jens
>
> > Am 10.01.2019 um 04:40 schrieb Zheng Lin Edwin Yeo <edwinyeozl@gmail.com
> >:
> >
> > Hi,
> >
> > I would like to find out, is there any way that I can send a single query
> > to retrieve the numFound for all the individual collections?
> >
> > I have tried with this query
> >
> http://localhost:8983/solr/collection1/select?q=*:*&collection=collection1,collection2
> > However, this query is doing the sum of all the collections, instead of
> > showing the count for each of the collection.
> >
> > I am using Solr 7.5.0.
> >
> > Regards,
> > Edwin
>
>

Re: Single query to get the count for all individual collections

Posted by Jens Brandt <br...@docoloc.de>.
Hi,

maybe adding &shards.info=true might help. In case of SolrCloud this gives you numFound for each shard.

Regards,
  Jens

> Am 10.01.2019 um 04:40 schrieb Zheng Lin Edwin Yeo <ed...@gmail.com>:
> 
> Hi,
> 
> I would like to find out, is there any way that I can send a single query
> to retrieve the numFound for all the individual collections?
> 
> I have tried with this query
> http://localhost:8983/solr/collection1/select?q=*:*&collection=collection1,collection2
> However, this query is doing the sum of all the collections, instead of
> showing the count for each of the collection.
> 
> I am using Solr 7.5.0.
> 
> Regards,
> Edwin