Single query to get the count for all individual collections

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

Single query to get the count for all individual collections

Zheng Lin Edwin Yeo
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
Reply | Threaded
Open this post in threaded view
|

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

Jan Høydahl / Cominvent
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 <[hidden email]>:
>
> 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

Reply | Threaded
Open this post in threaded view
|

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

Hullegård, Jimi
In reply to this post by Zheng Lin Edwin Yeo
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 <[hidden email]>
Skickat: den 10 januari 2019 10:41
Till: [hidden email]
Ä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>
Reply | Threaded
Open this post in threaded view
|

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

Zheng Lin Edwin Yeo
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 <
[hidden email]> 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 <[hidden email]>
> Skickat: den 10 januari 2019 10:41
> Till: [hidden email]
> Ä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
> >
>
Reply | Threaded
Open this post in threaded view
|

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

Jens Brandt
In reply to this post by Zheng Lin Edwin Yeo
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 <[hidden email]>:
>
> 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


signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Joel Bernstein
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 <[hidden email]> 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 <[hidden email]
> >:
> >
> > 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
>
>
Reply | Threaded
Open this post in threaded view
|

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

Jan Høydahl / Cominvent
+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 <[hidden email]>:
>
> 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 <[hidden email]> 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 <[hidden email]
>>> :
>>>
>>> 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
>>
>>