Class: Stretchy::Filters::TermsFilter

Inherits:
Base
  • Object
show all
Defined in:
lib/stretchy/filters/terms_filter.rb

Constant Summary

Constants included from Utils::Contract

Utils::Contract::ASSERTIONS, Utils::Contract::DECAY_FUNCTIONS, Utils::Contract::DISTANCE_FORMAT

Instance Method Summary collapse

Methods included from Utils::Contract

included, #require_one, #validate!

Constructor Details

#initialize(field, terms) ⇒ TermsFilter

Returns a new instance of TermsFilter.



10
11
12
13
14
# File 'lib/stretchy/filters/terms_filter.rb', line 10

def initialize(field, terms)
  @field = field
  @terms = Array(terms)
  validate!
end

Instance Method Details

#to_searchObject



16
17
18
19
20
21
22
# File 'lib/stretchy/filters/terms_filter.rb', line 16

def to_search
  {
    terms: {
      @field => @terms
    }
  }
end