title: Apache Solr Escape Query
body: <p>I'm using Apache Solr with <a href="http://www.solarium-project.org/" rel="nofollow">Solarium</a> client library for PHP.</p>
  
  <p>The problem is special character, a dash (<code>-</code>). </p>
  
  <p>When I have a dash in my search query, I don't get any matches.</p>
  
  <p>I tried to solve this by using <code>Solarium_Query_Helper::escapeTerm()</code>. But I don't get any matches again. The dash is being escaped with a backslash <code>\</code>.</p>
  
  <p>What is the solution for this problem?</p>
  
  <p>I was thinking about escaping all fields when indexing, but that doesn't sound like a good idea.</p>
  
  <p>Here is the part of my <code>schema.xml</code>:   </p>
  
  <pre><code> &lt;fieldType name="text_general" class="solr.TextField" positionIncrementGap="100"&gt;
    &lt;analyzer type="index"&gt;
      &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
      &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /&gt;
      &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
    &lt;/analyzer&gt;
    &lt;analyzer type="query"&gt;
      &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
      &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /&gt;
      &lt;filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/&gt;
      &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
    &lt;/analyzer&gt;
  &lt;/fieldType&gt;
  ...
  &lt;fields&gt;
  ...
    &lt;field name="myfield" type="text_general" indexed="true" stored="true" /&gt;
  &lt;/fields&gt;
  ...
  &lt;defaultSearchField&gt;text&lt;/defaultSearchField&gt;
  &lt;copyField source="myfield" dest="text" /&gt;
  </code></pre>