I want to index and search two different entity.
File name: db-data-config.xml
<dataConfig>
<dataSource name="myindex" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://test-pc:1433;DatabaseName=SampleDB" user="username" password="password" />
<document>
<entity name="Employees" query="select * from employee" transformer="TemplateTransformer" dataSource="myindex">
<field column="id" name="singlekey" />
<field column="eId" name="eid" />
<field column="eName" name="ename" />
<field column="entity" template="Employee" name="entity" />
</entity>
<entity name="Products" query="select * from products" transformer="TemplateTransformer" dataSource="myindex">
<field column="id" name="singlekey" />
<field column="pId" name="pid" />
<field column="pName" name="pname" />
<field column="entity" template="Product" name="entity" />
</entity>
</document>
File name: schema.xml
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="db" version="1.1">
<types>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
</types>
<fields>
<!-- Employee -->
<field name="eid" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="ename" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<!-- Products -->
<field name="pid" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="pname" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<!--Common fields-->
<field name="entity" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="singlekey" type="string" indexed="true" stored="true" required="true" multiValued="false" />
</fields>
<uniqueKey>singlekey</uniqueKey>
</schema>
As per below link:
https://stackoverflow.com/questions/5636209/how-to-index-and-search-two-different-tables-which-are-in-same-datasource-using
This problem can solve by using static field (adding new field - here its 'entity').
But I saw that after adding second entity, it can't even index the data.
As per picture shown below.
Its able to fetch 10 records from sql server database but index 0 rows, means no indexing process done. So even can't search. Anyone can solve this problem? Thanks in advance.