Hi,
I'm looking for a bit of advice on how to handle sphinx connection
errors
within my application.

Due to some underlying changes within ThinkingSphinx I am no longer
able
to rescue from ThinkingSphinx::ConnectionErrors at the controller
level.

Here is what I used to do, which worked quite nicely.

===
class ProductsController < ApplicationController
  rescue_from ThinkingSphinx::ConnectionError, :with => :search_failed

  # GET /products/search
  def search
    @products = Product.search(params[:criteria])

    respond_to do |format|
      format.html # search.html.erb
    end
  end
end
===

However, at the moment the ConnectionError exception is not raised
until my application hits the view layer and calls: @products.empty?

So how do I handle this now?
Ideally I would like to handle the exception as I did before.

The only other alternative that has come to mind, is to call
sphinx_running? before each search query - but that seems a bit
of an expensive call to make.

Any advice would be much appreciated.

Kind regards, Oliver.

--

You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.


Reply via email to