Commit 7b6be02b4a0a590e39af68f843c8a92dd82c047b
1 parent
9c957ffd
Exists in
master
and in
19 other branches
Added global index_prefix option - closes #644
Showing
3 changed files
with
3 additions
and
2 deletions
Show diff stats
CHANGELOG.md
lib/searchkick.rb
@@ -36,7 +36,7 @@ module Searchkick | @@ -36,7 +36,7 @@ module Searchkick | ||
36 | class ImportError < Error; end | 36 | class ImportError < Error; end |
37 | 37 | ||
38 | class << self | 38 | class << self |
39 | - attr_accessor :search_method_name, :wordnet_path, :timeout, :models, :client_options, :redis, :index_suffix, :queue_name | 39 | + attr_accessor :search_method_name, :wordnet_path, :timeout, :models, :client_options, :redis, :index_prefix, :index_suffix, :queue_name |
40 | attr_writer :client, :env, :search_timeout | 40 | attr_writer :client, :env, :search_timeout |
41 | attr_reader :aws_credentials | 41 | attr_reader :aws_credentials |
42 | end | 42 | end |
lib/searchkick/model.rb
@@ -22,7 +22,7 @@ module Searchkick | @@ -22,7 +22,7 @@ module Searchkick | ||
22 | class_variable_set :@@searchkick_callbacks, callbacks | 22 | class_variable_set :@@searchkick_callbacks, callbacks |
23 | class_variable_set :@@searchkick_index, options[:index_name] || | 23 | class_variable_set :@@searchkick_index, options[:index_name] || |
24 | (options[:index_prefix].respond_to?(:call) && proc { [options[:index_prefix].call, model_name.plural, Searchkick.env, Searchkick.index_suffix].compact.join("_") }) || | 24 | (options[:index_prefix].respond_to?(:call) && proc { [options[:index_prefix].call, model_name.plural, Searchkick.env, Searchkick.index_suffix].compact.join("_") }) || |
25 | - [options[:index_prefix], model_name.plural, Searchkick.env, Searchkick.index_suffix].compact.join("_") | 25 | + [options.key?(:index_prefix) ? options[:index_prefix] : Searchkick.index_prefix, model_name.plural, Searchkick.env, Searchkick.index_suffix].compact.join("_") |
26 | 26 | ||
27 | class << self | 27 | class << self |
28 | def searchkick_search(term = "*", **options, &block) | 28 | def searchkick_search(term = "*", **options, &block) |