3

字段定义

<field name="programDescriptionLookup"
       type="suggest_simple"
       indexed="true"
       stored="false"
       multiValued="true"/>

字段类型和复制字段

<copyField source="programDescription" dest="programDescriptionLookup"/>

<fieldType name="suggest_simple" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
    <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
</fieldType>

存在 2 个文档,该字段具有以下值

<field name="programDescription">Great program for kids</field>
<field name="programDescription">Excellent program for Technology</field>

当我搜索

http://127.0.0.1:8080/solr/core/posdSuggest?q=progra+fo

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">3</int>
</lst>
<lst name="spellcheck">
<lst name="suggestions">
<lst name="progra">
<int name="numFound">1</int>
<int name="startOffset">0</int>
<int name="endOffset">6</int>
<arr name="suggestion">
<str>program</str>
</arr>
</lst>
<lst name="fo">
<int name="numFound">1</int>
<int name="startOffset">7</int>
<int name="endOffset">9</int>
<arr name="suggestion">
<str>for</str>
</arr>
</lst>
<str name="collation">program for</str>
</lst>
</lst>
</response>

当我用完整的单词搜索时,我没有得到任何结果

http://127.0.0.1:8080/solr/core/posdSuggest?q=program+for

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1</int>
</lst>
<lst name="spellcheck">
<lst name="suggestions"/>
</lst>
</response>

要获得查询progra+fo和的结果,需要进行哪些配置更改program+for

4

0 回答 0