solr and sunspot
DESCRIPTION
A presentation I gave to Ruby on Rails Oceania in 2011 about our use of Solr and Sunspot at RedbubbleTRANSCRIPT
![Page 1: Solr and sunspot](https://reader036.vdocuments.net/reader036/viewer/2022081907/547afee9b4af9f4c738b468d/html5/thumbnails/1.jpg)
Solr and sunspotLearnings from RedBubblePaul Coia
![Page 2: Solr and sunspot](https://reader036.vdocuments.net/reader036/viewer/2022081907/547afee9b4af9f4c738b468d/html5/thumbnails/2.jpg)
Who am I?
What are Solr and sunspot?
Why do we use them?
![Page 3: Solr and sunspot](https://reader036.vdocuments.net/reader036/viewer/2022081907/547afee9b4af9f4c738b468d/html5/thumbnails/3.jpg)
What is Solr?Solr is Apache’s search engine
Wraps and enhances Lucene
Java webapp (Tomcat)
![Page 4: Solr and sunspot](https://reader036.vdocuments.net/reader036/viewer/2022081907/547afee9b4af9f4c738b468d/html5/thumbnails/4.jpg)
And sunspot ?sunspot: Gem for Solr communication
sunspot-rails: Plugin for Rails
Indexing DSL
Searching DSL
(Magic) Dynamic index schema for Solr
Development convenience scripts
Will_paginate integration
![Page 5: Solr and sunspot](https://reader036.vdocuments.net/reader036/viewer/2022081907/547afee9b4af9f4c738b468d/html5/thumbnails/5.jpg)
What attracted us to Solr?Facets
Incremental index updates
Scalability, master + slave(s)
Easy to add new fields (sunspot magic schema)
Do everything in Ruby
Communication between app and Solr (no DB)
![Page 6: Solr and sunspot](https://reader036.vdocuments.net/reader036/viewer/2022081907/547afee9b4af9f4c738b468d/html5/thumbnails/6.jpg)
DSL - Indexingclass Post < ActiveRecord::Base searchable do text :title text :body string :sort_title do title.downcase.sub(/^an?|the)\W+/, ‘’) end string :tags, :multiple => true do tags.split(",") unless tags.nil? end endend
![Page 7: Solr and sunspot](https://reader036.vdocuments.net/reader036/viewer/2022081907/547afee9b4af9f4c738b468d/html5/thumbnails/7.jpg)
DSL - Searching@search = Post.search(:include => :comments) do |s| s.fulltext params[:q], :fields => [:title, :body] s.facet :tags, :sort => :count s.order_by :sort_title, :ascend
…
@search.results.each do |result|
…
end
![Page 8: Solr and sunspot](https://reader036.vdocuments.net/reader036/viewer/2022081907/547afee9b4af9f4c738b468d/html5/thumbnails/8.jpg)
Facets
![Page 9: Solr and sunspot](https://reader036.vdocuments.net/reader036/viewer/2022081907/547afee9b4af9f4c738b468d/html5/thumbnails/9.jpg)
DSL - [email protected](:tags).rows.each do |tag_facet| tag_facet.value tag_facet.countend
![Page 10: Solr and sunspot](https://reader036.vdocuments.net/reader036/viewer/2022081907/547afee9b4af9f4c738b468d/html5/thumbnails/10.jpg)
Performance JVM memory
Cache sizes
Search warming
Auto Commit settings/Replication
![Page 11: Solr and sunspot](https://reader036.vdocuments.net/reader036/viewer/2022081907/547afee9b4af9f4c738b468d/html5/thumbnails/11.jpg)
Linkshttp://lucene.apache.org/solr/
https://github.com/outoftime/sunspot/wiki
http://www.lucidimagination.com/