<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -29,4 +29,5 @@ vendor/**/**/doc/*
 vendor/plugins/footnotes/*
 rsa_key*
 sphinx/*
+sphinx_test/*
 config/ultrasphinx/*.conf
\ No newline at end of file</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,7 @@ class SearchesController &lt; ApplicationController
     
     redirect_to(home_url) and return if params[:q].nil?
     
-    query = params[:q].strip
+    query = params[:q].strip.inspect
     model = strip_admin(params[:model])
     page  = params[:page] || 1
 
@@ -38,6 +38,9 @@ class SearchesController &lt; ApplicationController
         @results.map!{ |person| Person.find(person) }
       end
     end
+  rescue Ultrasphinx::UsageError
+    flash[:error] = &quot;Invalid search query&quot;
+    redirect_to searches_url(:q =&gt; &quot;&quot;, :model =&gt; params[:model])
   end
   
   private</diff>
      <filename>app/controllers/searches_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -30,13 +30,13 @@ searchd
   # Daemon options
   # What interface the search daemon should listen on and where to store its logs
   address = 0.0.0.0
-  port = 3312
+  port = 3322
   seamless_rotate = 1
-  log = log/searchd.log
-  query_log = log/query.log
+  log = log/searchd_test.log
+  query_log = log/query_test.log
   read_timeout = 5
   max_children = 300
-  pid_file = log/searchd.pid
+  pid_file = log/searchd_test.pid
   max_matches = 100000
 }
 
@@ -47,7 +47,7 @@ client
   dictionary_name = ap
   # How your application connects to the search daemon (not necessarily the same as above)
   server_host = localhost
-  server_port = 3312
+  server_port = 3322
 }
 
 source
@@ -61,7 +61,7 @@ source
 index
 {
   # Index building options
-  path = sphinx
+  path = sphinx_test
   docinfo = extern # just leave this alone
   morphology = stem_en
   stopwords = # /path/to/stopwords.txt</diff>
      <filename>config/ultrasphinx/test.base</filename>
    </modified>
    <modified>
      <diff>@@ -175,4 +175,13 @@ describe SearchesController do
     end
   end
   
+  describe &quot;error handling&quot; do
+    it &quot;should catch Ultrasphinx::UsageError exceptions&quot; do
+      invalid_query = &quot;foo@bar&quot;
+      get :index, :q =&gt; invalid_query, :model =&gt; &quot;Person&quot;
+      response.should be_redirect
+      response.should redirect_to(searches_url(:q =&gt; &quot;&quot;, :model =&gt; &quot;Person&quot;))
+    end
+  end
+  
 end if testing_search?
\ No newline at end of file</diff>
      <filename>spec/controllers/searches_controller_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e2e50b81985f960aa4cec05c97a05153bd2ab6f9</id>
    </parent>
  </parents>
  <author>
    <name>Michael Hartl</name>
    <email>michael@michaelhartl.com</email>
  </author>
  <url>http://github.com/yuki/insoshi/commit/af8ee9d43935a0b1f50c5965dd4f1afa6699cd46</url>
  <id>af8ee9d43935a0b1f50c5965dd4f1afa6699cd46</id>
  <committed-date>2008-10-06T13:50:17-07:00</committed-date>
  <authored-date>2008-10-03T17:56:40-07:00</authored-date>
  <message>Catching Ultrasphinx::UsageError exception</message>
  <tree>66eb5a2c9ca9d6d1d9d0c29669defc8ef1fcae71</tree>
  <committer>
    <name>Michael Hartl</name>
    <email>michael@michaelhartl.com</email>
  </committer>
</commit>
