lib/riak/search.rb in riak-client-0.8.2 vs lib/riak/search.rb in riak-client-0.8.3

- old
+ new

@@ -50,11 +50,11 @@ options = args.extract_options! index, query = args[-2], args[-1] # Allows nil index, while keeping it as first argument path = [solr, index, "select", {"q" => query, "wt" => "json"}.merge(options.stringify_keys), {}].compact response = http.get(200, *path) if response[:headers]['content-type'].include?("application/json") - ActiveSupport::JSON.decode(response[:body]) + JSON.parse(response[:body]) else response[:body] end end alias :select :search @@ -96,10 +96,15 @@ # Removes documents from the default index # @param [Array<Hash>] specs the specification of documents to remove (must contain 'id' or 'query' keys) # @raise [ArgumentError] if any document specs don't include 'id' or 'query' keys def remove(*args) index = args.shift if String === args.first - raise ArgumentError.new(t("search_remove_requires_id_or_query")) unless args.all? {|s| s.stringify_keys.key?("id") || s.stringify_keys.key?("query") } + raise ArgumentError.new(t("search_remove_requires_id_or_query")) unless args.all? { |s| + s.include? :id or + s.include? 'id' or + s.include? :query or + s.include? 'query' + } xml = Builder::XmlMarkup.new xml.delete do args.each do |spec| spec.each do |k,v| xml.tag!(k.to_sym, v)