新旧版本中的 solr 高亮显示
solr highlighting in old and new versions
我正在将一个网站从旧版本的 solr (1.4.1) 迁移到另一台机器上的当前发行版本 (5.2.1) 并注意到一些差异。
在旧版本中,我可以像这样用 url 突出显示:
在新版本中,有一点不同的是我需要指定一个集合。另一个区别是,如果我把 text:
放在 q
的值前面,新版本会报错。
所以,考虑到这些差异,我最终得到 URL 这样的:
第二个URL不给我高亮fragments/snippets。也就是说,旧的 URL 会给出这样的东西:
"highlighting":{
"document0_id":{"text":["The <em>software</em> is awesome"]}}
新的 URL 给出了这样的东西:
"highlighting":{
"document0_id":{}}
我需要做什么才能在 solr 5.2.1 中返回高亮片段?
[已编辑]
此外,我尝试在两台机器上通过其 id 选择单个文档。在旧机器上,一个 url like
http://localhost:8983/solr/select?wt=json&indent=true&q=id:thedocumentid
returns 一些 JSON 包含 text
字段,其中包含原始 HTML 文档的完整可搜索文本。在新机器上类似 url(但包含集合):
http://localhost:8983/solr/default/select?wt=json&indent=true&q=id:thedocumentid
...returns 类似 JSON 不 包含 text
字段。
我注意到搜索 returns 的结果是正确的;问题是在新机器上,结果不包括突出显示的片段。
所以看起来问题可能是我需要指定这些文档在索引时有一个文本字段;我该怎么做?
在第一个查询中,您专门在文本字段中搜索,而在第二个查询中则不是。
第二个你提到了 hl.fl 意思是 "Specifies a list of fields to highlight. Accepts a comma- or space-delimited list of fields for which Solr should generate highlighted snippets. If left blank, highlights the defaultSearchField"
通过进行更改重试...
一位同事(没有被赏金诱惑)注意到我的 text
字段在我的 schema.xml 中有 stored="false"
,并建议将其更改为 true
。成功了。
我正在将一个网站从旧版本的 solr (1.4.1) 迁移到另一台机器上的当前发行版本 (5.2.1) 并注意到一些差异。
在旧版本中,我可以像这样用 url 突出显示:
在新版本中,有一点不同的是我需要指定一个集合。另一个区别是,如果我把 text:
放在 q
的值前面,新版本会报错。
所以,考虑到这些差异,我最终得到 URL 这样的:
第二个URL不给我高亮fragments/snippets。也就是说,旧的 URL 会给出这样的东西:
"highlighting":{
"document0_id":{"text":["The <em>software</em> is awesome"]}}
新的 URL 给出了这样的东西:
"highlighting":{
"document0_id":{}}
我需要做什么才能在 solr 5.2.1 中返回高亮片段?
[已编辑]
此外,我尝试在两台机器上通过其 id 选择单个文档。在旧机器上,一个 url like
http://localhost:8983/solr/select?wt=json&indent=true&q=id:thedocumentid
returns 一些 JSON 包含 text
字段,其中包含原始 HTML 文档的完整可搜索文本。在新机器上类似 url(但包含集合):
http://localhost:8983/solr/default/select?wt=json&indent=true&q=id:thedocumentid
...returns 类似 JSON 不 包含 text
字段。
我注意到搜索 returns 的结果是正确的;问题是在新机器上,结果不包括突出显示的片段。 所以看起来问题可能是我需要指定这些文档在索引时有一个文本字段;我该怎么做?
在第一个查询中,您专门在文本字段中搜索,而在第二个查询中则不是。
第二个你提到了 hl.fl 意思是 "Specifies a list of fields to highlight. Accepts a comma- or space-delimited list of fields for which Solr should generate highlighted snippets. If left blank, highlights the defaultSearchField"
通过进行更改重试...
一位同事(没有被赏金诱惑)注意到我的 text
字段在我的 schema.xml 中有 stored="false"
,并建议将其更改为 true
。成功了。