4
votes

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 Answers

0
votes

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