Hi,
Below is my document structure and underneath I have mentioned my multi
select facet query. I have one query related to filtering where I am not
sure how can I get the child documents having some field value equivalent
to maximum value of that field in the available child docs ("Price" field
for eg., need to get the child documents having maximum Price value, just
like grouping by price out of the resultant child docs and getting the
documents having maximum price value) ? What changes do I need to make in
"childquery" ?

Can anyone help me in this ?

*Document structure:*
[
  {
"id": "1", "scope": "product", "category": "clothes",
"product_type": "dress", "brand": "Calvin Klein",
"_childDocuments_": [
  { "id": "11", "scope": "sku", "color": "red", "size": "S", "price" : 5 },
  { "id": "12", "scope": "sku", "color": "red", "size": "M", "price" : 15 },
  { "id": "13", "scope": "sku", "color": "blue", "size": "M", "price" : 25
}
]
  },
  {
"id": "2", "scope": "product", "category": "clothes",
"product_type": "jeans", "brand": "Calvin Klein",
"_childDocuments_": [
  { "id": "21", "scope": "sku", "color": "blue", "size": "M", "price" : 25
},
  { "id": "22", "scope": "sku", "color": "blue", "size": "L", "price" : 35
}
]
  },
  {
"id": "3", "scope": "product", "category": "clothes",
"product_type": "jeans", "brand": "Levi’s",
"_childDocuments_": [
  { "id": "31", "scope": "sku", "color": "black", "size": "M", "price" : 25
},
  { "id": "32", "scope": "sku", "color": "black", "size": "L", "price" : 45
},
  { "id": "33", "scope": "sku", "color": "blue", "size": "L", "price" : 35
}
]
  }
]

*multi select facet query:*
{
"query": "{!parent tag=top filters=$child.fq which=scope:product
v=$childquery}",
"params": {
"childquery": "scope:sku",
"child.fq": ["{!tag=color}color:black", "{!tag=size}size:L"]
},
"filter": "{!tag=top}category:clothes",
"facet": {
"colors": {
"domain": {
"excludeTags": "top",
"filter": ["{!filters param=$child.fq excludeTags=color v=$childquery}",
"{!child of=scope:product filters=$fq}scope:product"]
},
"type": "terms",
"field": "color",
"limit": -1,
"facet": {
"productsCount": "uniqueBlock(_root_)"
}
},
"sizes": {
"domain": {
"excludeTags": "top",
"filter": ["{!filters param=$child.fq excludeTags=size v=$childquery}",
"{!child of=scope:product filters=$fq}scope:product"]
},
"type": "terms",
"field": "size",
"limit": -1,
"facet": {
"productsCount": "uniqueBlock(_root_)"
}
}
}
}




-
Jai.

Reply via email to