在我的solrconf.xml中我配置了这个:
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">mySuggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.fst</str> <!-- org.apache.solr.spelling.suggest.fst -->
<str name="dictionaryImpl">org.apache.solr.spelling.suggest.HighFrequencyDictionaryFactory</str> <!-- org.apache.solr.spelling.suggest.HighFrequencyDictionaryFactory -->
<str name="field">title</str>
<!-- <str name="weightField">price</str>-->
<str name="suggestAnalyzerFieldType">string</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
<str name="suggest.dictionary">mySuggester</str>
<str name="suggest.onlyMorePopular">true</str>
<str name="suggest.count">5</str>
<str name="suggest.collate">true</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
我尝试执行此网址:http://localhost:8983/solr/press-portal/suggest?suggest=true&q=tit&suggest.dictionary=mySuggester
我应该获得结果,但它返回0 ....
有人可以帮我理解吗?
答案 0 :(得分:0)
不要忘记经常通过添加一个参数来构建词典
suggest.build=true
答案 1 :(得分:-1)
使用新字段名称添加权重字段“受欢迎”类型“长”索引为“true” 并尝试此请求:
localhost:8983/solr/suggest?suggest=true&suggest.dictionary=mySuggester&suggest.q=t