lib/searchkick.rb in searchkick-0.8.1 vs lib/searchkick.rb in searchkick-0.8.2
- old
+ new
@@ -5,23 +5,28 @@
require "searchkick/index"
require "searchkick/reindex"
require "searchkick/results"
require "searchkick/query"
require "searchkick/similar"
+require "searchkick/reindex_job"
require "searchkick/model"
require "searchkick/tasks"
require "searchkick/logging" if defined?(Rails)
module Searchkick
class MissingIndexError < StandardError; end
class UnsupportedVersionError < StandardError; end
class InvalidQueryError < Elasticsearch::Transport::Transport::Errors::BadRequest; end
class << self
+ attr_accessor :callbacks
attr_accessor :search_method_name
+ attr_accessor :wordnet_path
end
+ self.callbacks = true
self.search_method_name = :search
+ self.wordnet_path = "/var/lib/wn_s.pl"
def self.client
@client ||= Elasticsearch::Client.new(url: ENV["ELASTICSEARCH_URL"])
end
@@ -31,21 +36,19 @@
def self.server_version
@server_version ||= client.info["version"]["number"]
end
- @callbacks = true
-
def self.enable_callbacks
- @callbacks = true
+ self.callbacks = true
end
def self.disable_callbacks
- @callbacks = false
+ self.callbacks = false
end
def self.callbacks?
- @callbacks
+ callbacks
end
end
# TODO find better ActiveModel hook
ActiveModel::Callbacks.send(:include, Searchkick::Model)