Search code examples
solrfacetsolr5

solr5.1: Json facet: range facet query in combination with blockjoin doesnt work


Below is my schema structure:

Doc1:
  id: A1_1,
  name: xyz,
  type: A1,
  field5:TTT,
  _childDocuments_:Doc4,Doc5

Doc4:
     id: A2_1
     type:A2
     field1: ABC,
     field2: DEF,
     field3: TVF,
     field4: 2014-02-01T00:00:00Z

Doc5 is similar in structure as Doc4.

I am using json-facets. Below is my query

  json.facet = {
      a1: {
        type: terms,
        field: range,
        start: "NOW/YEAR-2YEAR",
        end: "NOW/YEAR%2B2YEAR",
        gap: "%2B1MONTH",
        mincount: 1,
        limit: 100,
        facet: {
          a2: {
            type: terms,
            field: field1,
            facet: {
               a3:{
                 type: terms,
                 field: field2,
                 facet:{
                   a4: {
                     type: terms,
                     field: field5,
                     domain: {blockParent: {"type:A1"}}
                   } 
                 }
               }
            }   
          }
        }
      }
    }

If i dont use the range query and just start my query from the **a2** part of the query above, it fetches results as expected. Similarly if I run the above query, all results till the blockParent do come but blockParent related facet results dont come.


Solution

  • Facets on nested docs don't work fine until 5.3. Upgrade to solr5.3 to verify (you can just install solr5.3, then copy the index there and you should be able to run such queries.

    I encountered this same issue, for more details check out my post, you can see even more complex json facet queries working on nested docs.