I’m going to spend some time looking at some interesting services that really extend and enhance what’s possible with web applications. Over this series I’ll build up a fully working app with all the source code starting with an enterprise search engine I’ve been interested in for a while.
Apache Solr is an open source enterprise search platform from the Apache Lucene project. It has some useful features that include full-text search, hit highlighting, faceted search, near real-time indexing, dynamic clustering, database integration, rich document handling and geospatial capabilities.
Solr is also highly reliable, scalable and can be setup into fault tolerant modes. It’s heavily used on the Internet as listed on Solr public sites.
The homepage for Solr is: https://lucene.apache.org/solr/.
Before you can run Solr, grab and install the latest Java SE Oracle SE download.
If you don’t want the Oracle version, Solr apparently supports other Java versions according to the Lucene tutorial.
For this installation, the latest Oracle SDK is used. Solr versions greater than 4 require a Java version 1.6 or greater.
Grab the installation files from: http://www.apache.org/dyn/closer.cgi/lucene/solr/4.5.0 and select the most appropriate mirror. This installation on this post is performed on a Windows server.
Grab the conpressed file, decompress it and save the output to a location on your disk.
Navigate to the installation directory and run the following in a command prompt:
java –jar start.jar
This will present two URIs which you can browse at:
The Apache Solr dashboard: http://localhost:8983/solr/#/
And an example search engine: http://localhost:8983/solr/collection1/browse/?
Once these are running, the next task is to index some content, to do this run the following java:
java -jar post.jar *.xml
This will produce the following output:
D:\Solr\solr-4.5.0\example\exampledocs>java -jar post.jar *.xml
SimplePostTool version 1.5
Posting files to base url http://localhost:8983/solr/update using content-type a
POSTing file gb18030-example.xml
POSTing file hd.xml
POSTing file ipod_other.xml
POSTing file ipod_video.xml
POSTing file manufacturers.xml
POSTing file mem.xml
POSTing file money.xml
POSTing file monitor.xml
POSTing file monitor2.xml
POSTing file mp500.xml
POSTing file sd500.xml
POSTing file solr.xml
POSTing file utf8-example.xml
POSTing file vidcard.xml
14 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/update..
Time spent: 0:00:01.205
If you return the the example search interface, You will find a number of documents have been indexed.
More info on Solr setup can be found at: http://lucene.apache.org/solr/3_6_2/doc-files/tutorial.html.
In part 2, We’ll take a look at some of the more advanced features of Solr.