Commit 744ef325e75a195128433c18813d1ebae4b7059e
1 parent
caa68105
Exists in
master
and in
2 other branches
Removed prefix
Showing
5 changed files
with
14 additions
and
14 deletions
Show diff stats
lib/searchkick.rb
@@ -171,7 +171,7 @@ module Searchkick | @@ -171,7 +171,7 @@ module Searchkick | ||
171 | end | 171 | end |
172 | 172 | ||
173 | options = options.merge(block: block) if block | 173 | options = options.merge(block: block) if block |
174 | - Searchkick::Relation.new(klass, term, **options) | 174 | + Relation.new(klass, term, **options) |
175 | end | 175 | end |
176 | 176 | ||
177 | def self.multi_search(queries) | 177 | def self.multi_search(queries) |
@@ -183,7 +183,7 @@ module Searchkick | @@ -183,7 +183,7 @@ module Searchkick | ||
183 | body: queries.flat_map { |q| [q.params.except(:body).to_json, q.body.to_json] }.map { |v| "#{v}\n" }.join, | 183 | body: queries.flat_map { |q| [q.params.except(:body).to_json, q.body.to_json] }.map { |v| "#{v}\n" }.join, |
184 | } | 184 | } |
185 | ActiveSupport::Notifications.instrument("multi_search.searchkick", event) do | 185 | ActiveSupport::Notifications.instrument("multi_search.searchkick", event) do |
186 | - Searchkick::MultiSearch.new(queries).perform | 186 | + MultiSearch.new(queries).perform |
187 | end | 187 | end |
188 | end | 188 | end |
189 | 189 | ||
@@ -241,9 +241,9 @@ module Searchkick | @@ -241,9 +241,9 @@ module Searchkick | ||
241 | end | 241 | end |
242 | 242 | ||
243 | def self.reindex_status(index_name) | 243 | def self.reindex_status(index_name) |
244 | - raise Searchkick::Error, "Redis not configured" unless redis | 244 | + raise Error, "Redis not configured" unless redis |
245 | 245 | ||
246 | - batches_left = Searchkick::Index.new(index_name).batches_left | 246 | + batches_left = Index.new(index_name).batches_left |
247 | { | 247 | { |
248 | completed: batches_left == 0, | 248 | completed: batches_left == 0, |
249 | batches_left: batches_left | 249 | batches_left: batches_left |
lib/searchkick/index_options.rb
@@ -513,7 +513,7 @@ module Searchkick | @@ -513,7 +513,7 @@ module Searchkick | ||
513 | else | 513 | else |
514 | [:searchkick_search2, :searchkick_word_search].each do |analyzer| | 514 | [:searchkick_search2, :searchkick_word_search].each do |analyzer| |
515 | unless settings[:analysis][:analyzer][analyzer].key?(:filter) | 515 | unless settings[:analysis][:analyzer][analyzer].key?(:filter) |
516 | - raise Searchkick::Error, "Search synonyms are not supported yet for language" | 516 | + raise Error, "Search synonyms are not supported yet for language" |
517 | end | 517 | end |
518 | 518 | ||
519 | settings[:analysis][:analyzer][analyzer][:filter].insert(2, "searchkick_synonym_graph") | 519 | settings[:analysis][:analyzer][analyzer][:filter].insert(2, "searchkick_synonym_graph") |
lib/searchkick/query.rb
@@ -187,11 +187,11 @@ module Searchkick | @@ -187,11 +187,11 @@ module Searchkick | ||
187 | end | 187 | end |
188 | 188 | ||
189 | # set execute for multi search | 189 | # set execute for multi search |
190 | - @execute = Searchkick::Results.new(searchkick_klass, response, opts) | 190 | + @execute = Results.new(searchkick_klass, response, opts) |
191 | end | 191 | end |
192 | 192 | ||
193 | def retry_misspellings?(response) | 193 | def retry_misspellings?(response) |
194 | - @misspellings_below && Searchkick::Results.new(searchkick_klass, response).total_count < @misspellings_below | 194 | + @misspellings_below && Results.new(searchkick_klass, response).total_count < @misspellings_below |
195 | end | 195 | end |
196 | 196 | ||
197 | private | 197 | private |
lib/searchkick/record_indexer.rb
@@ -14,7 +14,7 @@ module Searchkick | @@ -14,7 +14,7 @@ module Searchkick | ||
14 | case mode | 14 | case mode |
15 | when :async | 15 | when :async |
16 | unless defined?(ActiveJob) | 16 | unless defined?(ActiveJob) |
17 | - raise Searchkick::Error, "Active Job not found" | 17 | + raise Error, "Active Job not found" |
18 | end | 18 | end |
19 | 19 | ||
20 | # we could likely combine ReindexV2Job, BulkReindexJob, and ProcessBatchJob | 20 | # we could likely combine ReindexV2Job, BulkReindexJob, and ProcessBatchJob |
@@ -45,7 +45,7 @@ module Searchkick | @@ -45,7 +45,7 @@ module Searchkick | ||
45 | end | 45 | end |
46 | when :queue | 46 | when :queue |
47 | if method_name | 47 | if method_name |
48 | - raise Searchkick::Error, "Partial reindex not supported with queue option" | 48 | + raise Error, "Partial reindex not supported with queue option" |
49 | end | 49 | end |
50 | 50 | ||
51 | index.reindex_queue.push_records(records) | 51 | index.reindex_queue.push_records(records) |
lib/searchkick/results.rb
@@ -141,7 +141,7 @@ module Searchkick | @@ -141,7 +141,7 @@ module Searchkick | ||
141 | 141 | ||
142 | def hits | 142 | def hits |
143 | if error | 143 | if error |
144 | - raise Searchkick::Error, "Query error - use the error method to view it" | 144 | + raise Error, "Query error - use the error method to view it" |
145 | else | 145 | else |
146 | @response["hits"]["hits"] | 146 | @response["hits"]["hits"] |
147 | end | 147 | end |
@@ -178,7 +178,7 @@ module Searchkick | @@ -178,7 +178,7 @@ module Searchkick | ||
178 | end | 178 | end |
179 | 179 | ||
180 | def scroll | 180 | def scroll |
181 | - raise Searchkick::Error, "Pass `scroll` option to the search method for scrolling" unless scroll_id | 181 | + raise Error, "Pass `scroll` option to the search method for scrolling" unless scroll_id |
182 | 182 | ||
183 | if block_given? | 183 | if block_given? |
184 | records = self | 184 | records = self |
@@ -191,10 +191,10 @@ module Searchkick | @@ -191,10 +191,10 @@ module Searchkick | ||
191 | else | 191 | else |
192 | begin | 192 | begin |
193 | # TODO Active Support notifications for this scroll call | 193 | # TODO Active Support notifications for this scroll call |
194 | - Searchkick::Results.new(@klass, Searchkick.client.scroll(scroll: options[:scroll], body: {scroll_id: scroll_id}), @options) | 194 | + Results.new(@klass, Searchkick.client.scroll(scroll: options[:scroll], body: {scroll_id: scroll_id}), @options) |
195 | rescue => e | 195 | rescue => e |
196 | if Searchkick.not_found_error?(e) && e.message =~ /search_context_missing_exception/i | 196 | if Searchkick.not_found_error?(e) && e.message =~ /search_context_missing_exception/i |
197 | - raise Searchkick::Error, "Scroll id has expired" | 197 | + raise Error, "Scroll id has expired" |
198 | else | 198 | else |
199 | raise e | 199 | raise e |
200 | end | 200 | end |
@@ -232,7 +232,7 @@ module Searchkick | @@ -232,7 +232,7 @@ module Searchkick | ||
232 | index_alias = index.split("_")[0..-2].join("_") | 232 | index_alias = index.split("_")[0..-2].join("_") |
233 | Array((options[:index_mapping] || {})[index_alias]) | 233 | Array((options[:index_mapping] || {})[index_alias]) |
234 | end | 234 | end |
235 | - raise Searchkick::Error, "Unknown model for index: #{index}. Pass the `models` option to the search method." unless models.any? | 235 | + raise Error, "Unknown model for index: #{index}. Pass the `models` option to the search method." unless models.any? |
236 | index_models[index] = models | 236 | index_models[index] = models |
237 | end | 237 | end |
238 | 238 |