lib/thinking_sphinx/search.rb in friendlyfashion-thinking-sphinx-2.0.13.1 vs lib/thinking_sphinx/search.rb in friendlyfashion-thinking-sphinx-2.0.13.2
- old
+ new
@@ -421,31 +421,31 @@
return if @populated
@populated = true
retries = hard_retries
begin
- retry_on_index_not_preread do
- retry_on_stale_index do
- begin
+ retry_on_stale_index do
+ begin
+ retry_on_index_not_preread do
log query do
@results = client.query query, indexes, comment
end
- total = @results[:total_found].to_i
- log "Found #{total} result#{'s' unless total == 1}"
+ end
+ total = @results[:total_found].to_i
+ log "Found #{total} result#{'s' unless total == 1}"
- log "Sphinx Daemon returned warning: #{warning}" if warning?
+ log "Sphinx Daemon returned warning: #{warning}" if warning?
- if error?
- log "Sphinx Daemon returned error: #{error}"
- raise SphinxError.new(error, @results) unless options[:ignore_errors]
- end
- rescue Errno::ECONNREFUSED => err
- raise ThinkingSphinx::ConnectionError,
- 'Connection to Sphinx Daemon (searchd) failed.'
+ if error?
+ log "Sphinx Daemon returned error: #{error}"
+ raise SphinxError.new(error, @results) unless options[:ignore_errors]
end
-
- compose_results
+ rescue Errno::ECONNREFUSED => err
+ raise ThinkingSphinx::ConnectionError,
+ 'Connection to Sphinx Daemon (searchd) failed.'
end
+
+ compose_results
end
rescue => e
log 'Caught Sphinx exception: %s (%s %s left)' % [
e.message, retries, (retries == 1 ? 'try' : 'tries')
]