Method: Chewy::Search::QueryProxy#must

Defined in:
lib/chewy/search/query_proxy.rb

#must(query_hash) ⇒ Chewy::Search::Request #must { ... } ⇒ Chewy::Search::Request

Executes Parameters::QueryStorage#must in the scope of newly created request object.

Overloads:

Returns:

See Also:



102
103
104
105
106
107
108
# File 'lib/chewy/search/query_proxy.rb', line 102

%i[must should must_not].each do |method|
  define_method method do |query_hash = nil, &block|
    raise ArgumentError, "Please provide a parameter or a block to `#{method}`" unless query_hash || block

    @request.send(:modify, @parameter_name) { send(method, block || query_hash) }
  end
end