More Related Content


Getting Started with Solr

  1. Getting Started with Solr an open source search platform Travis Carlson
  2. Search Engine Concepts ● Documents & Fields ● Inverted Index ● Analysis / Tokenization ● Precision vs. Recall ● Faceting
  3. Document Model Solr indexes documents which contain fields (like a NoSQL database)
  4. Diagram from Inverted Index
  5. Diagram from How is it so fast?
  6. Analysis / Tokenization
  7. Index Query Analysis / Tokenization
  8. Precision vs. Recall There is generally a tradeoff to be made between false positives and false negatives
  9. Precision vs. Recall
  10. Faceting
  11. Let’s take a tour
  12. Getting Started Start up Solr and create a new “core” ./bin/solr start ./bin/solr create -c films -d basic_configs Customize the schema for our document type edit server/solr/films/conf/schema.xml ./bin/solr restart Import our documents ./bin/post -c films example/films/films.json Open the Admin UI to run some test searches open http://localhost:8983/solr/#/films/query <field name="name" type="text_en"/> <field name="directed_by" type="text_general" multiValued="true"/> <field name="initial_release_date" type="tdate"/> <field name="genre" type="text_en" multiValued="true"/> <field name="genre-facet" type="string" multiValued="true" stored=”false”/> <copyField source="genre" dest="genre-facet"/>
  13. Example Searches Directed by Steven Spielberg or John Singleton: http://localhost:8983/solr/films/select?q=directed_by%3A(spielberg+OR+singleton)&fl=name Faceted by genre: http://localhost:8983/solr/films/select?q=*%3A*&facet=true&facet.field=genre-facet&fl=id Thriller movies since 2010: http://localhost:8983/solr/films/select?q=genre%3Athriller+AND+initial_release_date%3A%5B2010-01-01T00%3A00%3A00Z+TO+NOW%5D
  14. APIs make things easier SolrClient solr = new HttpSolrClient("http://localhost:8983/solr/films"); SolrQuery query = new SolrQuery(); query.setQuery("directed_by:(spielberg OR singleton)"); query.setFields("name"); SolrDocumentList list = solr.query(query).getResults();
  15. Going Further ● Custom Request Handlers ● Field Boosts ● Matching Excerpts (highlighting) ● Auto-suggest / Spellcheck / “Did you mean” ● “More like this” ● Geospatial queries
  16. Going Further Download Reference Guide
  17. Open Source svn checkout Apache License, Version 2.0