Solr DataImportHandler converts MySQL TINYINT to Boolean

1. Database table column definition

is_active  tinyint(1) NOT NULL DEFAULT ‘1’,

2. Solr schema.xml

<field name=”is_active” type=”boolean” indexed=”true” stored=”true” multiValued=”false” />

3. dih-config.xml

<dataSource type=”JdbcDataSource” driver=”com.mysql.jdbc.Driver” user=”dbuser” password=”dbpassword” batchSize=”-1″
url=”jdbc:mysql://db_host/database_name?autoReconnect=true&amp;zeroDateTimeBehavior=convertToNull&amp;tinyInt1isBit=false” />

This way, when is_active=1, solr will store it as true; when is_active=0, false will be stored.

(Visited 18 times, 1 visits today)