Search This Blog

Thursday, June 17, 2010

Configuring Solr with MySQL Database


Configuring with MySQL Database
1. Download jdbc driver for mysql (mysql-connector-java-5.1.12-bin.jar) put it in the “lib” folder , this is the one which is responsible for communication between MySQL db and apache Solr
2. Open data-config.xml in your conf folder under example directory (example->conf->data-config.xml) in any text editor
3.Add XML as below

4. Data source is the tag which holds the data about the connecter (which database ,user, password, url, driver etc.,), we can have many data source in a single file and use the name of data source to connect
5. Change the “Query” in the “entity” tag as you want to create index it can also use joins and db functions in it
6. There is another set of tags called “Field” which used to specify what are the column which are returned by the query is going to be used (take care in giving values to name attribute),”Column” attribute is used to map the column name to the name attribute
7. Open “schema.xml” in the same folder search for “fields” tag and remove the content of it and add your columns names as picture below

8. Tag “copyField” use to copy more than one column into a single string, In the above example we are using “text “ to hold all the values
9. Tag “uniqueKey” is used to identify the index unqiue


No comments:

Post a Comment