Module: ThinkingSphinx::ActiveRecord::Base::ClassMethods

Defined in:
lib/thinking_sphinx/active_record/base.rb

Instance Method Summary collapse

Instance Method Details

#facets(query = nil, options = {}) ⇒ Object



15
16
17
# File 'lib/thinking_sphinx/active_record/base.rb', line 15

def facets(query = nil, options = {})
  merge_search ThinkingSphinx.facets, query, options
end

#search(query = nil, options = {}) ⇒ Object



19
20
21
# File 'lib/thinking_sphinx/active_record/base.rb', line 19

def search(query = nil, options = {})
  merge_search ThinkingSphinx.search, query, options
end

#search_count(query = nil, options = {}) ⇒ Object



23
24
25
# File 'lib/thinking_sphinx/active_record/base.rb', line 23

def search_count(query = nil, options = {})
  search(query, options).total_entries
end

#search_for_ids(query = nil, options = {}) ⇒ Object



27
28
29
30
31
# File 'lib/thinking_sphinx/active_record/base.rb', line 27

def search_for_ids(query = nil, options = {})
  ThinkingSphinx::Search::Merger.new(
    search(query, options)
  ).merge! nil, :ids_only => true
end