我使用Solr Suggest组件返回多值存储的字段的建议。 问题:只有文档的多值字段的第一个条目才会添加到字典数据库中。
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">suggestSkill</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.jaspell.JaspellLookupFactory</str> <!-- org.apache.solr.spelling.suggest.fst -->
<str name="dictionaryImpl">DocumentDictionaryFactory</str> <!-- org.apache.solr.spelling.suggest.HighFrequencyDictionaryFactory -->
<str name="field">skills</str>
<str name="weightField">skills</str>
<str name="storeDir">/usr/share/solr/live/solr/collection1/suggest/</str>
<str name="suggestAnalyzerFieldType">string</str>
<str name="buildOnCommit">true</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">suggestSkill</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
想象一下以下文件:
"docs": [
{
"id": "100444001",
"firstName": "Piet",
"lastName": "Huysentruyt",
"skills": [
"mongoDB",
"angularJS",
"Java ServerPages",
"mongoDB",
"angularRD"
],
"_version_": 1482216060554838000
},
{
"id": "104444",
"firstName": "Bomas",
"lastName": "Banciaux",
"skills": [
"bower",
"Front-End Engineering"
],
"_version_": 1482216060556935200
}]
在搜索技能建议时,/ suggest字段中只能使用bower和mongo。甚至在suggest.build命令之后。有什么想法吗?
更新:自Solr第5版起,建议器现在适用于多值字段