我正在尝试实施Solr建议者。我能够从Solr获取响应,但无法仅从响应中提取建议的术语。
回复如下:
{
"responseHeader":{
"status":0,
"QTime":1},
"suggest":{"mySuggester":{
"agi":{
"numFound":2,
"suggestions":[{
"term":"IGADC_T200_<b>Agi</b>le-Planning-and-Estimation",
"weight":0,
"payload":""},
{
"term":"IGADC_T200_<b>Agi</b>leOverview",
"weight":0,
"payload":""}]}}}}
如何仅从此响应中获取术语。
SolrQuery sq = new SolrQuery();
sq.setRequestHandler("/suggest");
sq.set("suggest.dictionary", "mySuggester");
sq.set("suggest.q",keyword);
sq.set("suggest",true);
sq.set("suggest.build", "true");
sq.set("suggest.count",10);
我尝试使用:
SpellCheckResponse spellCheckResponse = response.getSpellCheckResponse();
但它返回null,即使我的回复包含建议。
提前致谢。