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

Dr Oleg Savrasov commented on SOLR-5743:
----------------------------------------

I don't think that we need to introduce one more new special child.facet.query 
parameter here.
It looks like that it's possible to achieve the same result by specifying 
appropriate ToParentQuery in facet.query parameter.
For example, facet.query={!parent which=type_s:parent}price:[1 TO 100].
But please notice that in this case facet.query result could count child 
documents which are not matched by search query.
For example, there could be a parent document with two children. One child has 
COLOR_s:Red and price:200, while another one COLOR_s:Blue and price:50.
If you request q={!parent which=type_s:parent}COLOR_s:Red
and facet.query={!parent which=type_s:parent}price:[1 TO 100], this document is 
going go be counted.
Sometimes it's OK, but if you want to eliminate this effect, you need to add 
child documents filter from q to facet.query.
The best way to do it is introducing new http parameter, say qq=COLOR_s:Red and 
referencing it both from q and facet.query, i.e.
q={!parent which=type_s:parent v=$qq}&facet.query={!parent 
which=type_s:parent}+price:[1 TO 100] +{!v=$qq}&qq=type_s:child&facet=true

> Faceting with BlockJoin support
> -------------------------------
>
>                 Key: SOLR-5743
>                 URL: https://issues.apache.org/jira/browse/SOLR-5743
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: abipc
>              Labels: features
>         Attachments: 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-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to