Group by and filtering on child documents.

2019-06-04 Thread Jai Jamba
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.


Re: Group by and filtering on child documents.

2019-06-04 Thread Jai Jamba
Hello Mikhail,

I am sorry, I forgot to include below in my main query json (*"fields": "*
[child limit=-1]"*) . 
I am extracting all the fields along with its nested docs. 
So I want as a part of results and not part of facet. I would expect out of
the docs that i listed, it should return only

"id": "3", "scope": "product", "category": "clothes", 
"product_type": "jeans", "brand": "Levi’s", 
"_childDocuments_": [ 
{ "id": "32", "scope": "sku", "color": "black", "size": "L", "price" : 45 }
]





--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Group by and filtering on child documents.

2019-06-05 Thread Jai Jamba
Can you help me with the subquery way, i tried that long back but it was
giving me some exception (can't remember that).



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Streaming expression function which can give parent document along with its child documents ?

2019-06-06 Thread Jai Jamba
Hi,
I was wondering if there is any way in streaming expression which can return
parent document along with its child documents just like we have child
document transformer, i.e. ** [child limit=-1]* which returns child document
as well of the parent document

-
Jai



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Streaming expression function which can give parent document along with its child documents ?

2019-06-10 Thread Jai Jamba
Can anyone help me in this ?



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html