{"id":66,"date":"2011-06-25T19:34:16","date_gmt":"2011-06-25T17:34:16","guid":{"rendered":"http:\/\/www.extradrm.com\/?p=66"},"modified":"2020-10-09T22:21:34","modified_gmt":"2020-10-09T20:21:34","slug":"nosql-lucene-and-solr","status":"publish","type":"post","link":"https:\/\/www.extradrm.com\/?p=66","title":{"rendered":"NoSQL, Lucene and Solr"},"content":{"rendered":"<h1>NoSQL, Lucene and Solr<\/h1>\n<div>\n<p>Posted by <cite><a title=\"Posts by Grant Ingersoll\" href=\"http:\/\/www.lucidimagination.com\/blog\/author\/grant-ingersoll\/\">Grant Ingersoll<\/a><\/cite><\/p>\n<\/div>\n<div>\n<p>The other day, <a href=\"http:\/\/www.redmonk.com\/cote\/2010\/04\/29\/makeall003\/?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+PeopleOverProcess+%28People+Over+Process+by+Cote%27%29\">Michael Cot\u00e9 asked me<\/a> where Apache Lucene and Solr fit in with the NoSQL movement (having heard about the <a href=\"http:\/\/www.lucidimagination.com\/blog\/2010\/04\/29\/for-the-guardian-solr-is-the-new-database\/\">Guardian\u2019s<\/a> use of Solr), to which I replied:\u00a0 I haven\u2019t 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.)\u00a0 We just didn\u2019t have a  fun name for it \u201cback in the day\u201d.<\/p>\n<p>All kidding aside and at the risk of jumping on the buzzword bandwagon, let\u2019s take a look at <a href=\"http:\/\/en.wikipedia.org\/wiki\/NoSQL\">Wikipedia\u2019s definition of NoSQL<\/a>:<\/p>\n<blockquote><p><strong>NoSQL<\/strong> (Not only SQL) is a movement promoting a loosely defined  class of non-<a title=\"Relational model\" href=\"http:\/\/en.wikipedia.org\/wiki\/Relational_model\">relational<\/a> data stores that break with a  long history of relational databases. These data stores may not require  fixed <a title=\"Database schema\" href=\"http:\/\/en.wikipedia.org\/wiki\/Database_schema\">table schemas<\/a>, usually avoid <a title=\"Join (SQL)\" href=\"http:\/\/en.wikipedia.org\/wiki\/Join_%28SQL%29\">join<\/a> operations and typically <a title=\"Scalability\" href=\"http:\/\/en.wikipedia.org\/wiki\/Scalability#Scale_horizontally_.28scale_out.29\">scale horizontally<\/a>.<\/p><\/blockquote>\n<p>Now let\u2019s apply that definition to Lucene (we\u2019ll get to Solr in a moment):<\/p>\n<ol>\n<li>NoSQL \u2013 Check.\u00a0 Ironically, many people have also layered SQL on top  of Lucene as well.\u00a0 Guess we should also argue for inclusion in the  No-NoSQL (as <a href=\"http:\/\/www.redmonk.com\/cote\/2010\/04\/29\/makeall003\/?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+PeopleOverProcess+%28People+Over+Process+by+Cote%27%29\">Cot\u00e9<\/a> suggests) movement too!<\/li>\n<li>Loosely defined class of non-relational data stores that break w\/  long history of relational dbs: Check.\u00a0 Once again, ironically, Lucene  covers both sides of the aisle here.<\/li>\n<li>No fixed schemas: Been there, done that, bought the t-shirt.\u00a0 Once again, Lucene also supports fixed schemas as well.<\/li>\n<li>Avoid joins:\u00a0 Check.\u00a0 Denormalization frees your mind.\u00a0 (at least in many cases).\u00a0 You can do joins in Lucene with some work.<\/li>\n<li>Scales horizontally:\u00a0 Yes and no.\u00a0 Let\u2019s be honest, Lucene scales  quite well, but you\u2019re going to have to do some work to make it so.\u00a0  Enter Solr.<\/li>\n<\/ol>\n<p>Since Solr is \u201cLucene Best Practices\u201d all wrapped up in an easy to  use server, it covers items 1-4 no problem.\u00a0 And, get this, it also  scales horizontally in terms of both data size and query volume.\u00a0 Plus,  with the recent addition of <a href=\"http:\/\/hadoop.apache.org\/zookeeper\">Apache ZooKeeper<\/a> to Solr (aka <a href=\"http:\/\/wiki.apache.org\/solr\/SolrCloud\">Solr Cloud<\/a>),  scaling has never been easier.\u00a0 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.<\/p>\n<p>NoSQL never looked so good.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>NoSQL, Lucene and Solr Posted by Grant Ingersoll The other day, Michael Cot\u00e9 asked me where Apache Lucene and Solr fit in with the NoSQL movement (having heard about the Guardian\u2019s use of Solr),&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":2845,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,17],"tags":[352],"youtube_video":null,"_links":{"self":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/66"}],"collection":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=66"}],"version-history":[{"count":0,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/66\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/media\/2845"}],"wp:attachment":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}