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/0/mercurial/2.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
如何在solr/lucene中按字段对摘录进行分组?_Solr_Lucene - Fatal编程技术网

如何在solr/lucene中按字段对摘录进行分组?

如何在solr/lucene中按字段对摘录进行分组?,solr,lucene,Solr,Lucene,在Solr中为以下文档编制索引时: [ { "id" : "978-0641723445", "name" : "The Lightning Thief", "author" : "Rick Riordan", "series_t" : "Rick Jackson and the Olympians", } , { "id" : "978-1423103349", "cat" : ["book","paperback"], "n

在Solr中为以下文档编制索引时:

[
  {
    "id" : "978-0641723445",
    "name" : "The Lightning Thief",
    "author" : "Rick Riordan",
    "series_t" : "Rick Jackson and the Olympians",
  }
,
  {
    "id" : "978-1423103349",
    "cat" : ["book","paperback"],
    "name" : "The Sea of Monsters",
    "author" : "Rick Riordan",
    "series_t" : "Rick Jackson and the Olympians",
  }
]
并运行以下查询:

我想要一个由每个匹配字段的名称和字段内容的子摘录组成的摘录(子摘录的实际格式并不重要):


我必须如何更改我的solr查询才能实现这一点?或者这项更改需要定制solr/lucene荧光笔吗?

采用了@MatsLindh的解决方案(请参见评论)。

您是否尝试过
hl.requirefeldmatch=true
hl.fl=*
-这应该可以突出显示查询匹配的所有字段。谢谢@MatsLindh,这个解决方案适合我!
"responseHeader": {
    "status": 0,
    "QTime": 1,
    "params": { ...
    },
    "response": {
        "numFound": 2,
        "start": 0,
        "docs": [{
                "id": "978-0641723445",
                .. {
                    "id": "978-1423103349",
                    ..
                }],
            "highlighting": {
                "978-0641723445": {
                    "author": "Rick Riordan",
                    "series_t": "Rick Riordan and..."
                },
                "978-1423103349": {
                    "author": "Rick Riordan",
                    "series_t": "Rick Riordan and..."

                }
            }
        }
    }