I found that example has not enough data to reproduce this functionality.
what if Mary left the same comment to the same book (book2_c4), then we
search for th* across comments

http://localhost:8983/solr/techproducts/select?q=comment_t%3Ath*&wt=csv&indent=true&fl=author_s,comment_t,id

and get

author_s,comment_t,id
dan,This book was too long.,book1_c2
yonik,Ahead of its time... I wonder if it helped inspire The Matrix?,book2_c1
dan,A pizza boy for the Mafia franchise? Really?,book2_c2
mary,Neal is so creative and detailed! Loved the metaverse!,book2_c3
mary,Neal is so creative and detailed! Loved the metaverse!,book2_c4

then, I wish to calculate author facet, but count them in books
(rollup to parents)!

dan(2) - commented both books
yonik(1) - only second one
*mary(1)*  - only second one, despite twice

So, far I'm ablle only

localhost:8983/solr/techproducts/select?q=comment_t%3Ath*&wt=json&indent=true&fl=author_s,comment_t,id&json.facet={top_reviewers
: { type: terms, field: author_s}}

"top_reviewers":{
      "buckets":[{
          "val":"dan",
          "count":2},
        {
          "val":"mary",
          "count":2},
        {
          "val":"yonik",
          "count":1}]}}}

but it's comments mary(2), not books!

Neither  domain: { blockParent : "type_s:book" } nor  domain: {
blockChildren : "type_s:book" } don't help.

I tried to nest a facet with specifying a domain, it's just ignored
localhost:8983/solr/techproducts/select?q=comment_t%3Ath*&wt=json&indent=true&fl=author_s,comment_t,id&json.facet={top_reviewers
: { type: terms, field: author_s, in_books : { type: terms, field:
author_s,  domain: { blockParent : \"type_s:book\" }}}}




On Wed, Nov 11, 2015 at 6:31 PM, Yonik Seeley <ysee...@gmail.com> wrote:

> On Mon, Nov 9, 2015 at 2:37 PM, Mikhail Khludnev
> <mkhlud...@griddynamics.com> wrote:
> > Yonik,
> >
> > I wonder is there a plan or a vision for something like
> >
> https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-reverse-nested-aggregation.html
> > under JSON facets?
>
> Hmmm, I couldn't quite grok that complicated command syntax... but the
> description seems straight-forward enough:
>
> "The following aggregations will return the top commenters' username
> that have commented and per top commenter the top tags of the issues
> the user has commented on:"
>
> So if I translate that into "books" and "reviews" that I use here:
> http://yonik.com/solr-nested-objects/
>
> it sounds like we start with a set of book objects, then map to the
> child domain to facet on comments, then map back to the parent domain
> to facet on books again.
>
> From that blog, this is the command that finds top review authors:
>
> json.facet={
>   top_reviewers : {
>     type: terms,
>     field: author_s,
>     domain: { blockChildren : "type_s:book" }
>   }
> }
>
> Now we just need to add a sub-facet that switches back to the parent
> domain to facet on something there (like genre... equiv to "tags" in
> the ES example):
>
> son.facet={
>   top_reviewers : {
>     type: terms,
>     field: author_s,
>     domain: { blockChildren : "type_s:book" },
>
>     facet : {
>       type:terms,
>       field:genre,
>       domain:{blockParent:"type_s:book"}
>     }
>
>   }
> }
>
>
>
> While there is certainly more work do be done with joins /
> block-joins, it seems like we can already do that specific example at
> least.
>
> -Yonik
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
<mkhlud...@griddynamics.com>

Reply via email to