我正在使用 SOLR 的拼写检查组件来获取建议,并期望 Hits 部分从新单词中返回许多命中,但在所有情况下它都返回零命中:
{
"spellcheck":{
"suggestions":[
"pho",
{
"numFound":8,
"startOffset":0,
"endOffset":3,
"suggestion":[
"photo",
"phone",
"phone's",
"phones",
"photography",
"photoimpression's",
"photographers",
"photos"
]
},
"collation",
[
"collationQuery",
"photo",
"hits",
0,
"misspellingsAndCorrections",
[
"pho",
"photo"
]
],
"collation",
[
"collationQuery",
"phone",
"hits",
0,
"misspellingsAndCorrections",
[
"pho",
"phone"
]
],
"collation",
[
"collationQuery",
"phone's",
"hits",
0,
"misspellingsAndCorrections",
[
"pho",
"phone's"
]
],
"collation",
[
"collationQuery",
"phones",
"hits",
0,
"misspellingsAndCorrections",
[
"pho",
"phones"
]
],
"collation",
[
"collationQuery",
"photography",
"hits",
0,
"misspellingsAndCorrections",
[
"pho",
"photography"
]
],
"collation",
[
"collationQuery",
"photoimpression's",
"hits",
0,
"misspellingsAndCorrections",
[
"pho",
"photoimpression's"
]
],
"collation",
[
"collationQuery",
"photographers",
"hits",
0,
"misspellingsAndCorrections",
[
"pho",
"photographers"
]
],
"collation",
[
"collationQuery",
"photos",
"hits",
0,
"misspellingsAndCorrections",
[
"pho",
"photos"
]
]
]
}
}
我的设置是:
<searchComponent class="solr.SpellCheckComponent" name="suggest">
<lst name="spellchecker">
<str name="name">suggest</str>
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookupFactory</str>
<str name="field">text</str>
<float name="threshold">0.005</float>
<str name="buildOnCommit">true</str>
</lst>
</searchComponent>
对于我的组件和
<requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/suggest">
<lst name="defaults">
<str name="spellcheck">true</str>
<str name="spellcheck.dictionary">suggest</str>
<str name="spellcheck.onlyMorePopular">true</str>
<str name="spellcheck.count">5</str>
<str name="spellcheck.collate">true</str>
<str name="spellcheck.maxCollations">10</str>
<str name="spellcheck.collateExtendedResults">true</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
关于如何填写此内容的任何想法,以便我可以向最终用户显示#results?