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

Mikhail Khludnev commented on SOLR-8998:
----------------------------------------

ok. one more try with parent level query. Here is how we can calculate child 
level facet with roll up to parents (see {{in_books}} below), and get 
exclusions for them too. .The idea is that when we calculate child level facets 
we can apply a necessary subset of child filters via {{{type:query, q:"foo", 
domain:{blockChildren:".."}}}}. ie. it's done via manual inclusion instead of 
_exclusion_.
Beware of + to %2B escaping. Child level filters can be cached with 
{{filter(..)}}, then they can be referred with {{\{!v=$childq}}} instead of 
repeating.  
 
{code}
q={!parent which=type_s:book}comment_t:* %2Bauthor_s:yonik %2Bstars_i:(5 
3)&wt=json&indent=on&rrrows=0&json.facet={
comments_for_author:{
  type:query,
  q:"comment_t:* %2Bstars_i:(5 3)",
  "//note":"author filter is excluded",
  domain:{
     blockChildren:"type_s:book"
   }, facet:{
   authors:{
      type:terms,
      field:author_s,
      facet: {
          in_books: "unique(_root_)"
        }
    }
   }
} ,
comments_for_stars:{
  type:query,
  q:"comment_t:* %2Bauthor_s:yonik",
  "//note":"stars_i filter is excluded",
  domain:{
     blockChildren:"type_s:book"
   }, facet:{
   stars:{
      type:terms,
      field:stars_i,
      facet: {
          in_books: "unique(_root_)"
        }
    }
  }
}
}
{code}

> JSON Facet API child roll-ups
> -----------------------------
>
>                 Key: SOLR-8998
>                 URL: https://issues.apache.org/jira/browse/SOLR-8998
>             Project: Solr
>          Issue Type: New Feature
>          Components: Facet Module
>            Reporter: Yonik Seeley
>
> The JSON Facet API currently has the ability to map between parents and 
> children ( see http://yonik.com/solr-nested-objects/ )
> This issue is about adding a true rollup ability where parents would take on 
> derived values from their children.  The most important part (and the most 
> difficult part) will be the external API.



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