Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-5191

spellcheck.maxResultsForSuggest is ignored

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.3
    • Fix Version/s: None
    • Component/s: spellchecker
    • Labels:
      None
    • Environment:

      Mac Os X, java 7 version "1.7.0_21"

      Description

      Given a request with spellcheck.maxResultsForSuggest = 1 the response should has spellchecked = true if there are some hits according to SOLR-3457 and SOLR-2585.

      request (taken from response header):

      {status=0,QTime=28,params={spellcheck=true,facet=true,sort=sortDate desc,facet.limit=15,spellcheck.q=Microsoft,facet.range=updatedAt,facet.range.gap=+1YEAR,hl=true,version=2,facet.range.start=NOW/YEAR-10YEARS,facet.field=[categories, language],fq=[-documentType:userSearch, -status:deleted],spellcheck.build=true,hl.fragsize=150,facet.mincount=1,spellcheck.maxResultsForSuggest=1,spellcheck.extendedResults=false,qf=title^8 categories^3 content all^0.5,facet.range.end=NOW/YEAR+1YEAR,hl.fl=title,content,teaser,wt=javabin,spellcheck.collate=true,defType=edismax,spellcheck.onlyMorePopular=true,rows=10,start=0,q=Microsoft}}
      

      The HitCount is: response.getResults().getNumFound() = 5541
      And by the way its also the same Response with arbitrary spellcheck.maxResultsForSuggest, even beyond 5541.

      Spellcheck Response:

      _spellResponse:
        correctlySpelled = false
        collations = null
        suggestions = ArrayList (size = 0)
        suggestionMap = LinkedHashMap (size = 0)
      

      My configuration is very close to the default provided one.
      solrconfig.xml:

      <requestHandler name="/select" class="solr.SearchHandler">
      	<lst name="defaults">
      		<str name="echoParams">explicit</str>
      		<int name="rows">10</int>
      		<str name="df">text</str>
      		<!-- Optional, must match spell checker's name as defined above, defaults to "default" -->
      		<str name="spellcheck.dictionary">direct</str>
      		<!-- Also generate Word Break Suggestions (Solr 4.0 see SOLR-2993) -->
      		<str name="spellcheck.dictionary">wordbreak</str>
      		<!-- omp = Only More Popular -->
      		<str name="spellcheck.onlyMorePopular">true</str>
      		<!-- exr = Extended Results -->
      		<str name="spellcheck.extendedResults">false</str>
      		<!--  The number of suggestions to return -->
      		<str name="spellcheck.count">10</str>
      		<str name="spellcheck.maxResultsForSuggest">1</str>
      	</lst>
      	<arr name="last-components">
      		<str>spellcheck</str>
      	</arr>
      </requestHandler>
      
      <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
      	<str name="queryAnalyzerFieldType">textSpell</str>
      	<lst name="spellchecker">
      		<str name="name">direct</str>
      		<str name="field">spell</str>
      		<str name="classname">solr.DirectSolrSpellChecker</str>
      		<str name="distanceMeasure">internal</str>
      		<float name="accuracy">0.5</float>
      		<int name="maxEdits">2</int>
      		<int name="minPrefix">1</int>
      		<int name="maxInspections">5</int>
      		<int name="minQueryLength">4</int>
      		<float name="maxQueryFrequency">0.01</float>
      		<float name="thresholdTokenFrequency">.0001</float>
      	</lst>
      	<lst name="spellchecker">
      		<str name="name">wordbreak</str>
      		<str name="classname">solr.WordBreakSolrSpellChecker</str>
      		<str name="field">spell</str>
      		<str name="combineWords">true</str>
      		<str name="breakWords">true</str>
      		<int name="maxChanges">3</int>
      	</lst>
      </searchComponent>
      

      schema.xml:

      <!-- Field type specifically for spell checking -->
      <fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" omitNorms="true">
      	<analyzer type="index">
      		<tokenizer class="solr.StandardTokenizerFactory"/>
      		<!--<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>-->
      		<filter class="solr.LowerCaseFilterFactory"/>
      		<filter class="solr.GermanNormalizationFilterFactory"/>
      		<filter class="solr.StandardFilterFactory"/>
      	</analyzer>
      	<analyzer type="query">
      		<tokenizer class="solr.StandardTokenizerFactory"/>
      		<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
      		<!--<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>-->
      		<filter class="solr.LowerCaseFilterFactory"/>
      		<filter class="solr.GermanNormalizationFilterFactory"/>
      		<filter class="solr.StandardFilterFactory"/>
      	</analyzer>
      </fieldType>
      
      <field name="spell" type="textSpell" indexed="true" stored="false" multiValued="true" termVectors="true" termPositions="true" termOffsets="true"/>
      
      <copyField source="title" dest="spell"/>
      <copyField source="teaser" dest="spell"/>
      <copyField source="kicker" dest="spell"/>
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              macilias Maciej Niemczyk
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: