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 Rajesh Kumar <ra...@gmail.com> on 2018/08/10 17:21:00 UTC
Faceting with nested Document
Hi All,
I am trying to do faceting with "tag and exclude" on nested document
Below nested document sample
{"master_id":"8219",
"color_label":["White"],
"price":1550.0,
"product_id":"8220",
"size_label":["XS"],
"color_option_id":["82"],
"product":"PomPom Summer Dress",
"child_sku":"VJ17MSCL02MAY-XS",
"size_option_id":["94"],}
{
"title":"PomPom Summer Dress",
"color_label":["White"],
"price":1550.0,
"product_id":"8219",
"color_option_id":["82"],
"product":"PomPom Summer Dress",
"master_sku":"VJ17MSCL02MAY",
"master_id":"0",}
My objective is to get count of products for the field like
color_label,size_label then filter query on these fields.Below is the query
which i m using to get products with size label "L" with faceting
query?q=title:pant&fq={!tag=label}size_label:L&fl=size_label,color_label,id,[child
parentFilter=master_id:0]&
json.facet={
size_label :
{type: terms,
field: size_label,
domain: { blockChildren:"master_id:0",excludeTags:label}
}
}
"response":{"numFound":0,"start":0,"docs":[]
},
"facets":{
"count":0,
"size_label":{
"buckets":[{
"val":"L",
"count":39},
{
"val":"M",
"count":39},
{
"val":"XS",
"count":30},
{
"val":"XXL",
"count":30}]}}}
here is no product in response (numFound=0) but still getting "facets"
node. Please help me to understand where i am doing wrong
Regards
Rajesh Kumar
Re: Faceting with nested Document
Posted by Mikhail Khludnev <mk...@apache.org>.
The first two mistakes are:
- using fq for children fields ,
- using a value master_id:0 as a parents' filter
Regarding the question, you are getting non-zero facets because you exclude
filter produces empty results.