Maciej Niemczyk created SOLR-5191:
-------------------------------------

             Summary: spellcheck.maxResultsForSuggest is ignored
                 Key: SOLR-5191
                 URL: https://issues.apache.org/jira/browse/SOLR-5191
             Project: Solr
          Issue Type: Bug
          Components: spellchecker
    Affects Versions: 4.3
         Environment: Mac Os X, java 7 version "1.7.0_21" 
            Reporter: Maciej Niemczyk


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):
{code}
{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}}
{code}

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: 
{code}
_spellResponse:
  correctlySpelled = false
  collations = null
  suggestions = ArrayList (size = 0)
  suggestionMap = LinkedHashMap (size = 0)
{code}

My configuration is very close to the default provided one.
schema.xml
{code}
<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>
{code}
schema.xml:
{code}
<!-- 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"/>
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to