Tags down


Solr: How to get count of distinct elements

By : Jacinto Benavente
Date : October 16 2020, 06:10 AM
I wish this help you Use the unique facet function:
code :
curl http://localhost:8983/solr/collection/query -d '
  "skus_count" : "unique(skuNumbers)",

Share : facebook icon twitter icon

Solr: number of distinct elements in a field

By : punkblade
Date : March 29 2020, 07:55 AM
seems to work fine If you are looking for unique values in the fields. You can facet on the field name with the field type string, which will return all the unique values for the field (and the counts which may or may not be relevant to you).
The following patch @ https://issues.apache.org/jira/browse/SOLR-2242 will help you to get the count directly. If you can't use the patch, you would probably need to get all the values for the facet field and count by yourself.

Count distinct groups in distributed grouping in Solr

By : Nippers
Date : March 29 2020, 07:55 AM
Does that help Check SOLR-3316 and SOLR-3436.
May be an existing issue which is fixed.

Count distinct elements in a bag

By : sameh fayek
Date : March 29 2020, 07:55 AM
seems to work fine There are two approaches here
1) Using the Distinct builtin UDF (not the DISTINCT pig operator). Sorry, I don't have a code example and I don't know how it will perform.
code :
stores = FOREACH (GROUP transactions BY store) {
    uniqueVisitors = DISTINCT visitors;
        group AS store,
        COUNT(uniqueVisitors) AS visitors,
        SUM(revenue) AS revenue;

count distinct in solr without command line cURL

By : Shalini Chatterjee
Date : March 29 2020, 07:55 AM
seems to work fine As always - right after you make a post on SO you find the answer. If someone could still shed some light on maybe a better way for me to be doing this I would be very grateful - but this technically works as a direct URL:
code :
$url    = "http://localhost:8983/solr/asdf/select";
  $post   = "q=*:*&json.facet.x=\"unique(field)\"&rows=0&wt=json&indent=true";

Using count with group without distinct elements

By : user7340938
Date : March 29 2020, 07:55 AM
I hope this helps you . I have the following table: , Try this:
code :
select id1, id2, 
       (select count(*) from mytable as t2 where t1.id1 = t2.id1) "count"
from mytable as t1
Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk