Class: Elasticband::Filter::Query

Inherits:
Elasticband::Filter show all
Defined in:
lib/elasticband/filter/query.rb

Constant Summary

Constants inherited from Elasticband::Filter

PARSE_FILTERS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Elasticband::Filter

parse, #parse

Constructor Details

#initialize(query, options = {}) ⇒ Query

Returns a new instance of Query.



6
7
8
9
# File 'lib/elasticband/filter/query.rb', line 6

def initialize(query, options = {})
  self.query = query
  self.options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/elasticband/filter/query.rb', line 4

def options
  @options
end

#queryObject

Returns the value of attribute query.



4
5
6
# File 'lib/elasticband/filter/query.rb', line 4

def query
  @query
end

Instance Method Details

#to_hObject



11
12
13
14
15
# File 'lib/elasticband/filter/query.rb', line 11

def to_h
  return query_hash if options.blank?

  { fquery: query_hash.merge!(options) }
end