Improved error handling.
This commit is contained in:
parent
f3cbe7f10e
commit
a08d5f1b51
2 changed files with 7 additions and 2 deletions
|
@ -12,6 +12,7 @@ info about used search index machine
|
||||||
|
|
||||||
def self.info
|
def self.info
|
||||||
url = Setting.get('es_url').to_s
|
url = Setting.get('es_url').to_s
|
||||||
|
return if url.blank?
|
||||||
Rails.logger.info "# curl -X GET \"#{url}\""
|
Rails.logger.info "# curl -X GET \"#{url}\""
|
||||||
response = UserAgent.get(
|
response = UserAgent.get(
|
||||||
url,
|
url,
|
||||||
|
|
|
@ -16,8 +16,12 @@ namespace :searchindex do
|
||||||
puts 'create indexes...'
|
puts 'create indexes...'
|
||||||
|
|
||||||
# es with mapper-attachments plugin
|
# es with mapper-attachments plugin
|
||||||
number = SearchIndexBackend.info['version']['number'].to_s
|
info = SearchIndexBackend.info
|
||||||
if number =~ /^[2-4]\./ || number =~ /^5\.[0-5]\./
|
number = nil
|
||||||
|
if info.present?
|
||||||
|
number = info['version']['number'].to_s
|
||||||
|
end
|
||||||
|
if number.blank? || number =~ /^[2-4]\./ || number =~ /^5\.[0-5]\./
|
||||||
|
|
||||||
# create indexes
|
# create indexes
|
||||||
SearchIndexBackend.index(
|
SearchIndexBackend.index(
|
||||||
|
|
Loading…
Reference in a new issue