Class: ChewyQuery::Builder::Nodes::Equal
- Defined in:
- lib/chewy_query/builder/nodes/equal.rb
Constant Summary collapse
- EXECUTION =
{ :| => :or, :or => :or, :& => :and, :and => :and, :b => :bool, :bool => :bool, :f => :fielddata, :fielddata => :fielddata, }
Instance Method Summary collapse
- #__render__ ⇒ Object
-
#initialize(name, value, *args) ⇒ Equal
constructor
A new instance of Equal.
Methods inherited from Expr
Methods inherited from Base
Constructor Details
#initialize(name, value, *args) ⇒ Equal
Returns a new instance of Equal.
16 17 18 19 20 21 22 |
# File 'lib/chewy_query/builder/nodes/equal.rb', line 16 def initialize(name, value, *args) @name = name.to_s @value = value = args. execution = EXECUTION[args.first.to_sym] if args.first [:execution] = execution if execution end |
Instance Method Details
#__render__ ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/chewy_query/builder/nodes/equal.rb', line 24 def __render__ filter = (@value.is_a?(Array) ? :terms : :term) body = { @name => @value } body.merge!(.slice(:execution)) if filter == :terms body.merge!(_cache: !![:cache]) if .key?(:cache) { filter => body } end |