lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vijay Sekhri (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (SOLR-5743) Faceting with BlockJoin support
Date Fri, 15 Jan 2016 15:38:39 GMT

    [ https://issues.apache.org/jira/browse/SOLR-5743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15098859#comment-15098859
] 

Vijay Sekhri edited comment on SOLR-5743 at 1/15/16 3:37 PM:
-------------------------------------------------------------

Hi Mikhail, Dr. Oleg
The requirement to use this feature is to have ToParentBlockJoinQuery like 
{code} q={!parent which=<allParents>}<someChildren> {code}
To use the ParentBlockJoinQuery it needs to search on fields present in child document. In
real world your parent document would have most of the common fields and child document would
have only the different fields. For example just like BRAND_s, there will be fields like description_s,
name_s, title_s, partnumber_s, etc. in the parent document only. As they are same for all
the child documents , one would not repeat them in the child document, rather only keep them
in the parent document only. In the child document , we would have attributes like COLOR_s,
SIZE_s as the differ. 

Now for any real searches , one would search for fields like BRAND_s, description_s, name_s,
title_s, partnumber_s, etc to return appropriate documents.  However , those fields are only
present in parent docs. 

So searching them like
{code} q={!parent which=type_s:parent}BRAND_s:Nike&facet=true&child.facet.field=COLOR_s
{code} 

does not work because search on BRAND_s:Nike is present in parent document .  It gives this
error also
child query must only match non-parent docs, but parent docID=2 matched childScorer=class
org.apache.lucene.search.TermScorer

One could search on fields from child like this without any problem.
{code} q={!parent%20which=type_s:parent}COLOR_s:Blue&facet=true&child.facet.field=COLOR_s
{code}

To use this feature do we have to copy all the common fields ( and thousands of such fields
alike ) back into the child (repeating them for every child) and search on those fields ?
For example copying brand_s field like this 
{code}
[{
 "id": 10,
 "type_s": "parent",
 "BRAND_s": "Nike",
 "_childDocuments_": [{
   "id": 11,
   "COLOR_s": "Red",
   "SIZE_s": "XL",
   "BRAND_s": "Nike",
 }, 
 {
 "id": 12,
 "COLOR_s": "Blue",
 "SIZE_s": "XL",
 "BRAND_s": "Nike",
 }]
}]
{code}

This way the query works 
{code}
q={!parent which=type_s:parent}BRAND_s:Nike&facet=true&child.facet.field=COLOR_s
{code}

Or there is some other way where we can still use the facets on the child fields (SIZE_s)
,  aggregate the counts on the parent docs (id:10) and still search on the common fields from
parent docs (BRAND_s) ?



was (Author: sekhrivijay):
Hi Mikhail, Dr. Oleg
The requirement to use this feature is to have ToParentBlockJoinQuery like  q={!parent which=<allParents>}<someChildren>.

To use the ParentBlockJoinQuery it needs to search on fields present in child document. In
real world your parent document would have most of the common fields and child document would
have only the different fields. For example just like BRAND_s, there will be fields like description_s,
name_s, title_s, partnumber_s, etc. in the parent document only. As they are same for all
the child documents , one would not repeat them in the child document, rather only keep them
in the parent document only. In the child document , we would have attributes like COLOR_s,
SIZE_s as the differ. 

Now for any real searches , one would search for fields like BRAND_s, description_s, name_s,
title_s, partnumber_s, etc to return appropriate documents.  However , those fields are only
present in parent docs. 

So searching them like q={!parent which=type_s:parent}BRAND_s:Nike&facet=true&child.facet.field=COLOR_s
does not work because search on BRAND_s:Nike is present in parent document .  It gives this
error also
child query must only match non-parent docs, but parent docID=2 matched childScorer=class
org.apache.lucene.search.TermScorer

One could search on fields from child like this without any problem.
q={!parent%20which=type_s:parent}COLOR_s:Blue&facet=true&child.facet.field=COLOR_s

To use this feature do we have to copy all the common fields ( and thousands of such fields
alike ) back into the child (repeating them for every child) and search on those fields ?
For example copying brand_s field like this 

[{
 "id": 10,
 "type_s": "parent",
 "BRAND_s": "Nike",
 "_childDocuments_": [{
   "id": 11,
   "COLOR_s": "Red",
   "SIZE_s": "XL",
   "BRAND_s": "Nike",
 }, 
 {
 "id": 12,
 "COLOR_s": "Blue",
 "SIZE_s": "XL",
 "BRAND_s": "Nike",
 }]
}]

This way the query works 
q={!parent which=type_s:parent}BRAND_s:Nike&facet=true&child.facet.field=COLOR_s


Or there is some other way where we can still use the facets on the child fields (SIZE_s)
,  aggregate the counts on the parent docs (id:10) and still search on the common fields from
parent docs (BRAND_s) ?


> Faceting with BlockJoin support
> -------------------------------
>
>                 Key: SOLR-5743
>                 URL: https://issues.apache.org/jira/browse/SOLR-5743
>             Project: Solr
>          Issue Type: New Feature
>          Components: faceting
>            Reporter: abipc
>            Assignee: Mikhail Khludnev
>              Labels: features
>             Fix For: 5.5
>
>         Attachments: SOLR-5743.patch, SOLR-5743.patch, SOLR-5743.patch, SOLR-5743.patch,
SOLR-5743.patch, SOLR-5743.patch, SOLR-5743.patch, SOLR-5743.patch, SOLR-5743.patch, SOLR-5743.patch,
SOLR-5743.patch, SOLR-5743.patch, SOLR-5743.patch, SOLR-5743.patch, SOLR-5743.patch
>
>
> For a sample inventory(note - nested documents) like this -   
>  <doc>
> <field name="id">10</field>
> <field name="type_s">parent</field>
> <field name="BRAND_s">Nike</field>
> <doc>
> <field name="id">11</field>
> <field name="COLOR_s">Red</field>
> <field name="SIZE_s">XL</field>
> </doc>
> <doc>
> <field name="id">12</field>
> <field name="COLOR_s">Blue</field>
> <field name="SIZE_s">XL</field>
> </doc>
> </doc>
> Faceting results must contain - 
> Red(1)
> XL(1) 
> Blue(1) 
> for a "q=*" query. 
> PS : The inventory example has been taken from this blog - http://blog.griddynamics.com/2013/09/solr-block-join-support.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message