From 744ef325e75a195128433c18813d1ebae4b7059e Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Thu, 24 Feb 2022 07:43:16 -0800 Subject: [PATCH] Removed prefix --- lib/searchkick.rb | 8 ++++---- lib/searchkick/index_options.rb | 2 +- lib/searchkick/query.rb | 4 ++-- lib/searchkick/record_indexer.rb | 4 ++-- lib/searchkick/results.rb | 10 +++++----- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/searchkick.rb b/lib/searchkick.rb index 0ad292d..5f2babd 100644 --- a/lib/searchkick.rb +++ b/lib/searchkick.rb @@ -171,7 +171,7 @@ module Searchkick end options = options.merge(block: block) if block - Searchkick::Relation.new(klass, term, **options) + Relation.new(klass, term, **options) end def self.multi_search(queries) @@ -183,7 +183,7 @@ module Searchkick body: queries.flat_map { |q| [q.params.except(:body).to_json, q.body.to_json] }.map { |v| "#{v}\n" }.join, } ActiveSupport::Notifications.instrument("multi_search.searchkick", event) do - Searchkick::MultiSearch.new(queries).perform + MultiSearch.new(queries).perform end end @@ -241,9 +241,9 @@ module Searchkick end def self.reindex_status(index_name) - raise Searchkick::Error, "Redis not configured" unless redis + raise Error, "Redis not configured" unless redis - batches_left = Searchkick::Index.new(index_name).batches_left + batches_left = Index.new(index_name).batches_left { completed: batches_left == 0, batches_left: batches_left diff --git a/lib/searchkick/index_options.rb b/lib/searchkick/index_options.rb index b184252..f4194cf 100644 --- a/lib/searchkick/index_options.rb +++ b/lib/searchkick/index_options.rb @@ -513,7 +513,7 @@ module Searchkick else [:searchkick_search2, :searchkick_word_search].each do |analyzer| unless settings[:analysis][:analyzer][analyzer].key?(:filter) - raise Searchkick::Error, "Search synonyms are not supported yet for language" + raise Error, "Search synonyms are not supported yet for language" end settings[:analysis][:analyzer][analyzer][:filter].insert(2, "searchkick_synonym_graph") diff --git a/lib/searchkick/query.rb b/lib/searchkick/query.rb index fa94ebd..dee2ca9 100644 --- a/lib/searchkick/query.rb +++ b/lib/searchkick/query.rb @@ -187,11 +187,11 @@ module Searchkick end # set execute for multi search - @execute = Searchkick::Results.new(searchkick_klass, response, opts) + @execute = Results.new(searchkick_klass, response, opts) end def retry_misspellings?(response) - @misspellings_below && Searchkick::Results.new(searchkick_klass, response).total_count < @misspellings_below + @misspellings_below && Results.new(searchkick_klass, response).total_count < @misspellings_below end private diff --git a/lib/searchkick/record_indexer.rb b/lib/searchkick/record_indexer.rb index 6162060..14f2d7b 100644 --- a/lib/searchkick/record_indexer.rb +++ b/lib/searchkick/record_indexer.rb @@ -14,7 +14,7 @@ module Searchkick case mode when :async unless defined?(ActiveJob) - raise Searchkick::Error, "Active Job not found" + raise Error, "Active Job not found" end # we could likely combine ReindexV2Job, BulkReindexJob, and ProcessBatchJob @@ -45,7 +45,7 @@ module Searchkick end when :queue if method_name - raise Searchkick::Error, "Partial reindex not supported with queue option" + raise Error, "Partial reindex not supported with queue option" end index.reindex_queue.push_records(records) diff --git a/lib/searchkick/results.rb b/lib/searchkick/results.rb index d602e9c..55a08eb 100644 --- a/lib/searchkick/results.rb +++ b/lib/searchkick/results.rb @@ -141,7 +141,7 @@ module Searchkick def hits if error - raise Searchkick::Error, "Query error - use the error method to view it" + raise Error, "Query error - use the error method to view it" else @response["hits"]["hits"] end @@ -178,7 +178,7 @@ module Searchkick end def scroll - raise Searchkick::Error, "Pass `scroll` option to the search method for scrolling" unless scroll_id + raise Error, "Pass `scroll` option to the search method for scrolling" unless scroll_id if block_given? records = self @@ -191,10 +191,10 @@ module Searchkick else begin # TODO Active Support notifications for this scroll call - Searchkick::Results.new(@klass, Searchkick.client.scroll(scroll: options[:scroll], body: {scroll_id: scroll_id}), @options) + Results.new(@klass, Searchkick.client.scroll(scroll: options[:scroll], body: {scroll_id: scroll_id}), @options) rescue => e if Searchkick.not_found_error?(e) && e.message =~ /search_context_missing_exception/i - raise Searchkick::Error, "Scroll id has expired" + raise Error, "Scroll id has expired" else raise e end @@ -232,7 +232,7 @@ module Searchkick index_alias = index.split("_")[0..-2].join("_") Array((options[:index_mapping] || {})[index_alias]) end - raise Searchkick::Error, "Unknown model for index: #{index}. Pass the `models` option to the search method." unless models.any? + raise Error, "Unknown model for index: #{index}. Pass the `models` option to the search method." unless models.any? index_models[index] = models end -- libgit2 0.21.0