Solr建议AnalyzingInfixLookupFactory

时间:2017-09-13 10:35:55

标签: solr autosuggest search-suggestion

我是solr的新手,并尝试为我的网站添加新的推荐功能。 我已经使用AnalyzingInfixLookupFactory在solrconfig中建议添加建议功能。该建议工作正常,但我网站上的结果就像

nestle <b>MILO</b> Activ

但它应该像

"nestle MILO Activ" without the "<b>" "</b>"

我怎样才能在solr上设置它?

这是我的solrconfig

<searchComponent name="suggest" class="solr.SuggestComponent">
    <lst name="suggester">
      <str name="name">mySuggest</str>
      <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
        <str name="dictionaryImpl">DocumentDictionaryFactory</str>
      <str name="field">goodsName</str>
      <str name="weightField">popularity</str>
      <str name="suggestAnalyzerFieldType">text_en</str>
      <str name="buildOnStartup">true</str>
    </lst>
  </searchComponent>


  <requestHandler name="/suggest" class="solr.SearchHandler" 
                   >
    <lst name="defaults">
      <str name="suggest.dictionary">mySuggest</str>
      <str name="suggest">true</str>
      <str name="suggest.count">10</str>
    </lst>
    <arr name="components">
      <str>suggest</str>
    </arr>
  </requestHandler>

1 个答案:

答案 0 :(得分:1)

you're using AnalyzingInfixLookupFactory起,它有一个自定义配置参数,允许您关闭突出显示:

  

突出显示:突出显示建议条款。默认为真。

为避免突出显示您的建议,在配置中将highlight设置为false应该足够了:

<str name="highlight">false</str>