Skip to content

Commit 884de11

Browse files
jaribkarmi
authored andcommitted
[MODEL] Added, that options are passed to SearchRequest in search
Closes elastic#3
1 parent c2d4f17 commit 884de11

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

elasticsearch-model/lib/elasticsearch/model/searching.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ module ClassMethods
9595
# Article.search '{"query" : { "match_all" : {} }}'
9696
#
9797
def search(query_or_payload, options={})
98-
search = SearchRequest.new(self, query_or_payload, options={})
98+
search = SearchRequest.new(self, query_or_payload, options)
9999

100100
Response::Response.new(self, search)
101101
end

elasticsearch-model/test/unit/searching_test.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ def self.document_type; 'bar'; end
2323
.expects(:new).with do |klass, query, options|
2424
assert_equal DummySearchingModel, klass
2525
assert_equal 'foo', query
26+
assert_equal({default_operator: 'AND'}, options)
2627
end
2728
.returns( stub('search') )
2829

29-
DummySearchingModel.search 'foo'
30+
DummySearchingModel.search 'foo', default_operator: 'AND'
3031
end
3132

3233
should "not execute the search" do

0 commit comments

Comments
 (0)