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

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

Instance Method Summary collapse

Instance Method Details

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



43
44
45
# File 'lib/thinking_sphinx/active_record/base.rb', line 43

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

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



47
48
49
# File 'lib/thinking_sphinx/active_record/base.rb', line 47

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

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



51
52
53
# File 'lib/thinking_sphinx/active_record/base.rb', line 51

def sphinx_search_count(query = nil, options = {})
  search_for_ids(query, options).total_entries
end

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



55
56
57
58
59
# File 'lib/thinking_sphinx/active_record/base.rb', line 55

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

#sphinx_search_noneObject



61
62
63
# File 'lib/thinking_sphinx/active_record/base.rb', line 61

def sphinx_search_none
  merge_search ThinkingSphinx.search, nil, none: true
end