Return Solr 4.7 突出显示的多值字段的所有相关值
Return all relevant values for highlighted multivalue fields for Solr 4.7
我正在使用 Solr 4.7 在我的服务器上启用标准突出显示。我的文档包含(除其他外)以下字段:
{
"id": [
"fdc3833a-0e4f-4314-ba8c"
],,
"tag": [
"solr",
"solrJ",
"solrCloud"
"solrX"
],
"title": "Solr question about highlighting",
"description": "I am working to enable Standard Highlighting on my server with Solr 4.7. My documents contain (among the others) the following.........",
}
在这三个字段中,只有 "tag" 是多值的。
我在 solrconfig.xml 文件中的默认配置是:
<str name="hl">on</str>
<str name="hl.fl">content title description tag</str>
<str name="hl.snippets">2</str>
当我 运行 查询如:
https://<YOUR_PATH>/select?q=solr*&wt=json&indent=true
我得到以下亮点:
"highlighting": {
"fdc3833a-0e4f-4314-ba8c": {
"title": [
"<b>Solr</b> question about highlighting"
],
"summary": [
"I am working to enable Standard Highlighting on my server with <b>Solr</b> 4.7. My documents contain (among the others) the following........."
],
**"tag": [
"<b>Solr</b>",
"<b>SolrJ</b>"
]**
}
}
虽然我希望获得所有标签。
我发现 Solr 在多值字段中处理多个值,因为它们是突出显示的片段,所以因为我有 hl.snippets=2 只显示前两个值。
如何获取标签的所有值? (显然,仅针对多值字段更改片段数量是不可接受的答案)。
Solr 4.7 有没有办法在高亮中处理多值字段?
我的期望是得到这样的回应:
"highlighting": {
"fdc3833a-0e4f-4314-ba8c": {
"title": [
"<b>Solr</b> question about highlighting"
],
"summary": [
"I am working to enable Standard Highlighting on my server with <b>Solr</b> 4.7. My documents contain (among the others) the following........."
],
**"tag": [
"<b>Solr</b>",
"<b>SolrJ</b>",
"<b>SolrCloud</b>",
"<b>SolrX</b>"
]**
}
}
在搜索文档和运行一些测试后,我发现在solrconfig.xml中设置参数hl.preserveMulti:
<str name="hl.preserveMulti">true</str>
不仅像文档所说的那样保留多值文档中值的顺序,而且returns 多值文档中所有值的原始顺序。
所以如果我们设置上面提到的参数并且我们的索引中有以下文档:
{
"id": [
"fdc3833a-0e4f-4314-ba8c"
],,
"tag": [
"solr",
"solrJ",
"solrCloud"
"solrX",
"notRelevantTag"
],
"title": "Solr question about highlighting",
"description": "I am working to enable Standard Highlighting on my server with Solr 4.7. My documents contain (among the others) the following.........",
}
查询:
https://<YOUR_PATH>/select?q=solr*&wt=json&indent=true
会给我一个突出显示的结果:
"highlighting": {
"fdc3833a-0e4f-4314-ba8c": {
"title": [
"<b>Solr</b> question about highlighting"
],
"summary": [
"I am working to enable Standard Highlighting on my server with <b>Solr</b> 4.7. My documents contain (among the others) the following........."
],
**"tag": [
"<b>Solr</b>",
"<b>SolrJ</b>",
"<b>SolrCloud</b>",
"<b>SolrX</b>",
"notRelevantTag"
]**
}
}
我正在使用 Solr 4.7 在我的服务器上启用标准突出显示。我的文档包含(除其他外)以下字段:
{
"id": [
"fdc3833a-0e4f-4314-ba8c"
],,
"tag": [
"solr",
"solrJ",
"solrCloud"
"solrX"
],
"title": "Solr question about highlighting",
"description": "I am working to enable Standard Highlighting on my server with Solr 4.7. My documents contain (among the others) the following.........",
}
在这三个字段中,只有 "tag" 是多值的。 我在 solrconfig.xml 文件中的默认配置是:
<str name="hl">on</str>
<str name="hl.fl">content title description tag</str>
<str name="hl.snippets">2</str>
当我 运行 查询如:
https://<YOUR_PATH>/select?q=solr*&wt=json&indent=true
我得到以下亮点:
"highlighting": {
"fdc3833a-0e4f-4314-ba8c": {
"title": [
"<b>Solr</b> question about highlighting"
],
"summary": [
"I am working to enable Standard Highlighting on my server with <b>Solr</b> 4.7. My documents contain (among the others) the following........."
],
**"tag": [
"<b>Solr</b>",
"<b>SolrJ</b>"
]**
}
}
虽然我希望获得所有标签。 我发现 Solr 在多值字段中处理多个值,因为它们是突出显示的片段,所以因为我有 hl.snippets=2 只显示前两个值。 如何获取标签的所有值? (显然,仅针对多值字段更改片段数量是不可接受的答案)。 Solr 4.7 有没有办法在高亮中处理多值字段?
我的期望是得到这样的回应:
"highlighting": {
"fdc3833a-0e4f-4314-ba8c": {
"title": [
"<b>Solr</b> question about highlighting"
],
"summary": [
"I am working to enable Standard Highlighting on my server with <b>Solr</b> 4.7. My documents contain (among the others) the following........."
],
**"tag": [
"<b>Solr</b>",
"<b>SolrJ</b>",
"<b>SolrCloud</b>",
"<b>SolrX</b>"
]**
}
}
在搜索文档和运行一些测试后,我发现在solrconfig.xml中设置参数hl.preserveMulti:
<str name="hl.preserveMulti">true</str>
不仅像文档所说的那样保留多值文档中值的顺序,而且returns 多值文档中所有值的原始顺序。 所以如果我们设置上面提到的参数并且我们的索引中有以下文档:
{
"id": [
"fdc3833a-0e4f-4314-ba8c"
],,
"tag": [
"solr",
"solrJ",
"solrCloud"
"solrX",
"notRelevantTag"
],
"title": "Solr question about highlighting",
"description": "I am working to enable Standard Highlighting on my server with Solr 4.7. My documents contain (among the others) the following.........",
}
查询:
https://<YOUR_PATH>/select?q=solr*&wt=json&indent=true
会给我一个突出显示的结果:
"highlighting": {
"fdc3833a-0e4f-4314-ba8c": {
"title": [
"<b>Solr</b> question about highlighting"
],
"summary": [
"I am working to enable Standard Highlighting on my server with <b>Solr</b> 4.7. My documents contain (among the others) the following........."
],
**"tag": [
"<b>Solr</b>",
"<b>SolrJ</b>",
"<b>SolrCloud</b>",
"<b>SolrX</b>",
"notRelevantTag"
]**
}
}