Tutorial :Situations to prefer Apache Lucene over Solr?



Question:

There are several advantages to use Solr 1.4 (out-of-the-box facetting search, grouping, replication, http administration vs. luke, ...).

Even if I embed a search-functionality in my Java application I could use SolrJ to avoid the HTTP trade-off when using Solr. Is SolrJ recommended at all?

So, when would you recommend to use "pure-Lucene"? Does it have a better performance or requires less RAM? Is it better unit-testable?

PS: I am aware of this question.


Solution:1

If you have a web application, use Solr - I've tried integrating both, and Solr is easier. Otherwise, if you don't need Solr's features (the one that comes to mind as being most important is faceted search), then use Lucene.


Solution:2

If you want to completely embed your search functionality within your application and do not want to maintain a separate process like Solr, using Lucene is probably preferable. Per example, a desktop application might need some search functionality (like the Eclipse IDE that uses Lucene for searching its documentation). You probably don't want this kind of application to launch a heavy process like Solr.


Solution:3

Here is one situation where I have to use Lucene.

Given a set of documents, find out the most common terms in them.

Here, I need to access term vectors of each document (using low-level APIs of TermVectorMapper). With Lucene it's quite easy.

Another use case is for very specialized ordering of search results. For exmaple, I want a search for an author name (who has writen multiple books) to result into one book from each store in the first 10 results. In this case, I will find results from each book store and to show final results I will pick one result from each book store. Here you are essentially doing multiple searches to generate final results. Having access to low-level APIs of lucene definitely helps.

One more reason to go for Lucene was to get new goodies ASAP. This no longer is true as both of them have been merged and there will be synchronous releases.


Solution:4

I'm surprised nobody mentioned NRT - Near Real Time search, available with Lucene, but not with Solr (yet).


Solution:5

Use Solr if you are more concerned about scalability than performance and use Lucene if you are more concerned about performance than scalability.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »