Installing and Running Apache Solr

From this presentation “Introduction to Apache Solr” https://speakerdeck.com/fringedgentian/introduction-to-apache-solr
How to Install & Run Apache Solr

  1. Download the latest code archive from http://lucene.apache.org/solr/.  Note: on Windows I found the latest would not extract and had to go back one release http://mirror.olnevhost.net/pub/apache/lucene/solr/4.2.1/
  2. Extract this archive with zip or tar
  3. Navigate to example/ folder and type “java –jar start.jar”
  4. Voila, your own completely empty Solr server will be up and running at http://127.0.0.1:8983, you can get to the administrative interface at http://127.0.0.1/solr/admin
  5. To index the example documents so you have something to practice searching, navigate to /example/exampledocs/ and type “java –jar post.jar *.xml”

How to add documents to Solr from a MySql database
Just in case anyone comes especially looking for this, I took it out of my talk

  1. You will need to find and download into the /lib/ directory of your Solr home the MySQL jdbc driver .jar file.
  2. Solr’s Data Import Handler jar file is also not included by default, so you hav to add this to the top of your solrconfig.xml:

<lib dir=”../../../../dist/” regex=”solr-dataimporthandler-.*\.jar” />

  1. Add your update handler to solrconfig.xml and define the configuration file for it:

<requestHandler name=”/dataimport” class=”org.apache.solr.handler.dataimport.DataImportHandler”>
<lst name=”defaults”>
<str name=”config”>db-data-config.xml</str>
</lst>
</requestHandler>

  1. Now you need to create your db-data-config.xml in the same directory as solrconfig.xml and schema.xml, here is an example: http://www.beingjavaguys.com/2013/01/how-to-use-solr-data-import-handler-to.html

Resources:
•Solr in Action www.manning.com/grainger