Class: Elastic::Nodes::Match

Inherits:
Base
  • Object
show all
Includes:
Concerns::Boostable, Concerns::FieldQuery
Defined in:
lib/elastic/nodes/match.rb

Constant Summary collapse

MATCH_MODES =
[:boolean, :phrase, :phrase_prefix]

Instance Attribute Summary collapse

Attributes included from Concerns::FieldQuery

#field

Attributes included from Concerns::Boostable

#boost

Instance Method Summary collapse

Methods included from Concerns::FieldQuery

#render_field

Methods inherited from Base

#==, #handle_result, #traverse

Methods included from Support::Traversable

#pick_nodes, #traverse

Instance Attribute Details

#modeObject

Returns the value of attribute mode.



9
10
11
# File 'lib/elastic/nodes/match.rb', line 9

def mode
  @mode
end

#queryObject

Returns the value of attribute query.



8
9
10
# File 'lib/elastic/nodes/match.rb', line 8

def query
  @query
end

Instance Method Details

#cloneObject



22
23
24
# File 'lib/elastic/nodes/match.rb', line 22

def clone
  prepare_clone(super)
end

#render(_options = {}) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/elastic/nodes/match.rb', line 30

def render(_options = {})
  hash = { 'query' => @query }

  match_mode = @mode.nil? || @mode == :boolean ? 'match' : "match_#{@mode}"

  { match_mode => { render_field(_options) => render_boost(hash) } }
end

#simplifyObject



26
27
28
# File 'lib/elastic/nodes/match.rb', line 26

def simplify
  prepare_clone(super)
end