Search code examples
solrdataimporthandler

solr does not import fields other than id


I am using Solr DataImportHandler module. Here is my config;

<dataConfig>
  <dataSource type="JdbcDataSource" 
              name="sql" 
              driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
              url="jdbc:sqlserver://localhost;databaseName=AdventureWorks2008;integratedSecurity=true;"/>
  <document>
    <entity name="Person"  dataSource="sql"
      pk="BusinessEntityID"
      query="select BusinessEntityID,FirstName,LastName FROM [Person].[Person]"
      deltaImportQuery="select BusinessEntityID,FirstName,LastName FROM [Person].[Person] WHERE id='${dih.delta.id}'"
      deltaQuery="SELECT BusinessEntityID FROM [Person].[Person] WHERE ModifiedDate > '${dih.last_index_time}'">
       <field column="BusinessEntityID" name="id"/>
       <field column="FirstName" name="firstname"/>       
       <field column="LastName" name="lastname"/>       
    </entity>
  </document>
</dataConfig>

for some reason, only id field is importing but not the rest.

enter image description here

What would be the reason? Am I missing something?


Solution

  • You might have missed the below entries in the schema.xml file

    <field name="id" type="string" indexed="true" stored="true" required="true"/> 
    <field name="firstname" type="string" indexed="true" stored="true"/> 
    <field name="lastname" type="string" indexed="true" stored="true"/>
    

    Here type for id can be int. Just check what you want.

    <field name="id" type="int" indexed="true" stored="true" required="true"/>