karmi/tire — Issue #164: Improve Handling of SearchPhaseExecutionException
Author: ryanb
Created: 2011-12-10 00:44:13+00:00
State: open

It is possible for the user to trigger an exception by passing in an invalid search query. Take this code for example (provided in the sample Rails app template).

```ruby
Article.search params[:q]
```

Pass in an empty string or a "!" and it will raise a `Tire::Search::SearchRequestFailed` exception because the backend ElasticSearch raises a `SearchPhaseExecutionException`. There may be other queries that trigger this.

I don't think the user should be able to trigger an exception. Perhaps if there is an error, return empty result, and add "valid?" and "error" methods to display the error. What do you think?

I'm using ElasticSearch v0.18.1, and Tire v0.3.12. Keep up the good work on the gem.