Highlighter settings

Last updated on
30 April 2025

The highlighter settings (xc/search/displaying/highlighter) help you to give the user a context of the searched terms. You can define more than one highlighters, and link them to search user interfaces at the search user interface editing page (xc/search/displaying/ui).

These are the parameter you can setup:

name:
Display name of the attribute set.
description:
default highlighter
Longer text describing the purpos of this facet.
field list:
A comma or space separated list of fields that will be highlighted. You may use an asterisk wildcard to conveniently highlight on all of the text fields, such as * or r_*.
require field match:
If set to true, then a field will not be highlighted for a result unless the query also matched against that field.
use phrase highlighter:
If the query contained a phrase (it was quoted), then this will ensure that only the phrase is highlighted and not the words out of context of the queried phrase.
highlight multiterm:
If any wildcard or fuzzy queries are used, then this will ensure that the highlighting matches such terms correctly.
snippets:
This is the maximum number of highlighted snippets (aka fragments) that will be generated per field.
fragment size:
The maximum number of characters returned in each snippet (aka fragment), measured in characters.
merge contigous:
If set to true, then overlapping snippets are merged.
maximum analyzed characters:
The maximum number of characters in a field that will be sought for highlighting.
alternative field:
If a snippet couldn't be generated (no terms matched) for a field, then this parameter refers to a field that will be returned as the snippet.
maximum length of alternative field:
The maximum number of characters to return for alternate field. 0 means unlimited.
formatter:
This is an extension point to supply alternate formatting algorithms. Currently there are two formatters: "simple formatter" and "regular expression based formatter". The first is the default. The regex based formatter allows you to write an regular expression, which find, and shows the highlighted terms. You can set up that in a (by default hidden) part of the form. If you want to use that click on the fields for regex formatter, and fill the form.
pre:
The text that will be inserted immediately before matched terms in the snippet in order to demarcate them from the surrounding text.
post:
The text that will be inserted immediately after matched terms in the snippet in order to demarcate them from the surrounding text.
fragmenter:
This is an extension point in Solr to specify the fragmenting algorithm.

If you use regular expression based formatter, you can give the following parameters:

regular expression pattern:
This is a regular expression matching a block of text that will serve as the snippet/fragment to subsequently be highlighted.
regex slop:
The factor to which fragsize can vary to accommodate the regular expression.
increment:
Sets the minimum lucene position increment gap from one term to the next to trigger a new fragment.
maximum analyzed characters with regex:
For performance reasons, this puts a limit on the number of leading characters of the field that are fragmented based on the regular expression.

Help improve this page

Page status: Not set

You can: