0

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

以下是我的 Suggester 配置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>

Field 和 FieldType 配置如下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>

我已经用城市、州和国家索引了地址数据。

当我对 at 执行查询frgo/suggest

qt=/suggest&spellcheck.q=frgo&spellcheck=true

它返回空白响应。

预期结果:

Fargo, West Fargo

请指导我进行配置。

谢谢

4

0 回答 0