title: Solr facet performance
body: <p>I am working with Solr facet fields and come across a performance problem I don't understand.  Consider these two queries:</p>
  
  <ol>
  <li><code>q=</code><strong>word</strong><code>&amp;facet.field=CONTENT&amp;facet=true&amp;facet.prefix=&amp;facet.limit=10&amp;facet.mincount=1&amp;facet.method=enum&amp;rows=0</code></li>
  <li><code>q=</code><strong>word</strong><code>&amp;facet.field=CONTENT&amp;facet=true&amp;facet.prefix=</code><strong>a</strong><code>&amp;facet.limit=10&amp;facet.mincount=1&amp;facet.method=enum&amp;rows=0</code></li>
  </ol>
  
  <p>The only difference is an empty <code>facet.prefix</code> in the first query.</p>
  
  <p>The first query returns after some 20 seconds (<code>QTime</code> 20000 in the result) while the second one takes only 80 msec (<code>QTime</code> 80).  Why is this?</p>
  
  <p>And as side note: <code>facet.method=fc</code> makes the queries run 'forever' and eventually fail with <code>org.apache.solr.common.SolrException: Too many values for UnInvertedField faceting on field CONTENT</code>.</p>
  
  <p>This is with Solr 1.4.</p>