Solr 4.6建议器不能正确拼写

时间:2014-01-31 11:32:40

标签: solr solrj autosuggest solr4 spring-data-solr

我是索尔的初学者。我正在使用Solr 4.6和Spring 3.x

以下是solrconfig.xml

中的建议器配置
<searchComponent class="solr.SpellCheckComponent" name="suggest">
    <lst name="spellchecker">
        <str name="name">suggest</str>
        <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
        <str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookupFactory</str>
        <str name="field">text</str>
        <float name="threshold">0.005</float>
        <str name="buildOnCommit">true</str>
    </lst>
</searchComponent>

<requestHandler name="/suggest" class="solr.SearchHandler">
    <lst name="defaults">
        <str name="df">text</str>
        <str name="spellcheck">true</str>
        <str name="spellcheck.dictionary">suggest</str>
        <str name="spellcheck.extendedResults">true</str> 
        <str name="spellcheck.onlyMorePopular">true</str>
        <str name="spellcheck.count">10</str>
        <str name="spellcheck.collate">true</str>
        <str name="spellcheck.collateExtendedResults">true</str>
    </lst>
    <arr name="components">
        <str>suggest</str>
    </arr>
</requestHandler>

字段和字段类型在schema.xml

中配置如下
<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory" />
        <filter class="solr.StopFilterFactory" ignoreCase="true"
            words="stopwords.txt" enablePositionIncrements="true" />

        <filter class="solr.PatternReplaceFilterFactory" pattern="'" replacement="" replace="all" />
        <filter class="solr.WordDelimiterFilterFactory"
             generateWordParts="1" 
             generateNumberParts="1" 
             catenateWords="1" 
             catenateNumbers="1" 
             catenateAll="0" 
             splitOnCaseChange="0"
        />
        <filter class="solr.LowerCaseFilterFactory" />
    </analyzer>

    <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory" />
        <filter class="solr.StopFilterFactory" ignoreCase="true"
            words="stopwords.txt" enablePositionIncrements="true" />
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
            ignoreCase="true" expand="true" />
        <filter class="solr.LowerCaseFilterFactory" />
    </analyzer>
</fieldType>

我已将城市,州和国家/地区的地址数据编入索引。

当我在frgo

执行/suggest的查询时
qt=/suggest&spellcheck.q=frgo&spellcheck=true

它返回空白响应。

预期结果:

Fargo, West Fargo

请指导我进行配置。

由于

0 个答案:

没有答案