Lucene vs Solr
Many people new to Lucene and Solr will ask the obvious question: When do I use Lucene and when do I use Solr?
The answer is simple: if you're asking yourself this question, in 99% of situations, what you want to use is Solr.
A simple way to conceptualize the relationship between Solr and Lucene is that of a car and its engine. You can't drive an engine, but you can drive a car. Similarly, Lucene is a library which you can't use as-is, whereas Solr is a complete application which you can use out-of-box.
What is Solr?
Apache Solr is a web application built around Lucene with all kinds of goodies.
It adds functionality like
- XML/HTTP and JSON APIs
- Hit highlighting
- Faceted search
- Caching
- Replication
- Web administration interface etc
Where Lucene is a library and NOT an application, Solr is a web application (WAR) which can be deployed in any servlet container, e.g. Jetty, Tomcat, Resin, etc.
Solr can be installed and used by non-programmers. Lucene cannot.
Is it well supported?
In a nutshell, yes! The Solr community is very vibrant and helpful.
Can Solr indexes be read by Lucene and vice-versa?
Since Solr uses Lucene under the hoods, they are one and the same thing.
There is technically no such thing as a Solr index, only a Lucene index created by a Solr instance.
When should I use Lucene then?
If there's the need to embed search functionality into your own application (like a desktop application for example), Lucene is the more appropriate choice.
For situations where you have very customized requirements requiring low-level access to the Lucene API classes, Solr would be more a hindrance than a help, since it is an extra layer of indirection.
blog comments powered by Disqus