Solr用copyField高亮显示 [英] Solr Highlighting with copyField

查看:118
本文介绍了Solr用copyField高亮显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Solr实例,在该实例中,我在文本主体的索引时间使用copyField,以使其通过两个不同的分析器进行处理.我想突出显示两个字段,因此我将两个字段都设置为stored = true.这样会使索引的文本存储区膨胀,我认为它们是重复数据.

I have a solr instance where I use copyField at index time on a body of text to put it through two different analysers. I want highlighting for both fields so I have both fields set to stored=true. This bloats the text store for the index with what I believe to be duplicate data.

所以

1)有没有一种方法可以将一个字段指向其他存储的文本字段?

1) Is there a way to point one field to the other fields stored text?

和/或

2)是否有更好的方法来保持不同分析人员的突出显示?

2) Is there a better approach to keeping highlighting with different analysers?

我正在使用solr 6.5,但可以更新到7.

I am using solr 6.5, but can update to 7.

推荐答案

1)是否可以将一个字段指向其他字段存储的文本?

1) Is there a way to point one field to the other fields stored text?

A:如果您试图将一个字段指向另一个字段的分析值,那么答案是否定的.您可以做的实际上是您正在做的事情,使用copyField在相同的输入值上具有两个不同的分析器.

A: If you're trying to point one field to the analysed value of another field, the answer is no. What you can do is actually what you're doing, using copyField to have two different analysers on the same input value.

2)是否有更好的方法来保持不同分析人员的突出显示?

2) Is there a better approach to keeping highlighting with different analysers?

A:恐怕答案还是不行,至少没有100%匹配...您可以做的是使用参数hl查询一个字段并引用另一个字段(使用不同的分析器)以突出显示.fl.但是正如所说此处:

A: I'm afraid the answer is no again, at least not with a 100% match... What you can do is query for one field and reference another (with different analyser) to highlight, using the parameter hl.fl. But as said here:

如果查询引用的字段与正在查询的字段不同 突出显示并且它们具有不同的文本分析,查询可能不会 突出显示应具有的查询字词,反之亦然.使用的分析 是突出显示的字段(hl.fl)的字段,而不是查询字段

if the query references fields different from the field being highlighted and they have different text analysis, the query may not highlight query terms it should have and vice versa. The analysis used is that of the field being highlighted (hl.fl), not the query fields

这篇关于Solr用copyField高亮显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆