Module: Insuggest::Travel::ClassMethods
- Defined in:
- lib/insuggest/travel.rb
Instance Method Summary collapse
Instance Method Details
#get_index_name ⇒ Object
15 16 17 |
# File 'lib/insuggest/travel.rb', line 15 def get_index_name "travels" end |
#repository ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/insuggest/travel.rb', line 19 def repository index_name = get_index_name Elasticsearch::Persistence::Repository.new do index index_name type :travel end end |
#search(days, cover, age, size = 100) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/insuggest/travel.rb', line 27 def search(days, cover, age, size=100) self.repository.search({ size: size, query: { bool: { must: [ { match: { days: days } }, { match: { cover: cover } }, { range: { from: { lte: age } } }, { range: { to: { gte: age } } } ] } } }) end |