solr不会导入id以外的字段

问题描述 投票:1回答:2

我正在使用Solr DataImportHandler模块。这是我的配置;

<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>

出于某种原因,只有id字段是导入而不是其余的。

enter image description here

那是什么原因?我错过了什么吗?

solr dataimporthandler
2个回答
3
投票

您可能错过了schema.xml文件中的以下条目

<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"/>

这里id的类型可以是int。只需检查你想要的。

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

0
投票

确保您的ID和唯一字段是正确的。我面临同样的问题,更改Pk和唯一的字段名称,它工作正常。

© www.soinside.com 2019 - 2024. All rights reserved.