SOLR 6.6:具有上下文过滤的建议程序不返回结果

时间:2018-06-29 08:06:07

标签: solr autosuggest

以前,我曾建议配置可用于上下文过滤之外的配置:

<searchComponent name="suggest" class="solr.SpellCheckComponent">
        <str name="queryAnalyzerFieldType">text_spell</str>
        <lst name="spellchecker">
            <str name="name">default</str>
            <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
            <str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
            <str name="field">autosuggest_en</str>
            <str name="contextField">availableForWarehouses_string_mv</str>
            <str name="buildOnCommit">true</str>
            <str name="buildOnOptimize">true</str>
            <str name="accuracy">0.35</str>
        </lst>
        <lst name="spellchecker">
            <str name="name">de</str>
            <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
            <str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
            <str name="field">autosuggest_de</str>
            <str name="contextField">availableForWarehouses_string_mv</str>
            <str name="buildOnCommit">true</str>
            <str name="buildOnOptimize">true</str>
            <str name="accuracy">0.35</str>
        </lst>
        <lst name="spellchecker">
            <str name="name">en</str>
            <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
            <str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
            <str name="field">autosuggest_en</str>
            <str name="contextField">availableForWarehouses_string_mv</str>
            <str name="buildOnCommit">true</str>
            <str name="buildOnOptimize">true</str>
            <str name="accuracy">0.35</str>
        </lst>
    </searchComponent>

    <requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
        <lst name="defaults">
            <str name="spellcheck">true</str>
            <str name="spellcheck.dictionary">default</str>
            <str name="spellcheck.onlyMorePopular">true</str>
            <str name="spellcheck.count">5</str>
            <str name="spellcheck.collate">true</str>
        </lst>
        <arr name="components">
            <str>suggest</str>
        </arr>
    </requestHandler>

在solr管理控制台中,我能够检索结果:

enter image description here

现在,我已经创建了包括上下文过滤的配置:

<searchComponent name="hmmSuggest" class="solr.SuggestComponent">
        <lst name="suggester">
            <str name="name">default</str>
            <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
            <str name="dictionaryImpl">DocumentDictionaryFactory</str>
            <str name="field">autosuggest_en</str>
            <str name="contextField">availableForWarehouses_string_mv</str>
            <str name="suggestAnalyzerFieldType">string</str>
            <str name="buildOnStartup">true</str>
            <str name="buildOnCommit">true</str>
            <str name="buildOnOptimize">true</str>
        </lst>
        <lst name="suggester">
            <str name="name">de</str>
            <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
            <str name="dictionaryImpl">DocumentDictionaryFactory</str>
            <str name="field">autosuggest_de</str>
            <str name="contextField">availableForWarehouses_string_mv</str>
            <str name="suggestAnalyzerFieldType">string</str>
            <str name="buildOnStartup">true</str>
            <str name="buildOnCommit">true</str>
            <str name="buildOnOptimize">true</str>
        </lst>
        <lst name="suggester">
            <str name="name">en</str>
            <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
            <str name="dictionaryImpl">DocumentDictionaryFactory</str>
            <str name="field">autosuggest_en</str>
            <str name="contextField">availableForWarehouses_string_mv</str>
            <str name="suggestAnalyzerFieldType">string</str>
            <str name="buildOnStartup">true</str>
            <str name="buildOnCommit">true</str>
            <str name="buildOnOptimize">true</str>
        </lst>
    </searchComponent>

    <requestHandler name="/hmmSuggest" class="solr.SearchHandler" startup="lazy">
        <lst name="defaults">
            <str name="suggest">true</str>
            <str name="suggest.count">5</str>
            <str name="suggest.dictionary">default</str>
            <str name="suggest.collate">true</str>
            <str name="suggest.onlyMorePopular">true</str>
        </lst>
        <arr name="components">
            <str>hmmSuggest</str>
        </arr>
    </requestHandler>

但是我没有结果。

enter image description here

我是否需要在配置中添加更多内容,或者可能是问题,或者如何检查问题?

测试1

我尝试使用类spellcheckcomponent而不是hinter,但仍然得到空结果。

<searchComponent name="hmmSuggest" class="solr.SpellCheckComponent">
        <str name="queryAnalyzerFieldType">text_spell</str>
        <lst name="spellchecker">
            <str name="name">default</str>
            <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
            <str name="dictionaryImpl">DocumentDictionaryFactory</str>
            <str name="field">autosuggest_en</str>
            <str name="contextField">availableForWarehouses_string_mv</str>
            <str name="suggestAnalyzerFieldType">string</str>
            <str name="buildOnStartup">true</str>
            <str name="buildOnCommit">true</str>
            <str name="buildOnOptimize">true</str>
            <str name="accuracy">0.35</str>
        </lst>
        <lst name="spellchecker">
            <str name="name">de</str>
            <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
            <str name="dictionaryImpl">DocumentDictionaryFactory</str>
            <str name="field">autosuggest_de</str>
            <str name="contextField">availableForWarehouses_string_mv</str>
            <str name="suggestAnalyzerFieldType">string</str>
            <str name="buildOnStartup">true</str>
            <str name="buildOnCommit">true</str>
            <str name="buildOnOptimize">true</str>
            <str name="accuracy">0.35</str>
        </lst>
        <lst name="spellchecker">
            <str name="name">en</str>
            <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
            <str name="dictionaryImpl">DocumentDictionaryFactory</str>
            <str name="field">autosuggest_en</str>
            <str name="contextField">availableForWarehouses_string_mv</str>
            <str name="suggestAnalyzerFieldType">string</str>
            <str name="buildOnStartup">true</str>
            <str name="buildOnCommit">true</str>
            <str name="buildOnOptimize">true</str>
            <str name="accuracy">0.35</str>
        </lst>
    </searchComponent>

    <requestHandler name="/hmmSuggest" class="solr.SearchHandler" startup="lazy">
        <lst name="defaults">
            <str name="spellcheck">true</str>
            <str name="spellcheck.count">5</str>
            <str name="spellcheck.dictionary">default</str>
            <str name="spellcheck.collate">true</str>
            <str name="spellcheck.onlyMorePopular">true</str>
        </lst>
        <arr name="components">
            <str>hmmSuggest</str>
        </arr>
    </requestHandler>

0 个答案:

没有答案