Solr highlighting configuration
Solr has two types of highlighters—regular highlighter and fast vector highlighter. The regular highlighter works on most query types but does not scale well to large documents. On the other hand, the fast vector highlighter scales very well to large documents but supports fewer query types. Though personally I have not come across a situation where the fast vector highlighter does not work.
Note
The fast vector highlighter requires termVectors
, termPositions
, and termOffsets
to be set for it to work.
Let us look at the Solr configuration for highlighting. Open up the Solr configuration at <solr_directory>/example/solr/collection1/conf/solrconfig.xml
. Search for an XML element searchComponent
with attribute class="solr.HighlightComponent"
and name="highlight"
. We can see that there are multiple fragmenters, an HTML formatter, and an HTML encoder defined in the file. We also have multiple fragmentsBuilders
, multiple fragListBuilders
and multiple boundaryScanners...