Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用SolrJ读取solr.SuggestComponent结果_Solr_Solrj_Autosuggest - Fatal编程技术网

使用SolrJ读取solr.SuggestComponent结果

使用SolrJ读取solr.SuggestComponent结果,solr,solrj,autosuggest,Solr,Solrj,Autosuggest,我一直在试图弄清楚如何使用SolrJ处理自动建议结果。我已经在solrconfig.xml中配置了solr.SuggestComponent,并通过solr Admin查询工具获得了预期的结果。我的结果如下: { "responseHeader": { "status": 0, "QTime": 6 }, "suggest": { "mySuggester": { "re": { "numFound": 10, "

我一直在试图弄清楚如何使用SolrJ处理自动建议结果。我已经在solrconfig.xml中配置了solr.SuggestComponent,并通过solr Admin查询工具获得了预期的结果。我的结果如下:

{
  "responseHeader": {
    "status": 0,
    "QTime": 6
   },
  "suggest": {
    "mySuggester": {
      "re": {
        "numFound": 10,
        "suggestions": [
          {
            "term": "reviewed",
            "weight": 2841,
            "payload": ""
          },
          {
            "term": "references",
            "weight": 1880,
            "payload": ""
          },
          {
            "term": "related",
            "weight": 1462,
            "payload": ""
          }]
        }
      }
   }
}

我在Spring应用程序中使用SolrJ来发出Solr请求并处理响应。我重新填充了QueryResponse,但无法找到从QueryResponse对象中提取“term”的方法,以便将它们返回到jsp。有什么建议吗?我认为应该有一些相当简单的方法来提取这些结果,因为似乎有其他类型的结果的内置方法,如搜索结果(文档)、facets、突出显示、拼写检查等。我对Solr是新手,可能缺少明显的解决方案。提前感谢您的帮助。

我很确定您在建议中使用了SpellCheckComponent(因为在这里查看-)

所以,很明显,你需要使用这个方法-

希望能有帮助