Method: Sunspot::Rails::Searchable::ClassMethods#solr_search

Defined in:
lib/sunspot/rails/searchable.rb

#solr_search(options = {}, &block) ⇒ Object

Search for instances of this class in Solr. The block is delegated to the Sunspot.search method - see the Sunspot documentation for the full API.

Example

Post.search(:include => [:blog]) do
  keywords 'best pizza'
  with :blog_id, 1
  order :updated_at, :desc
  facet :category_ids
end

Options

:include

Specify associations to eager load

:select

Specify columns to select from database when loading results

Returns

Sunspot::Search

Object containing results, totals, facets, etc.



170
171
172
173
174
# File 'lib/sunspot/rails/searchable.rb', line 170

def solr_search(options = {}, &block)
  solr_execute_search(options) do
    Sunspot.new_search(self, &block)
  end
end