Indexing data from MySQL
In this section, we'll see how we can set up a MySQL database in Solr to index our data from the database to Solr directly. To do this, we'll use the musicCatalog
schema, which we developed in previous chapters, and we will create a similar table to hold the data in the MySQL database.
Configuring datasource
We're assuming that you already have a MySQL database running on your machine. In the MySQL database, we'll need to create the following table to hold the musicCatalogue
data.
Let's go ahead and create a database called solrIndexingExample
in MySQL. We can use the following SQL to create a new database:
create database solrIndexingExample; use solrIndexingExample;
After we have created the database, we'll need to create a table that will hold our data for musicCatalog. We can use this SQL query to create a table:
CREATE TABLE musiccatalog ( songId int(11) NOT NULL AUTO_INCREMENT, songName varchar(250) DEFAULT NULL, artistName...