title: Zend_Search_Lucene query parsing problem
body: <p>Here's the setup, I have a Lucene Index and it works well with the 2,000 documents I have indexed. I have been using Luke (Lucene Index Toolbox, v.0.9.2) to debug queries, and am using ZF 1.9.</p>
  
  <p>The layout for my Lucene Index is as follows:</p>
  
  <pre><code>I = Indexed
  T = Tokenized
  S = Stored
  
  Fields:
  author - ITS
  category - ITS
  publication - ITS
  publicationdate - IS
  summary - ITS
  title - ITS
  </code></pre>
  
  <p>Basically I have a form that is searchable by the above fields, letting you mix and match any of the above information, and will parse it into a zend luceue query. That is not the problem, the problem is when I start combining terms, the "optimize" method that fires within the find causes the query to just disappear. </p>
  
  <p>Here is an example search I am running right now:</p>
  
  <p><em>Form Version</em>:</p>
  
  <pre><code>Title: test title
  Publication: publication name
  </code></pre>
  
  <p><em>Lucene Query Parse</em>:</p>
  
  <pre><code>+(title:test title) +(publication:publication name)
  </code></pre>
  
  <p>Now if I take this query string, and slap it into LUKE, and hit "Search", it returns the results just fine. When I use the Query Find method, it bombs out. So I did a little research into how it functions and found a problem (I believe)</p>
  
  <p>First off, heres the actual lines of code that does the searching:</p>
  
  <pre><code>$searchQuery = "+(title:test title) +(publication:publication name)";
  $hits = new ArrayObject($this-&gt;index-&gt;find($searchQuery));  
  </code></pre>
  
  <p>It's a simplified version of the actual code, but thats what it generates. </p>
  
  <p>Now heres what I've noticed after some debugging, the "optimize" method just destroys the query itself. I created the following code:</p>
  
  <pre><code>$rewrite = $searchQuery-&gt;rewrite($this-&gt;index);
  $optimize = $searchQuery-&gt;rewrite($this-&gt;index)-&gt;optimize($this-&gt;index); 
  echo "======&lt;br/&gt;";
  echo "Original: ".$searchQuery."&lt;br/&gt;";
  echo "Rewrite: ".$rewrite."&lt;br/&gt;";
  echo "Optimized + Rewrite: ".$optimize."&lt;br/&gt;";
  echo "======&lt;br/&gt;";  
  </code></pre>
  
  <p>Which outputs the following text:</p>
  
  <pre><code>======
  Original: +(title:test title) +(publication:publication name)
  Rewrite: +(title:test title) +(publication:publication name)
  Optimized + Rewrite: 
  ======
  </code></pre>
  
  <p>Notice how the 3rd output is completely empty. It appears that the <strong>Rewrite &amp; Optimize</strong> on the query is causing the query string to just empty itself. </p>
  
  <p>Does anyone have any idea why the optimize method seems to just be removing my query all together? Am I missing a filter or some sort of interface that might need to be parsed? All of the queries work perfectly when I paste them into LUKE and run them against the index by hand, but something silly is going on with the way Zend is parsing the query to do the search.</p>
  
  <p>Any help is appreciated.</p>