Module: EagleSearch::Model::ClassMethods

Defined in:
lib/eagle_search/model.rb

Instance Method Summary collapse

Instance Method Details

#create_indexObject



12
13
14
# File 'lib/eagle_search/model.rb', line 12

def create_index
  eagle_search_index.create
end

#delete_indexObject



16
17
18
# File 'lib/eagle_search/model.rb', line 16

def delete_index
  eagle_search_index.delete
end

#eagle_search(settings = {}) ⇒ Object



4
5
6
# File 'lib/eagle_search/model.rb', line 4

def eagle_search(settings = {})
  @index = EagleSearch::Index.new(self, settings)
end

#eagle_search_indexObject



8
9
10
# File 'lib/eagle_search/model.rb', line 8

def eagle_search_index
  @index
end

#index_infoObject



24
25
26
# File 'lib/eagle_search/model.rb', line 24

def index_info
  eagle_search_index.info
end

#refresh_indexObject



20
21
22
# File 'lib/eagle_search/model.rb', line 20

def refresh_index
  eagle_search_index.refresh
end

#reindexObject



34
35
36
# File 'lib/eagle_search/model.rb', line 34

def reindex
  eagle_search_index.reindex
end

#search(term, options = {}) ⇒ Object



28
29
30
31
32
# File 'lib/eagle_search/model.rb', line 28

def search(term, options = {})
  interpreter = EagleSearch::Interpreter.new(@index, term, options)
  search_response = EagleSearch.client.search index: eagle_search_index.alias_name, body: interpreter.payload
  EagleSearch::Response.new(self, search_response, options)
end