Your SlideShare is downloading. ×
0
Solr and sunspot
Learnings from RedBubble
Paul Coia
Who am I?
What are Solr and sunspot?
Why do we use them?
What is Solr?
Solr is Apache’s search engine
Wraps and enhances Lucene
Java webapp (Tomcat)
And sunspot?
 sunspot: Gem for Solr communication
 sunspot-rails: Plugin for Rails
 Indexing DSL
 Searching DSL
 (Mag...
What attracted us to Solr?
 Facets
 Incremental index updates
 Scalability, master + slave(s)
 Easy to add new fields ...
DSL - Indexing
class Post < ActiveRecord::Base
searchable do
text :title
text :body
string :sort_title do
title.downcase.s...
DSL - Searching
@search = Post.search(:include => :comments) do |s|
s.fulltext params[:q], :fields => [:title, :body]
s.fa...
Facets
DSL - Facetting
@search.facet(:tags).rows.each do |tag_facet|
tag_facet.value
tag_facet.count
end
Performance
 JVM memory
 Cache sizes
 Search warming
 Auto Commit settings/Replication
Links
 http://lucene.apache.org/solr/
 https://github.com/outoftime/sunspot/wiki
 http://www.lucidimagination.com/
Upcoming SlideShare
Loading in...5
×

Solr and sunspot

509

Published on

A presentation I gave to Ruby on Rails Oceania in 2011 about our use of Solr and Sunspot at Redbubble

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
509
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Facetting:Killer featureSolr has facetting.Solrfacetting has great support on the client side (sunspot)In Sphinx it is just not really thereFacets can only be ids and it requires multiple client side callsIncremental updates:Update a model, changes can be instantly in the indexTrivial to controlScalabilitySolr master with two slaves, fronted by varnishTrivial replicationEasy to add new fieldsDynamic fieldsNo need to recreate indexNo need to sync code with Solr, gracefully ignores extra valuesCan add new classes to index with no restartDo everything in Ruby:Derived fieldsRelationshipsDecoupled from DBSignificant model refactoring which didn’t require changes to indexing codeComms between app and SolrMakes most of the above much simpler having only two parties involvedHTTP interface for both indexing and searchingNo SQL involved
  • Index column typeDerivable dataMultiple value columns, used for facetting
  • From the user perspective, faceted search (also called faceted navigation, guided navigation, or parametric search) break up search results into multiple categories, typically showing counts for each, and allow the user to &quot;drill down&quot; or further restrict their search results based on those facets.Used on e-Commerce sites for categorisation/refinementUsed on RedBubble for top tags and available products
  • Transcript of "Solr and sunspot"

    1. 1. Solr and sunspot Learnings from RedBubble Paul Coia
    2. 2. Who am I? What are Solr and sunspot? Why do we use them?
    3. 3. What is Solr? Solr is Apache’s search engine Wraps and enhances Lucene Java webapp (Tomcat)
    4. 4. 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
    5. 5. 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)
    6. 6. DSL - Indexing class 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 end end
    7. 7. 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, :asc end … @search.results.each do |result| … end
    8. 8. Facets
    9. 9. DSL - Facetting @search.facet(:tags).rows.each do |tag_facet| tag_facet.value tag_facet.count end
    10. 10. Performance  JVM memory  Cache sizes  Search warming  Auto Commit settings/Replication
    11. 11. Links  http://lucene.apache.org/solr/  https://github.com/outoftime/sunspot/wiki  http://www.lucidimagination.com/
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×