Indeed! Now it works for me too. JSON Facets seems powerful, but not
friendly to me.
Yonik, thanks for example!

Xavi,

I took  json docs from http://yonik.com/solr-nested-objects/ and just
doubled book2_c3

Here is what I have with json.facet={catz: {type:terms,field:cat_s, facet:{
starz:{type:terms, field:stars_i, domain:{blockChildren:'type_s:book'}} }}}

{
  "responseHeader": {
    "status": 0,
    "QTime": 2,
    "params": {
      "q": "publisher_s:*",
      "json.facet": "{catz: {type:terms,field:cat_s, facet:{
starz:{type:terms, field:stars_i,
domain:{blockChildren:'type_s:book'}} }}}",
      "indent": "true",
      "wt": "json",
      "_": "1448309900982"
    }
  },
  "response": {
    "numFound": 2,
    "start": 0,
    "docs": [
      {
        "id": "book1",
        "type_s": "book",
        "title_t": "The Way of Kings",
        "author_s": "Brandon Sanderson",
        "cat_s": "fantasy",
        "pubyear_i": 2010,
        "publisher_s": "Tor",
        "_version_": 1518570756086169600
      },
      {
        "id": "book2",
        "type_s": "book",
        "title_t": "Snow Crash",
        "author_s": "Neal Stephenson",
        "cat_s": "sci-fi",
        "pubyear_i": 1992,
        "publisher_s": "Bantam",
        "_version_": 1518570908026929200
      }
    ]
  },
  "facets": {
    "count": 2,
    "catz": {
      "buckets": [
        {
          "val": "fantasy",
          "count": 1,
          "starz": {
            "buckets": [
              {
                "val": 3,
                "count": 1
              },
              {
                "val": 5,
                "count": 1
              }
            ]
          }
        },
        {
          "val": "sci-fi",
          "count": 1,
          "starz": {
            "buckets": [
              {
                "val": 2,
                "count": 2
              },
              {
                "val": 4,
                "count": 1
              },
              {
                "val": 5,
                "count": 1
              }
            ]
          }
        }
      ]
    }
  }
}

It works well with *:* too.

On Mon, Nov 23, 2015 at 12:56 AM, Yonik Seeley <ysee...@gmail.com> wrote:

> On Sun, Nov 22, 2015 at 3:10 PM, Mikhail Khludnev
> <mkhlud...@griddynamics.com> wrote:
> > Hello,
> >
> > I also played with json.facet, but couldn't achieve the desired result
> too.
> >
> > Yonik, Alessandro,
> > Do you think it's a new feature or it can be achieved with the current
> > implementation?
>
> Not sure if I'm misunderstanding the example, but it looks
> straight-forward.
>
> terms facet on parent documents, with sub-facet on child documents.
> I just committed a test for this, and it worked fine.  See
> TestJsonFacets.testBlockJoin()
>
> Can we see an example of a parent document being indexed (i.e. along
> with it's child documents)?
>
> -Yonik
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

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

Reply via email to