Permalink
Browse files

Adding error handling for when Sphinx is down, and when records no lo…

…nger exist
  • Loading branch information...
1 parent 2446fbe commit 299f52491a505e56489fca1e76d280ef8e42172b @pat pat committed Nov 1, 2008
Showing with 6 additions and 1 deletion.
  1. +1 −0 README
  2. +1 −0 README.textile
  3. +2 −0 lib/thinking_sphinx/active_record.rb
  4. +2 −1 lib/thinking_sphinx/collection.rb
View
1 README
@@ -92,3 +92,4 @@ Since I first released this library, there's been quite a few people who have su
- Jim Remsik
- Kennon Ballou
- Henrik Nyh
+- Emil Tin
View
@@ -92,3 +92,4 @@ Since I first released this library, there's been quite a few people who have su
* Jim Remsik
* Kennon Ballou
* Henrik Nyh
+* Emil Tin
@@ -159,6 +159,8 @@ def toggle_deleted
) if ThinkingSphinx.deltas_enabled? &&
self.class.sphinx_indexes.any? { |index| index.delta? } &&
self.delta?
+ rescue ::ThinkingSphinx::ConnectionError
+ # nothing
end
def sphinx_document_id
@@ -60,12 +60,13 @@ def self.instances_from_matches(matches, options = {})
end
def self.instance_from_match(match, options)
- # puts "ARGS: #{match[:attributes]["sphinx_internal_id"].inspect}, {:include => #{options[:include].inspect}, :select => #{options[:select].inspect}}"
class_from_crc(match[:attributes]["class_crc"]).find(
match[:attributes]["sphinx_internal_id"],
:include => options[:include],
:select => options[:select]
)
+ rescue ::ActiveRecord::RecordNotFound
+ nil
end
def self.class_from_crc(crc)

0 comments on commit 299f524

Please sign in to comment.