I think it was not just rootEntity="true".
We need to add transformer="TemplateTransformer" and make sure that each
entity has some kind of Unique column across all entities e.g. in this case
<field column="doc_id" template="salg_${salgrade.GRADE}" />
is a made up column and this doc_id values should be unique across all
entities. template clause is like transformation e.g. doc_id values are made
up by prefixing salg_ and values of ${salgrade.GRADE} in the first entity
section while in the second entity section, it is using different prefix and
different variable to make it Unique.
schema.xml have <uniqueKey>doc_id</uniqueKey>
and also add following :
<field name="deptno" type="text_general" indexed="true" stored="true"
required="false" />
<field name="dname" type="text_general" indexed="true" stored="true"
/>
<field name="loc" type="text_general" indexed="true" stored="true" />
<field name="ename" type="text_general" indexed="true" stored="true"
multiValued="true" />
<field name="job" type="text_general" indexed="true" stored="true"
multiValued="true"/>
<field name="grade" type="text_general" indexed="true" stored="true"
required="false" />
<field name="losal" type="text_general" indexed="true" stored="true" />
<field name="hisal" type="text_general" indexed="true" stored="true" />
<field name="doc_id" type="string" indexed="false" stored="false" />
<document>
<entity name="salgrade" transformer="TemplateTransformer"
query="select grade,losal,hisal from salgrade" >
<field column="doc_id" template="salg_${salgrade.GRADE}" />
<field column="GRADE" name="grade" />
<field column="LOSAL" name="losal" />
<field column="HISAL" name="hisal" />
</entity>
<entity name="mydept" transformer="TemplateTransformer" query="select
deptno,dname,loc from dept">
<field column="doc_id" template="myd_${mydept.DEPTNO}" />
<field column="DEPTNO" name="deptno" />
<field column="DNAME" name="dname" />
<field column="LOC" name="loc" />
<entity name="myemp" transformer="TemplateTransformer"
query="select ename,job from emp where deptno=${mydept.DEPTNO} " >
<field column="ENAME" name="ename" />
<field column="JOB" name="job" />
</entity>
</entity>
</document>
--
View this message in context:
http://lucene.472066.n3.nabble.com/How-do-I-add-another-unrelated-query-results-to-solr-index-tp4128932p4129678.html
Sent from the Solr - User mailing list archive at Nabble.com.