Hi All,
We are facing the following issue where Json Facet with excludeTag doesn't
return any results when numFound=0, even though excluding the filter will
result in matching few docs. (Note: excludeTag works when numFound is > 0)
We are using Solr 5.4.1
For eg.
If we have the following data in Solr
acct_s,group_id_s,amt_td
A1, G1,100
A2, G1, 200
A3,G2,100
A4,G3, 100
and we make a solr query as follows
q=*:*={!tag='AMOUNT' }amt_td:[201 TO *]&
={
exCounts:{type:terms, field:group_id_s,limit=-1,
domain:{excludeTags:AMOUNT} },
}
Result is numfound=0 and facet:[]
but clearly excluding the 'AMOUNT' filter will match all the documents.
This issue is not there in the normal facet module
eg.
q=*:*={!tag='AMOUNT' }amt_td:[201 TO
*]=true={!ex=AMOUNT}group_id_s=-1
will return numFound=0
facet_counts:{
facet_fields:{
group_id_s:[
G1,2
G2,1
G3,1
]
}
}
This issue shows up in a different form when we have our data distributed
on multiple shards in cloud mode.
Eg.
If the data is distributed as follows
Shard1 on node 1:
acct_s,group_id_s,amt_td
A1, G1,100
A3,G2,100
Shard2 on node2:
acct_s,group_id_s,amt_td
A2, G1, 200
A4,G3, 100
When we run the following query
Note: below fq will match one document
q=*:*={!tag='AMOUNT' }amt_td:[101 TO *]&
={
exCounts:{type:terms, field:group_id_s, limit=-1,
domain:{excludeTags:AMOUNT} },
}
Will give
numFound=1
facets:{
exCounts:{
buckets:[{
val:G1, count:1
},{
val:G3, count:1
}]
}
}
We can clearly see that the counts of the groups are not as we would
expect. Thats because in Shard1 the above query has no matching docs so
json facet dint return any results from that shard. But Shard2 has one
matching doc and so the json facet module return some result.
Is this a bug? or this is the way the new json facet module is implemented.
Has anyone else faced something similar? did you find any work around for
this issue?
PS: We are using jsonFacet because of its performance benefits.