Time for action – indexing data from a database (for example, a blog or an e-commerce website)

In this first example, we will use the most basic configuration for managing our example database. In SQL, starting from the two tables, we would write a simple JOIN statement similar to the following one:

FROM authors AS A JOIN paintings AS P ON (A.ID=P.AUTHOR_ID) 
WHERE (FORM='painting')

Note that we have used the char data type to avoid problems with the field originally named BORN-DIED.

Once we have defined the SQL query that we want to use, we simply have to use this query from an appropriate JDBCDataSource and SqlEntityprocessor, which are defined in DIH.xml, as follows:

<dataConfig> <script>... HERE there ...

Get Apache Solr Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.