Stupid Apache Solr DIH Tip

Recently while using Solr's Data Import Handler, things didn't work as expected. Here is the situation and a thing to watch out for.

The Schema was simple, a parent table and 3 child tables. Parent table has UUID stored as RAW, and it was referred by child table through a join. Schema and DIF configuration was fine, but the child table data was never pulled into Solr. The UUID field was defined as String, and the Queries worked perfectly in SQL Developer.

The actual solution to the problem is quite simple. While defining the Data source in DIH configuration file, enable following

convertType="true"

The problem was simple, the convertType defaults to false, which means Solr shall guess the Data Types from SQL schema. Since Schema had UUIS as RAW, the joins were not working. When the attribute is turned on, Solr would refer the schema.xml to define the field type.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.