diff --git a/Gemfile b/Gemfile index c5b1149..11bebb0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'json', '2.1.0' +gem 'json' # Specify your gem's dependencies in elastic_search_framework.gemspec gemspec diff --git a/elastic_search_framework.gemspec b/elastic_search_framework.gemspec index 058126e..49701eb 100644 --- a/elastic_search_framework.gemspec +++ b/elastic_search_framework.gemspec @@ -23,6 +23,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rake', '~> 10.0' spec.add_development_dependency 'rspec' spec.add_development_dependency 'pry' + spec.add_development_dependency 'pry-byebug' spec.add_dependency 'hash_kit', '~> 0.5' spec.add_dependency 'json' spec.add_dependency 'connection_pool' diff --git a/lib/elastic_search_framework/index_alias.rb b/lib/elastic_search_framework/index_alias.rb index d76284e..79306b6 100644 --- a/lib/elastic_search_framework/index_alias.rb +++ b/lib/elastic_search_framework/index_alias.rb @@ -129,7 +129,7 @@ def get_item(id:, type: "default", routing_key: nil) options = { index: self, id: id, type: type } options[:routing_key] = routing_key if active_index.routing_enabled? && routing_key - repository.get(options) + repository.get(**options) end def put_item(type: "default", item:, op_type: 'index', routing_key: nil) @@ -137,7 +137,7 @@ def put_item(type: "default", item:, op_type: 'index', routing_key: nil) options = { entity: item, index: index[:klass], type: type, op_type: op_type } options[:routing_key] = routing_key if index[:klass].routing_enabled? && routing_key - repository.set(options) + repository.set(**options) end end @@ -146,7 +146,7 @@ def delete_item(id:, type: "default", routing_key: nil) options = { index: index[:klass], id: id, type: type } options[:routing_key] = routing_key if index[:klass].routing_enabled? && routing_key - repository.drop(options) + repository.drop(**options) end end diff --git a/lib/elastic_search_framework/repository.rb b/lib/elastic_search_framework/repository.rb index 2d6563f..f6af143 100644 --- a/lib/elastic_search_framework/repository.rb +++ b/lib/elastic_search_framework/repository.rb @@ -74,7 +74,7 @@ def drop(index:, id:, type: 'default', routing_key: nil) end def query(index:, expression:, type: 'default', limit: 10, count: false, routing_key: nil) - uri_string = "#{host}/#{index.full_name}/#{type}/_search?q=#{URI.encode(expression)}&size=#{limit}" + uri_string = "#{host}/#{index.full_name}/#{type}/_search?q=#{CGI::escape(expression)}&size=#{limit}" uri_string += "&routing=#{routing_key}" if routing_key uri = URI(uri_string)