Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use RSolr::Client#request method directly

Fixes obscure method lookup issues that occur when calling the
:select method via a __send__ and received by a method_missing.
  • Loading branch information...
commit 0e20b31dcf078a343e216fd11943146d670ef28d 1 parent 1454bb7
Mat Brown authored
View
2  sunspot/lib/sunspot/search/abstract_search.rb
@@ -32,7 +32,7 @@ def initialize(connection, setup, query, configuration) #:nodoc:
def execute
reset
params = @query.to_params
- @solr_result = @connection.__send__(request_handler, params)
+ @solr_result = @connection.request("/#{request_handler}", params)
self
end
View
15 sunspot/spec/mocks/connection.rb
@@ -50,13 +50,16 @@ def commit
@commits << Time.now
end
- def method_missing(method, *args, &block)
- if method.to_sym == @expected_handler
- @searches << @last_search = args.first
- @response || {}
- else
- super
+ def request(path, params)
+ unless path == "/#{@expected_handler}"
+ raise ArgumentError, "Expected request to #{@expected_handler} request handler"
end
+ @searches << @last_search = params
+ @response || {}
+ end
+
+ def method_missing(method, *args, &block)
+ request("/#{method}", *args)
end
def has_add_with?(*documents)
Please sign in to comment.
Something went wrong with that request. Please try again.