18

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.

Community
  • 1
  • 1
Karussell
  • 17,085
  • 16
  • 97
  • 197
  • 1
    here are other 'comparisons' http://www.lucenetutorial.com/lucene-vs-solr.html and http://www.lucidimagination.com/solutions/software/choosing-lucene-solr – Karussell May 18 '10 at 19:48
  • have another look at http://www.findbestopensource.com/article-detail/lucene-vs-solr – Karussell Oct 20 '10 at 07:31

5 Answers5

6

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.

James Kingsbery
  • 7,298
  • 2
  • 38
  • 67
  • Did you use SolrJ or HTTP approach? I tried to embed lucene in a webapp and it was quite easy. – Karussell May 18 '10 at 17:26
  • I used Solrj, so I didn't need to make HTTP requests from within the application. Honestly, I cannot remember what made it difficult, so maybe I was doing something dumb somewhere. – James Kingsbery May 18 '10 at 18:31
  • Thanks for the reply. What about unit-testing is it easy to setup a RAMDirectory like I can do with lucene? – Karussell May 18 '10 at 19:40
  • I haven't tried it, but apparently it is possible: http://search.lucidimagination.com/search/out?u=https%3A%2F%2Fissues.apache.org%2Fjira%2Fbrowse%2FSOLR-465 – James Kingsbery May 18 '10 at 20:37
  • Lucene supports faceted search but it is really different than what Solr provides. At time of upsert, you write a taxonomy (think of it as a secondary inverted index) for each document. The query is different too. You use facet terms and collect facet results. – Glenn Apr 28 '14 at 06:10
5

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.

Pascal Dimassimo
  • 6,908
  • 1
  • 37
  • 34
2

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.

Shashikant Kore
  • 4,952
  • 3
  • 31
  • 40
  • Regarding the TermVectorMapper -> Do you know if it is possible with Solr? Regarding the search-order example: couldn't this be done with Solr's grouping feature: http://blog.jteam.nl/2009/10/20/result-grouping-field-collapsing-with-solr/ – Karussell May 18 '10 at 17:30
  • TVMapper is core to Lucene. Why go through extra layer when you can directly read from the source? And I'm not exactly looking for grouping. I want all results from each of the book store, but I want the order to be a close approximation of round-robin with some additional criteria. – Shashikant Kore May 19 '10 at 05:11
2

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

  • really? here is the link http://wiki.apache.org/lucene-java/NearRealtimeSearch ... i thought it is available for solr too – Karussell May 24 '10 at 17:13
0

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

Glenn
  • 7,874
  • 3
  • 29
  • 38