I have a document with multiple different children.  Below is the structure:
<doc>
    <field name="id">1</field>
    <field name="isParent">true</field>
    <doc>
      <field name="id">11</field>
      <field name="isParent">false</field>
      <field name="predictiveModelId">22</field>
      <field name="predictiveModelRank">6</field>
    </doc>
    <doc>
      <field name="id">12</field>
      <field name="isParent">false</field>
      <field name="predictiveModelId">11</field>
<field name="predictiveModelRank">7276</field>
    </doc>
    <doc>
      <field name="id">13</field>
      <field name="isParent">false</field>
      <field name="employeeId">1000000419</field>
    </doc>
    <doc>
      <field name="id">14</field>
      <field name="isParent">false</field>
      <field name="fundCode">245</field>
    </doc>
  </doc>
  <doc>
    <field name="id">2</field>
    <field name="isParent">true</field>
    <doc>
      <field name="id">15</field>
      <field name="isParent">false</field>
      <field name="predictiveModelId">92834</field>
      <field name="predictiveModelRank">6</field>
    </doc>
    <doc>
      <field name="id">16</field>
      <field name="isParent">false</field>
      <field name="predictiveModelId">89</field>
<field name="predictiveModelRank">345</field>
    </doc>
    <doc>
      <field name="id">17</field>
      <field name="isParent">false</field>
      <field name="employeeId">64651</field>
    </doc>
    <doc>
      <field name="id">19</field>
      <field name="isParent">false</field>
      <field name="fundCode">888</field>
    </doc>
  </doc>

I am trying to write a query which will return child facets but I am either 
receiving an error or no results.  I'm wondering if someone could point me in 
the right direction.
I am working with Solr 6.1.0.

Here is my schema:

<field name="id" type="string" indexed="true" stored="true" required="false"/>
  <field name="isParent" type="boolean" indexed="true" stored="false"/>
  <field name="employeeId" type="int" indexed="true" stored="false"/>
  <field name="fundCode" type="string" indexed="true" stored="false"/>
  <field name="predictiveModelId" type="int" indexed="true" stored="false"/>
  <field name="predictiveModelRank" type="int" indexed="true" stored="true"/>
  <field name="predictiveModelScore" type="float" indexed="true" stored="true"/>


1.        With this query I receive no facet results.  The main response is 
correct, but I was expecting to see a fundCode facet of 245 with 1.  Below is 
the query with the output.


... 
/Clients/bjqfacet?fq={!parent%20which=isParent:true}fundCode:245&fq={!parent%20which=isParent:true}predictiveModelId:22&fq={!parent%20which=isParent:true}predictiveModelRank:7276&indent=on&q={!parent%20which=isParent:true}employeeId:1000000419&wt=json&child.facet.field=fundCode&debugQuery=true



{

  "responseHeader":{

    "status":0,

    "QTime":2},

  "response":{"numFound":1,"start":0,"docs":[

      {

        "id":"7258",

        "_version_":1540942803838697474}]

  },

  "facet_counts":[

    "facet_fields",[

      "fundCode",[]]],

  "debug":{

    "rawquerystring":"{!parent which=isParent:true}employeeId:1000000419",

    "querystring":"{!parent which=isParent:true}employeeId:1000000419",

    "parsedquery":"AllParentsAware(ToParentBlockJoinQuery 
(employeeId:`\u000b\\k\u0017#))",

    "parsedquery_toString":"ToParentBlockJoinQuery 
(employeeId:`\u000b\\k\u0017#)",

    "explain":{

      "7258":"\n0.0 = Score based on 1 child docs in range from 822434 to 
822469, best match:\n  4.0979195 = weight(employeeId:`\u000b\\k\u0017# in 
822441) [], result of:\n    4.0979195 = score(doc=822441,freq=1.0 = 
termFreq=1.0\n), product of:\n      4.0979195 = idf(docFreq=269330, 
docCount=16217701)\n      1.0 = tfNorm, computed from:\n        1.0 = 
termFreq=1.0\n        1.2 = parameter k1\n        0.0 = parameter b (norms 
omitted for field)\n"},

    "QParser":"BlockJoinParentQParser",

    "filter_queries":["{!parent which=isParent:true}fundCode:245",

      "{!parent which=isParent:true}predictiveModelId:22",

      "{!parent which=isParent:true}predictiveModelRank:7276"],

    "parsed_filter_queries":["AllParentsAware(ToParentBlockJoinQuery 
(fundCode:245))",

      "AllParentsAware(ToParentBlockJoinQuery 
(predictiveModelId:`\b\u0000\u0000\u0000\u0016))",

      "AllParentsAware(ToParentBlockJoinQuery 
(predictiveModelRank:`\b\u0000\u00008l))",

      "BlockJoinFacetFilter(null)"],

    "timing":{

      "time":2.0,

      "prepare":{

        "time":0.0,

        "query":{

          "time":0.0},

        "facet":{

          "time":0.0},

        "facet_module":{

          "time":0.0},

        "mlt":{

          "time":0.0},

        "highlight":{

          "time":0.0},

        "stats":{

          "time":0.0},

        "expand":{

          "time":0.0},

        "bjqFacetComponent":{

          "time":0.0},

        "debug":{

          "time":0.0}},

      "process":{

        "time":1.0,

        "query":{

          "time":0.0},

        "facet":{

          "time":0.0},

        "facet_module":{

          "time":0.0},

        "mlt":{

          "time":0.0},

        "highlight":{

          "time":0.0},

        "stats":{

          "time":0.0},

        "expand":{

          "time":0.0},

        "bjqFacetComponent":{

          "time":0.0},

        "debug":{

          "time":0.0}}}}}



2.       If I change the child facet another field, like an int, it blows up.  
Again I was expecting to see two results for predictiveModelId facet: 11 with 1 
and 22 with 1.


.../Clients/bjqfacet?fq={!parent%20which=isParent:true}fundCode:245&fq={!parent%20which=isParent:true}predictiveModelId:22&fq={!parent%20which=isParent:true}predictiveModelRank:7276&indent=on&q={!parent%20which=isParent:true}employeeId:1000000419&wt=json&child.facet.field=predictiveModelId&debugQuery=true



{

  "responseHeader":{

    "status":500,

    "QTime":1},

  "error":{

    "msg":"unexpected docvalues type NUMERIC for field 'predictiveModelId' 
(expected one of [SORTED, SORTED_SET]). Use UninvertingReader or index with 
docvalues.",

    "trace":"java.lang.IllegalStateException: unexpected docvalues type NUMERIC 
for field 'predictiveModelId' (expected one of [SORTED, SORTED_SET]). Use 
UninvertingReader or index with docvalues.\n\tat 
org.apache.lucene.index.DocValues.checkField(DocValues.java:212)\n\tat 
org.apache.lucene.index.DocValues.getSortedSet(DocValues.java:306)\n\tat 
org.apache.solr.search.join.BlockJoinFieldFacetAccumulator.initSegmentData(BlockJoinFieldFacetAccumulator.java:77)\n\tat
 
org.apache.solr.search.join.BlockJoinFieldFacetAccumulator.setNextReader(BlockJoinFieldFacetAccumulator.java:183)\n\tat
 
org.apache.solr.search.join.BlockJoinFacetCollector.doSetNextReader(BlockJoinFacetCollector.java:78)\n\tat
 
org.apache.lucene.search.SimpleCollector.getLeafCollector(SimpleCollector.java:33)\n\tat
 org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:660)\n\tat 
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:473)\n\tat 
org.apache.solr.search.SolrIndexSearcher.buildAndRunCollectorChain(SolrIndexSearcher.java:260)\n\tat
 
org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:1810)\n\tat
 
org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1627)\n\tat
 
org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:643)\n\tat
 
org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:529)\n\tat
 
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:301)\n\tat
 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:156)\n\tat
 org.apache.solr.core.SolrCore.execute(SolrCore.java:2036)\n\tat 
org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:657)\n\tat 
org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:464)\n\tat 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:257)\n\tat
 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:208)\n\tat
 
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)\n\tat
 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)\n\tat
 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\n\tat
 
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)\n\tat
 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)\n\tat
 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1160)\n\tat
 
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)\n\tat 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\n\tat
 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1092)\n\tat
 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\n\tat
 
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)\n\tat
 
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)\n\tat
 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)\n\tat
 org.eclipse.jetty.server.Server.handle(Server.java:518)\n\tat 
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)\n\tat 
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)\n\tat
 
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)\n\tat
 org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)\n\tat 
org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)\n\tat
 
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)\n\tat
 
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)\n\tat
 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)\n\tat
 
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)\n\tat
 java.lang.Thread.run(Thread.java:745)\n",

    "code":500}}

Any help would be appreciated!

Reply via email to