title: Solr facets ignore stopwords at query time
body: <p>I am using Solr 4.6.0 and I am trying to get the most frequent terms grouped by year. Since it is possible that my stopwords can change often, I do not apply the stopwords at <em>indexing</em> time. Instead, all dynamic word-lists like stopwords, protwords and synonyms are  used at <em>query</em> time. But although the stopword-list includes terms like "of" and "the", they are still displayed in the result-list (see <em>Results</em>).</p>
  
  <p><strong>Question</strong>: How can I get facetted and stopword-filtered results, if I use the <em>StopFilterFactory</em> only at query time?</p>
  
  <p><strong>Additional information</strong></p>
  
  <p>If I use the <em>StopFilterFactory</em> at <em>indexing</em> time, everything is as expected. The terms like "of" and "the" are filtered out, when I run my query.</p>
  
  <p>I also have tested the functionality of the <em>fieldtype</em> text_en with the Solr admin analysis tool and the results are as expected - "of" and "the" are filtered out. That means that somehow the <em>SearchHandler</em> does not call the right <em>analyzer</em>?</p>
  
  <p><strong>Query</strong></p>
  
  <p><code>http://ip:port/solr/collection1/select?q=*:*&amp;rows=0&amp;facet=true&amp;facet.pivot=year,text</code></p>
  
  <p><strong>Results</strong></p>
  
  <pre><code>[..]
  &lt;lst name="facet_pivot"&gt;
    &lt;arr name="year,text"&gt;
      &lt;lst&gt;
        &lt;str name="field"&gt;year&lt;/str&gt;
        &lt;int name="value"&gt;2009&lt;/int&gt;
        &lt;int name="count"&gt;139&lt;/int&gt;
        &lt;arr name="pivot"&gt;
          &lt;lst&gt;
            &lt;str name="field"&gt;text&lt;/str&gt;
            &lt;str name="value"&gt;of&lt;/str&gt;
            &lt;int name="count"&gt;135&lt;/int&gt;
          &lt;/lst&gt;
          &lt;lst&gt;
            &lt;str name="field"&gt;text&lt;/str&gt;
            &lt;str name="value"&gt;the&lt;/str&gt;
            &lt;int name="count"&gt;135&lt;/int&gt;
          &lt;/lst&gt;
          &lt;lst&gt;
            &lt;str name="field"&gt;text&lt;/str&gt;
            &lt;str name="value"&gt;and&lt;/str&gt;
            &lt;int name="count"&gt;123&lt;/int&gt;
  [..]
  </code></pre>
  
  <p><strong>Schema.xml</strong></p>
  
  <pre><code>&lt;field name="year" type="int" indexed="true" stored="true" /&gt;
      &lt;field name="text" type="text_en" indexed="true" stored="true" multiValued="true" /&gt;
      [..]
      &lt;fieldType name="text_en" class="solr.TextField" positionIncrementGap="100"&gt;
            &lt;analyzer type="index"&gt;
              &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
              &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
              &lt;filter class="solr.EnglishPossessiveFilterFactory"/&gt;
              &lt;filter class="solr.PorterStemFilterFactory"/&gt;
            &lt;/analyzer&gt;
            &lt;analyzer type="query"&gt;
              &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
              &lt;filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/&gt;
              &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt" /&gt;
              &lt;filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/&gt;
              &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
              &lt;filter class="solr.EnglishPossessiveFilterFactory"/&gt;
              &lt;filter class="solr.PorterStemFilterFactory"/&gt;
            &lt;/analyzer&gt;
          &lt;/fieldType&gt;
  </code></pre>