Solr:我已设置“hl=true”,但没有输出任何摘要

发布于 2024-12-19 03:05:38 字数 2367 浏览 5 评论 0原文

我需要从查询词匹配的文档中获取片段,以便能够输出类似于网站 URL 下的 Google 片段的结果。例如:

片段 - 维基百科,免费的百科全书
en.wikipedia.org/wiki/Snippet
片段被定义为某物的一小部分,在更具体的上下文中可能指的是:采样(音乐),使用录音的简短短语作为...

我已设置hl=true 甚至查询 URL 中的 hl.fl='*' ,但没有输出任何摘要。

Solr 常见问题 说:

要使字段可汇总,它必须同时被存储和索引。

我正在使用 Nutch 和 Solr,并使用本教程设置它们。我还需要采取哪些额外步骤才能做到这一点?


添加示例查询和输出:

http://localhost:8983/solr/select/?q=test&version=2.2&start=0&rows=10&indent=on&hl=true

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">57</int>
<lst name="params">
<str name="indent">on</str>
<str name="start">0</str>
<str name="q">test</str>
<str name="hl">true</str>
<str name="version">2.2</str>
<str name="rows">10</str>
</lst>
</lst>
<result name="response" numFound="94" start="0">
<doc>
<arr name="anchor">
<str>User:Sir Lestaty de Lioncourt</str>
</arr>
<float name="boost">0.0</float>
<str name="digest">6c27160d0b08068f3873bb2c063508b3</str>
<str name="id">
http://aa.wikibooks.org/wiki/User:Sir_Lestaty_de_Lioncourt
</str>
<str name="segment">20111029223245</str>
<str name="title">User:Sir Lestaty de Lioncourt - Wikibooks</str>
<date name="tstamp">2011-10-29T21:34:27.055Z</date>
<str name="url">
http://aa.wikibooks.org/wiki/User:Sir_Lestaty_de_Lioncourt
</str>
</doc>
...
</result>
<lst name="highlighting">
<lst name="http://aa.wikibooks.org/wiki/User:Sir_Lestaty_de_Lioncourt"/>
<lst name="http://aa.wikipedia.org/wiki/User:PipepBot"/>
<lst name="http://aa.wikipedia.org/wiki/User:Purodha"/>
...
</lst>
</response>

I need to get snippets from documents where the query terms are matched to be able to output results similar to Google's snippet beneath the website URL. For example:

Snippet - Wikipedia, the free encyclopedia
en.wikipedia.org/wiki/Snippet
A snippet is defined as a small piece of something, it may in more specific contexts refer to: Sampling (music), the use of a short phrase of a recording as an ...

I have set hl=true and even hl.fl='*' in the query URL and but no summaries are being output.

Solr FAQs say:

For a field to be summarizable it must be both stored and indexed.

I'm using Nutch and Solr and have set them up using this tutorial. What additional steps to I need to take to be able to do this?


Adding sample query and output:

http://localhost:8983/solr/select/?q=test&version=2.2&start=0&rows=10&indent=on&hl=true

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">57</int>
<lst name="params">
<str name="indent">on</str>
<str name="start">0</str>
<str name="q">test</str>
<str name="hl">true</str>
<str name="version">2.2</str>
<str name="rows">10</str>
</lst>
</lst>
<result name="response" numFound="94" start="0">
<doc>
<arr name="anchor">
<str>User:Sir Lestaty de Lioncourt</str>
</arr>
<float name="boost">0.0</float>
<str name="digest">6c27160d0b08068f3873bb2c063508b3</str>
<str name="id">
http://aa.wikibooks.org/wiki/User:Sir_Lestaty_de_Lioncourt
</str>
<str name="segment">20111029223245</str>
<str name="title">User:Sir Lestaty de Lioncourt - Wikibooks</str>
<date name="tstamp">2011-10-29T21:34:27.055Z</date>
<str name="url">
http://aa.wikibooks.org/wiki/User:Sir_Lestaty_de_Lioncourt
</str>
</doc>
...
</result>
<lst name="highlighting">
<lst name="http://aa.wikibooks.org/wiki/User:Sir_Lestaty_de_Lioncourt"/>
<lst name="http://aa.wikipedia.org/wiki/User:PipepBot"/>
<lst name="http://aa.wikipedia.org/wiki/User:Purodha"/>
...
</lst>
</response>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

做个少女永远怀春 2024-12-26 03:05:38

您似乎没有指定要突出显示的字段 (hl.fl)。您应该创建一个用于突出显示的文本字段(不要使用字符串类型)并将其存储/索引。

Looks like you aren't specifying the field to highlight (hl.fl). You should create a text field to use for highlighting (don't use string type) and have it stored/indexed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文