title: Exact phrase with special characters in Lucene.net
body: <p>i've a problem doing a full text search in lucene.net where the search result contains special lucene characters.</p>
  
  <p>I've a field named "content" in my Lucene documents. This field is created as followed and contains the content of the indexed documents:</p>
  
  <pre><code>document.Add(new Field("content", fulltext, Field.Store.YES, Field.Index.ANALYZED));
  </code></pre>
  
  <p>For creating the index i'm using the Standardanalyzer.</p>
  
  <p>For querying the index i'm using the following code:</p>
  
  <pre><code>var queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "content", analayzer);
  queryParser.SetAllowLeadingWildcard(true);
  queryParser.SetMultiTermRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
  Query fullTextQuery = queryParser.Parse(queryString);
  </code></pre>
  
  <p>The query is then added to a BooleanQuery which is used to get the results from a IndexSearcher. I think the rest of the code is not that important, because the code works like it should for 99% of the queries.  I'm also using the StandardAnalyzer for querying the index.</p>
  
  <p>Now here is the problem.
  Sometimes the "content" field of a document contains text that is separated using "-"</p>
  
  <blockquote>
    <p>some text some text selector-lever some text some text</p>
  </blockquote>
  
  <p>Now when i'm doing a full text search (exact phrase) using "selector lever". The query looks like this: </p>
  
  <blockquote>
    <p>content:"selector lever"</p>
  </blockquote>
  
  <p>The problem here is that also the document containing the above text is found, although it shouldn't be found because the 2 words are separated using the "-" and not blank.</p>
  
  <p>I think it has something to do with the analyzer and the fact that "-" is a special character in lucene.</p>
  
  <p>Maybe someone can help me solving this problem.</p>
  
  <p>thanks in advance
  Martin</p>