Solr Highlighting with copyField

时间秒杀一切 提交于 2019-12-10 18:47:21

问题


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.

So

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

And/Or

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

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: 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) Is there a better approach to keeping highlighting with different analysers?

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:

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



来源:https://stackoverflow.com/questions/46921052/solr-highlighting-with-copyfield

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!