Skip to content

Instantly share code, notes, and snippets.

@jraczak
Created August 13, 2012 16:08
Show Gist options
  • Select an option

  • Save jraczak/3342220 to your computer and use it in GitHub Desktop.

Select an option

Save jraczak/3342220 to your computer and use it in GitHub Desktop.
Solr Search for Dwellings
#dwellings_controller.rb
def index
@result = Dwelling.search("545")
@dwellings = @results.result
puts @dwellings.to_yaml
end
#dwelling.rb
def self.search(q)
@search = Sunspot.search(Dwelling) do
fulltext q
paginate :page => 1, :per_page => per_page
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment