title: How to make the Lucene QueryParser more forgiving?
body: <p>I'm using Lucene.net, but I am tagging this question for both .NET and Java versions because the API is the same and I'm hoping there are solutions on both platforms.</p>
  
  <p>I'm sure other people have addressed this issue, but I haven't been able to find any good discussions or examples.  </p>
  
  <p>By default, Lucene is very picky about query syntax.  For example, I just got the following error:</p>
  
  <pre><code>[ParseException: Cannot parse 'hi there!': Encountered "&lt;EOF&gt;" at line 1, column 9.
  Was expecting one of:
      "(" ...
      "*" ...
      &lt;QUOTED&gt; ...
      &lt;TERM&gt; ...
      &lt;PREFIXTERM&gt; ...
      &lt;WILDTERM&gt; ...
      "[" ...
      "{" ...
      &lt;NUMBER&gt; ...
      ]
     Lucene.Net.QueryParsers.QueryParser.Parse(String query) +239
  </code></pre>
  
  <p>What is the best way to prevent ParseExceptions when processing queries from users?  It seems to me that the most <em>usable</em> search interface is one that always executes a query, even if it might be the wrong query.   </p>
  
  <p>It seems that there are a few possible, and complementary, strategies:</p>
  
  <ul>
  <li>"Clean" the query prior to sending it to the QueryProcessor</li>
  <li>Handle exceptions gracefully
  
  <ul>
  <li>Show an intelligent error message to the user</li>
  <li>Perhaps execute a simpler query, leaving off the erroneous bit</li>
  </ul></li>
  </ul>
  
  <p>I don't really have any great ideas about how to do any of those strategies.   Has anyone else addressed this issue?  Are there any "simple" or "graceful" parsers that I don't know about?</p>