title: Wrong spell-check suggestions by Solr
body: <p>Working on Spell Suggest with Solr 4.1. </p>
  
  <p>We configured it correctly and Solr offers term as well as collate suggestions. However, we noticed that many times the suggested word / collate doesn't have any results if we search it again.</p>
  
  <p>For example, we searched for term "<strong>confort</strong>" and got no results, with two suggestions "<strong>comfort</strong>" and "<strong>convert</strong>". The first term contains the result.. however the second term doesn't bring any result, and instead suggested two more terms, so term "convert" offers no result with following suggestions - "<strong>connect</strong>" and "<strong>content</strong>". Here also, we found that "<strong>connect</strong>" is having few results but "<strong>content</strong>" doesn't have any and offered following suggestions.. i.e. "<strong>connect</strong>" and "<strong>continent</strong>". Here also we found that "<strong>continent</strong>" doesn't have any results and it suggested "<strong>connect</strong>". </p>
  
  <p>The same happens for many search terms and even collate. We're clueless what is causing this? Can we turn off such suggestions which doesn't carry any result?</p>
  
  <p>My Solr Config</p>
  
  <pre><code>&lt;requestHandler name="/spell" class="solr.SearchHandler" startup="lazy"&gt;
      &lt;lst name="defaults"&gt;
        &lt;str name="df"&gt;Name&lt;/str&gt;
        &lt;str name="spellcheck.dictionary"&gt;default&lt;/str&gt;
        &lt;str name="spellcheck.dictionary"&gt;wordbreak&lt;/str&gt;
        &lt;str name="spellcheck"&gt;on&lt;/str&gt;
        &lt;str name="spellcheck.extendedResults"&gt;true&lt;/str&gt;       
        &lt;str name="spellcheck.count"&gt;10&lt;/str&gt;
        &lt;str name="spellcheck.alternativeTermCount"&gt;5&lt;/str&gt;
        &lt;str name="spellcheck.maxResultsForSuggest"&gt;5&lt;/str&gt;       
        &lt;str name="spellcheck.collate"&gt;true&lt;/str&gt;
        &lt;str name="spellcheck.collateExtendedResults"&gt;true&lt;/str&gt;  
        &lt;str name="spellcheck.maxCollationTries"&gt;10&lt;/str&gt;
        &lt;str name="spellcheck.maxCollations"&gt;5&lt;/str&gt;         
      &lt;/lst&gt;
      &lt;arr name="last-components"&gt;
        &lt;str&gt;spellcheck&lt;/str&gt;
      &lt;/arr&gt;
  &lt;/requestHandler&gt;
  
  &lt;searchComponent name="spellcheck" class="solr.SpellCheckComponent"&gt;
  &lt;str name="queryAnalyzerFieldType"&gt;text&lt;/str&gt;
  &lt;lst name="spellchecker"&gt;
    &lt;str name="name"&gt;default&lt;/str&gt;
    &lt;str name="field"&gt;Name&lt;/str&gt;
    &lt;str name="classname"&gt;solr.DirectSolrSpellChecker&lt;/str&gt;
    &lt;str name="distanceMeasure"&gt;internal&lt;/str&gt;
    &lt;float name="accuracy"&gt;0.5&lt;/float&gt;
    &lt;int name="maxEdits"&gt;2&lt;/int&gt;
    &lt;int name="minPrefix"&gt;1&lt;/int&gt;
    &lt;int name="maxInspections"&gt;5&lt;/int&gt;
    &lt;int name="minQueryLength"&gt;4&lt;/int&gt;
    &lt;float name="maxQueryFrequency"&gt;0.01&lt;/float&gt;
  &lt;/lst&gt;
  
  &lt;lst name="spellchecker"&gt;
    &lt;str name="name"&gt;wordbreak&lt;/str&gt;
    &lt;str name="classname"&gt;solr.WordBreakSolrSpellChecker&lt;/str&gt;      
    &lt;str name="field"&gt;Name&lt;/str&gt;
    &lt;str name="combineWords"&gt;true&lt;/str&gt;
    &lt;str name="breakWords"&gt;false&lt;/str&gt;
    &lt;int name="maxChanges"&gt;10&lt;/int&gt;     
  &lt;/lst&gt;
  &lt;/searchComponent&gt; 
  </code></pre>
  
  <p>My Schema :</p>
  
  <pre><code>&lt;fieldType name="text" 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;field name="Name" type="text" indexed="true" stored="true"  required="false" /&gt;
  </code></pre>
  
  <p>My Query : <code>http://localhost:8983/solr/mycore/spell?q=confort&amp;spellcheck=true&amp;Collate=true&amp;spellcheck.extendedResults=true</code></p>
  
  <p>Result :</p>
  
  <pre><code>&lt;response&gt;
    &lt;lst name="responseHeader"&gt;
      &lt;int name="status"&gt;0&lt;/int&gt;
      &lt;int name="QTime"&gt;16&lt;/int&gt;
    &lt;/lst&gt;
    &lt;result name="response" numFound="0" start="0"/&gt;
    &lt;lst name="spellcheck"&gt;
      &lt;lst name="suggestions"&gt;
        &lt;lst name="confort"&gt;
          &lt;int name="numFound"&gt;2&lt;/int&gt;
          &lt;int name="startOffset"&gt;0&lt;/int&gt;
          &lt;int name="endOffset"&gt;7&lt;/int&gt;
          &lt;int name="origFreq"&gt;0&lt;/int&gt;
          &lt;arr name="suggestion"&gt;
            &lt;lst&gt;
              &lt;str name="word"&gt;comfort&lt;/str&gt;
              &lt;int name="freq"&gt;6&lt;/int&gt;
            &lt;/lst&gt;
            &lt;lst&gt;
              &lt;str name="word"&gt;convert&lt;/str&gt;
              &lt;int name="freq"&gt;2&lt;/int&gt;
            &lt;/lst&gt;
          &lt;/arr&gt;
        &lt;/lst&gt;
        &lt;bool name="correctlySpelled"&gt;false&lt;/bool&gt;
      &lt;/lst&gt;&lt;/lst&gt;
    &lt;/response&gt;
  </code></pre>