Class: Elastic::Core::QueryConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic/core/query_config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#groupsObject

Returns the value of attribute groups.



3
4
5
# File 'lib/elastic/core/query_config.rb', line 3

def groups
  @groups
end

#limitObject

Returns the value of attribute limit.



3
4
5
# File 'lib/elastic/core/query_config.rb', line 3

def limit
  @limit
end

#middleware_optionsObject

Returns the value of attribute middleware_options.



3
4
5
# File 'lib/elastic/core/query_config.rb', line 3

def middleware_options
  @middleware_options
end

#offsetObject

Returns the value of attribute offset.



3
4
5
# File 'lib/elastic/core/query_config.rb', line 3

def offset
  @offset
end

#queryObject

Returns the value of attribute query.



3
4
5
# File 'lib/elastic/core/query_config.rb', line 3

def query
  @query
end

#sortObject

Returns the value of attribute sort.



3
4
5
# File 'lib/elastic/core/query_config.rb', line 3

def sort
  @sort
end

Class Method Details

.initial_configObject



5
6
7
8
9
10
11
# File 'lib/elastic/core/query_config.rb', line 5

def self.initial_config
  new.tap do |config|
    config.query = Elastic::Nodes::Boolean.new
    config.groups = []
    config.middleware_options = HashWithIndifferentAccess.new
  end
end

Instance Method Details

#cloneObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/elastic/core/query_config.rb', line 13

def clone
  self.class.new.tap do |clone|
    clone.query = @query.clone
    clone.groups = @groups.dup
    clone.limit = @limit
    clone.offset = @offset
    clone.sort = @sort.try(:clone)
    clone.middleware_options = @middleware_options.dup
  end
end