Re: Group by and filtering on child documents.

2019-06-06 Thread Mikhail Khludnev
On Wed, Jun 5, 2019 at 12:23 PM Jai Jamba 
wrote:

> Can you help me with the subquery way, i tried that long back but it was
> giving me some exception (can't remember that).
>

Well... me either.


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


-- 
Sincerely yours
Mikhail Khludnev


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


Re: Group by and filtering on child documents.

2019-06-05 Thread Mikhail Khludnev
Hello, Jai.

It seems like sort functionality needs to be developed for
https://lucene.apache.org/solr/guide/7_4/transforming-result-documents.html#child-childdoctransformerfactory
However, it might be already reachable via more comprehensive
https://lucene.apache.org/solr/guide/7_4/transforming-result-documents.html#subquery


On Wed, Jun 5, 2019 at 8:15 AM Jai Jamba 
wrote:

> 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
>


-- 
Sincerely yours
Mikhail Khludnev


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-04 Thread Mikhail Khludnev
Hello, Jai.

I'm not sure I understand. Where do you need that max child price, at
parent results or at the facet?

On Tue, Jun 4, 2019 at 11:12 AM Jai Jamba 
wrote:

> 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.
>


-- 
Sincerely yours
Mikhail Khludnev