Highlighting using the fast vector highlighter
Let us change the schema.xml
and enable termVectors, termPositions, and termOffsets for two fields name
and *_t
(this will match all fields ending with _t
-series_t
).
<field name="name" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true"/> <dynamicField name="*_t" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true"/>
Restart Tomcat. Based on your system (Windows or Linux) and the type of installation, the mechanism to restart Tomcat will differ. Kindly check the Tomcat documentation for your system to restart Tomcat.
Since the schema is now changed, we will need to re-index all the documents that we had indexed in Chapter 2, Inserting, Updating and Deleting Documents from Solr. Also index the books.csv
file from this chapter. In code, enable fast highlighting and set the fragmentsBuilder
(HTML tags) to be used for highlighting...