Skip to content

Commit db0e552

Browse files
authored
Merge pull request #3758 from projectblacklight/solr_repository_no_args
Allow Blacklight::Solr::Repository#search to be called with no args
2 parents 2e58b9e + 0c3b09a commit db0e552

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/blacklight/solr/repository.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def search pos_params = nil, path: nil, params: nil, **kwargs
3030
Blacklight.deprecation.warn("Passing positional arguments to search() is deprecated. Use the params kwarg instead.")
3131
end
3232

33-
request_params = (params || pos_params).reverse_merge(kwargs).reverse_merge({ qt: blacklight_config.qt })
33+
request_params = (params || pos_params || {}).reverse_merge(kwargs).reverse_merge({ qt: blacklight_config.qt })
3434

3535
send_and_receive(path || default_search_path(request_params), request_params)
3636
end

spec/models/blacklight/solr/repository_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@
8787
expect(subject.search(params: {})).to be_a Blacklight::Solr::Response
8888
end
8989

90+
it "can be called with no args" do
91+
blacklight_config.solr_path = 'xyz'
92+
allow(subject.connection).to receive(:send_and_receive).with('xyz', anything).and_return(mock_response)
93+
expect(subject.search).to be_a Blacklight::Solr::Response
94+
end
95+
9096
it "uses the default solr path" do
9197
allow(subject.connection).to receive(:send_and_receive).with('select', anything).and_return(mock_response)
9298
expect(subject.search(params: {})).to be_a Blacklight::Solr::Response

0 commit comments

Comments
 (0)