I want to index and search for two different objects.
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> <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" /> <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" /> <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>
By the link below:
stack overflow
This problem can be solved using a static field (adding a new field - here is its "entity" ). But I noticed that after adding a second object, it cannot even index the data.
As the picture below. 
Its ability to retrieve 10 records from a sql server database, but an index of 0 rows means that the indexing process is not running. Therefore, it is not even possible to perform a search. Can anyone solve this problem? Thanks in advance.
xml indexing solr data-import dataimporthandler
Sanket thakkar
source share