I am using Solr 8.0.
To be able to use docValues="true" with class="solr.TextField" , I installed solr-dvtf.
Here is the text_hl field setting in shema.xml:
<fieldType name="text_general_dvtf" class="org.anenerbe.solr.DocValuesTextField" indexed="false" stored="false" multiValued="true" docValues="true">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.StopFilterFactory" words="/var/solr/data/core4/conf/stopwords.txt" ignoreCase="true" />
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.StopFilterFactory" words="/var/solr/data/core4/conf/stopwords.txt" ignoreCase="true" />
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
</fieldType>
<copyField source="text" dest="text_hl" />
Now I want to implement highlighting for this field, but I get an empty result for highlighting. I want to understand what needs to be done to make the highlight for this field work, but I can't find any information about it.
You need to set the stored=true
for your field in order to achieve the highlighting.
Add the attribute to your field in the schema.xml
and restart the server and re-index the data.