Class: Chewy::Query::Nodes::Equal
- Defined in:
- lib/chewy/query/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/nodes/equal.rb', line 16 def initialize name, value, *args @name = name.to_s @value = value @options = args. execution = EXECUTION[args.first.to_sym] if args.first @options[:execution] = execution if execution end |
Instance Method Details
#__render__ ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/chewy/query/nodes/equal.rb', line 24 def __render__ filter = (@value.is_a?(Array) ? :terms : :term) body = {@name => @value} body.merge!(@options.slice(:execution)) if filter == :terms body.merge!(_cache: !!@options[:cache]) if @options.key?(:cache) {filter => body} end |