Solr DataImportHandler issue: positive integers indexed for string ‘nested’ fields

Posted: June 23rd, 2010 | Author: Ward Bekker | Filed under: Uncategorized | No Comments »

A quick note about a Solr issue that took me some time to solve.

If this sounds familiar….

  • You are using the DataImportHandler for Solr
  • You have a entity with a field which values come from a related entity.
  • After an import it looks like Solr only indexed even postive integers if you look at the schema browser.

….You probably have a ‘nested’ field which name is similar to it’s entity name. See the code below: entity name = regio and field name = regio. Changing field name to something else (regions) solved the issue. When you think about it, it’s somewhat logical that you don’t allow field names to have the same name as the entity. An schema exception during indexing would have been nice though.

<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/nvb?zeroDateTimeBehavior=convertToNull" user="****" password="****"/>
    <document name="vacatures">
        <entity name="vacature" query="select * from vacature">
            <field column="id" name="id" />
            <entity name="regio" query="SELECT regio from foo where vacature='${vacature.id}">
                <field name="regio" column="regio" />
            </entity>


Leave a Reply