Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Apache Solr! Enterprise Search Solutions at your Fingertips!


Published on

Get an overview of Apache Solr as an enterprise search server. Get to know the available alternatives and why the Solr is cool! Get Excited! Enterprise Search Solutions are ready to pick.

Published in: Technology

Apache Solr! Enterprise Search Solutions at your Fingertips!

  1. 1. Apache-Solr!Enterprise Search Solutionsat your Fingertips! Murshed Ahmmad Khan@usamurai,
  2. 2. Presented at phpXpertsseminar 2011…
  3. 3. Enterprise Search Server The criteria…
  4. 4. Fast
  5. 5. Flexible
  6. 6. Powerful
  7. 7. Scalable
  8. 8. Relevant Results
  9. 9. Production ready & Easy deployment
  10. 10. What’s in yourmind, the name… ??
  11. 11. Apache Solr!Fits all the above mentioned criteria…
  12. 12. Solr, What is it…?q O pen Source, Java applicationq R uns as a standalone full-text search server within any servlet containerq U ses Lucene Java search library as its core
  13. 13. SOLR WORK FLOW…
  14. 14. Solr History…q D eveloped at CNET Networks by Yonik Seeleyq D onated to ASF (Apache Software Foundation) in early 2006
  15. 15. Solr History…(2)q I ncubation period ended in january 2007 (v-1.2 released)q S olr is now maintained as a subproject of Lucene
  16. 16. Solr - Features…
  17. 17. Powerful Full-Text search…
  18. 18. Hit Highlighting…
  19. 19. Faceted Search…
  20. 20. Tag Clouds…
  21. 21. Geo-spatial search…
  22. 22. Solr – Features (cont..)q  Database integrationq  Rich document (Word, PDF) handlingq  REST-like HTTP/XML, JSON APIs (so, you can code virtually in any language)
  23. 23. CLIENT API SUPPORT…q  Java (SolrJ),q  .NET (solrnet, SolrSharp),q  PHP (SolPHP),q  Python (SolPython),q  Ruby(on Rails) (rsolr, acts-as-solr, sunspot),q  C++,q  XML/HTTP,q  JSON/HTTP (AJAX Solr) ++q  PERL(SolPerl)
  24. 24. Solr - Features… (cont…)q  Flexible configurationq  Extensive Plugin architecture for advanced customizationq  Scalable distributed search, dynamic clustering, index replication
  25. 25. Alternatives to Solrq Use Google (GSA – has integration problems).q  FAST (Stopped supporting linux)q  Use Lucene (write code on top of that)
  26. 26. Alternatives to Solr…(2)q  Use your Database (has performance issues)q  Sphinx (written in C++)q  Commercial Libraries (e.g.  Write your own
  27. 27. Who UseSolr/Lucene?
  28. 28. Who use Solr/Lucene…More names:
  29. 29. OPERATING SYSTEM SUPPORTq All with a Java VM, including:q Linux (all versions)q Windows (all versions)q MacOS (all versions)q Unix variants
  30. 30. APP SERVER SUPPORTq Apache Tomcat,q Jetty,q Resin,q WebLogicTM,q WebSphereTM,q GlassFish,q dmServerTM,q JBossTM and many moreq Java JDK 1.5 or later [requirement]
  31. 31. INSTALLATION1.  Download the latest version of: apache-solr & tomcat2. Extract it:$tar -xzvf ./apache-solr-1.4.1.tgz$tar -xzvf ./apache-tomcat-6.0.35.tar.gz
  32. 32. INSTALLATION3. copy the solr.war file in the tomcatwebapps folder:$ cp apache-solr-1.4.1/dist/apache-solr-1.4.1.war  apache-tomcat-6.0.35/webapps/solr.war4. copy the example/solr directory into thetomcat home directory$ cp -r apache-solr-1.4.1/example/solr .
  33. 33. INSTALLATION5. start the tomcat server$ ./bin/startup.sh6. Visit http://localhost:8080/solr/admin/
  34. 34. YOU ARE DONE…
  35. 35. CREATE SCHEMA.XML<field name="id" type="string" indexed="true"stored="true" required="true" /><field name="service" type="string" indexed="true"stored="true" required="true" /><field name="contentType" type="string" indexed="true"stored="true" required="true" /><field name="dbId" type="long" indexed="true"stored="true" /><field name="content" type="text" indexed="true"stored="true" /><copyField source="*" dest=”all” />
  36. 36. INDEX DOCUMENTS (INDEXER)The Common Loop
  37. 37. INDEX DOCUMENTS1.  </add>Add single/multiple documents$doc = new SolrSimpleDocument( array( new SolrSimpleField(id, ’aawaj-profile- . $user->id), new SolrSimpleField(service, aawaj), new SolrSimpleField(contentType, profile), new SolrSimpleField(dbId, (string)$user->id) )); $this->solr->add($doc);
  38. 38. INDEX DOCUMENTS2. </commit>Commit multiple documents atonce.$this->solr->commit();
  39. 39. INDEX DOCUMENTS3. </optimize>Optimize, for performanceimprovement$this->solr->optimize();
  41. 41. QUERY SYNTAXES (RDMS)SELECT * FROM post WHERE(topic LIKE ‘%apache%’ ORauthor LIKE ‘%kabir%’)OR (topic LIKE ‘%solr%’ ORauthor LIKE ‘%frank%’) ORDERBY id DESC
  42. 42. QUERY SYNTAXES (SOLR)Topic:"The Right Way" ANDauthor:WrongGuy
  43. 43. BOOSTING TERMS()topic: "jakartaapache"^4 "ApacheLucene"
  44. 44. FUZZY SEARCH (SOLR)topic:roam~ (similar inspelling roam)matches foam roams, based onthe Levenshtein Distance, or EditDistance algorithm
  45. 45. PROXIMITY SEARCH (SOLR)“jakarta apache”~10search for a "apache" and"jakarta" within 10 words ofeach other in a document
  47. 47. YES, YOU CAN!q Apache NUTCH, already thereq Open source, Web-search software project.q Based on Solr...
  48. 48. INTERESTED? READ MORE…ØØØ scoring.htmlØ queryparsersyntax.htmlØ search-at-the-speed-of-light apache-solr
  49. 49. WHO AM I… murshed ahmmad Khanhead of development,
  50. 50. THANKS…Questions?