Hello,

In our collection there are some documents which have same value for different 
fields while other have different values. i.e. For document1: status="xyz" and 
poi="draft", For document2: status="xyz" and poi="draft", For document3: 
status="abc" and poi="information". We have created facet query to search 
through all documents to get distinct count for documents where status="xyz" 
with poi="draft". Following query used to get count from solr:

json.facet={workspace:{type:terms,field:workspace,limit:100, 
facet:{x:"unique(doc_id)"},facet:{status:{type:terms,field:status,limit:-1, 
facet:{x:"unique(doc_id)"},facet:{poi:{type:terms,field:poi,limit:-1,facet:{x:"unique(doc_id)"}}}}}}}

Response from solr as below:

"facets":{
    "count":4,
    "workspace":{
      "buckets":[{
          "val":161650,
          "count":4,
          "status":{
            "buckets":[{
                "val":3,
                "count":4,
                "poi":{
                  "buckets":[{
                      "val":0,
                      "count":4,
                      "x":2}]}}]}}]}}}

Here we get unique document count for poi only. It not works for workspace and 
status field.

How can we apply unique function with multiple level of facet to get unique 
count in each level.

Regards,
Jay Harkhani.

Reply via email to