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 "Aswath Srinivasan (TMS)" <as...@toyota.com> on 2016/10/06 23:33:08 UTC
Count on Multivalued field using facet
Hello,
I'm having a result set something like this, and query like below. The facet count for Line field is 1(1). That is, value Line's value 1 has numBucket = 1.
However, I need to count the number of occurrence of each of the values in the LINE field. Is there a way to do this?
Expecting something like, LINE 1(10), 2(2)
http://localhost:8983/solr/collection/select?facet.field=line&facet=on&fq=id:123456789&indent=on&q=*:*&wt=json
{
"responseHeader":{
"status":0,
"QTime":25,
"params":{
"q":"*:*",
"facet.field":"line",
"indent":"on",
"fq":"id:123456789",
"facet":"on",
"wt":"json",
"_":"1475711557126"}},
"response":{"numFound":1,"start":0,"docs":[
{
"id":"123456789",
" name":["abc"],
"year":["2016"],
"idno":[6009250200],
"issue":["Paint",
"zTest",
"zTest",
"Paint",
"zTest",
"zTest",
"zTest",
"Paint",
"Paint",
"Paint",
"Paint",
"Paint"],
"line":["1",
"1",
"1",
"2",
"1",
"1",
"1",
"1",
"2",
"1",
"1",
"1"],
"_version_":1547467907197304832}]
},
"facet_counts":{
"facet_queries":{},
"facet_fields":{
"line":[
"1",1]
"2",1]
},
"facet_ranges":{},
"facet_intervals":{},
"facet_heatmaps":{}}}
Thank you,
Aswath NS