title: How to have Solr autocomplete on whole phrase when query contains multiple terms?
body: <p>I've looked through a ton of examples and other questions here and from them, I've got my config very close to what I need but I'm missing one last little bit that I'm having a heck of a time working out. I'm searching on values like:</p>
  <pre><code>solar powered
  solar glass
  solar globe
  solar lights
  solar magic
  solid brass
  solid copper
  </code></pre>
  <p>What I want:</p>
  <ol>
  <li>If I search for <code>sol</code> the result should include all these values. This works.</li>
  <li>If I search for <code>solar</code> I should get just the first five. This works.</li>
  <li>If I search for <code>solar gl</code> I should get only <code>solar glass</code> and <code>solar globe</code>. This does not work. Instead, I get one set of matches for <code>solar</code> and a second set of matches for <code>gl</code>.</li>
  </ol>
  <p>In a nutshell, I want to consider the input string as a whole, regardless of any whitespace. I gather this is accomplished by creating a separate query (versus index) analyzer, but I've not been able to make it work. Can anyone suggest a configuration that will get me what I'm looking for?</p>
  <p>I've (unsuccessfully) tried:</p>
  <ul>
  <li>Querying with <code>&quot;solar gl&quot;</code></li>
  <li>Querying with <code>mm=100%</code></li>
  <li>Defining separate query and index analyzers both using KeywordTokenizerFactory. (I don't know what the heck I thought that would do.)</li>
  <li>Defining an index analyzer but not a query analyzer.</li>
  <li>Defining a query analyzer with no tokenizer.</li>
  </ul>
  <p>Here's my current schema:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;field name=&quot;suggest_phrase&quot; type=&quot;suggest_phrase&quot;
      indexed=&quot;true&quot; stored=&quot;false&quot; multiValued=&quot;false&quot; /&gt;
  </code></pre>
  <p>And the field definition:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;fieldType name=&quot;suggest_phrase&quot; class=&quot;solr.TextField&quot; positionIncrementGap=&quot;100&quot;&gt;
      &lt;analyzer&gt;
          &lt;tokenizer class=&quot;solr.KeywordTokenizerFactory&quot; /&gt;
          &lt;filter class=&quot;solr.LowerCaseFilterFactory&quot; /&gt;
      &lt;/analyzer&gt;
  &lt;/fieldType&gt;
  </code></pre>
  <p>And the config:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;searchComponent name=&quot;suggest_phrase&quot; class=&quot;solr.SpellCheckComponent&quot;&gt;
      &lt;lst name=&quot;spellchecker&quot;&gt;
          &lt;str name=&quot;name&quot;&gt;suggest_phrase&lt;/str&gt;
          &lt;str name=&quot;classname&quot;&gt;org.apache.solr.spelling.suggest.Suggester&lt;/str&gt;
          &lt;str name=&quot;lookupImpl&quot;&gt;org.apache.solr.spelling.suggest.fst.FSTLookup&lt;/str&gt;
          &lt;str name=&quot;field&quot;&gt;suggest_phrase&lt;/str&gt;
          &lt;str name=&quot;buildOnCommit&quot;&gt;true&lt;/str&gt;
      &lt;/lst&gt;
  &lt;/searchComponent&gt;
  &lt;requestHandler class=&quot;org.apache.solr.handler.component.SearchHandler&quot; name=&quot;/suggest_phrase&quot;&gt;
      &lt;lst name=&quot;defaults&quot;&gt;
          &lt;str name=&quot;spellcheck&quot;&gt;true&lt;/str&gt;
          &lt;str name=&quot;spellcheck.dictionary&quot;&gt;suggest_phrase&lt;/str&gt;
          &lt;str name=&quot;spellcheck.onlyMorePopular&quot;&gt;true&lt;/str&gt;
          &lt;str name=&quot;spellcheck.count&quot;&gt;10&lt;/str&gt;
          &lt;str name=&quot;spellcheck.collate&quot;&gt;false&lt;/str&gt;
      &lt;/lst&gt;
      &lt;arr name=&quot;components&quot;&gt;
          &lt;str&gt;suggest_phrase&lt;/str&gt;
      &lt;/arr&gt;
  &lt;/requestHandler&gt;
  </code></pre>