Over a million developers have joined DZone.

NoSQL, Lucene and Solr

DZone's Guide to

NoSQL, Lucene and Solr

· Java Zone ·
Free Resource

Verify, standardize, and correct the Big 4 + more – name, email, phone and global addresses – try our Data Quality APIs now at Melissa Developer Portal!

The other day, Michael Coté asked me where Apache Lucene and Solr fit in with the NoSQL movement (having heard about the Guardian’s use of Solr), to which I replied:  I haven’t used SQL in any significant way since I started using Lucene in 2004 (and I started my career doing Oracle DBA work, etc. way back when.)  We just didn’t have a fun name for it “back in the day”.

All kidding aside and at the risk of jumping on the buzzword bandwagon, let’s take a look at Wikipedia’s definition of NoSQL:

NoSQL (Not only SQL) is a movement promoting a loosely defined class of non-relational data stores that break with a long history of relational databases. These data stores may not require fixed table schemas, usually avoid join operations and typically scale horizontally.

Now let’s apply that definition to Lucene (we’ll get to Solr in a moment):

  1. NoSQL – Check.  Ironically, many people have also layered SQL on top of Lucene as well.  Guess we should also argue for inclusion in the No-NoSQL (as Coté suggests) movement too!
  2. Loosely defined class of non-relational data stores that break w/ long history of relational dbs: Check.  Once again, ironically, Lucene covers both sides of the aisle here.
  3. No fixed schemas: Been there, done that, bought the t-shirt.  Once again, Lucene also supports fixed schemas as well.
  4. Avoid joins:  Check.  Denormalization frees your mind.  (at least in many cases).  You can do joins in Lucene with some work.
  5. Scales horizontally:  Yes and no.  Let’s be honest, Lucene scales quite well, but you’re going to have to do some work to make it so.  Enter Solr.

Since Solr is “Lucene Best Practices” all wrapped up in an easy to use server, it covers items 1-4 no problem.  And, get this, it also scales horizontally in terms of both data size and query volume.  Plus, with the recent addition of Apache ZooKeeper to Solr (aka Solr Cloud), scaling has never been easier.  At the end of the day, you get all the benefits of NoSQL (under an eventually consistent model) plus you get built in things like free text search, faceting, spell checking, similar item search, hit highlighting and a whole host of other things that have been proven out in thousands of installations around the world.

NoSQL never looked so good.


Developers! Quickly and easily gain access to the tools and information you need! Explore, test and combine our data quality APIs at Melissa Developer Portal – home to tools that save time and boost revenue. Our APIs verify, standardize, and correct the Big 4 + more – name, email, phone and global addresses – to ensure accurate delivery, prevent blacklisting and identify risks in real-time.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}