当我在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",
}
]
并运行以下查询: http://localhost:8983/solr/gettingstarted/select?hl.fl=name&hl=on&indent=on&q=rick&rows=20&wt=json
我希望有一个摘录,其中包含每个匹配字段的名称和字段内容的子摘录(子摘录的实际格式不是那么重要):
"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..."
}
}
}
}
如何更改solr查询以完成此操作?或者这种变化是否需要定制的solr / lucene荧光笔?
答案 0 :(得分:0)
使用@ MatsLindh的解决方案(见评论)。