org.apache.solr.highlight

Class RegexFragmenter

  • All Implemented Interfaces:
    SolrInfoMBean, SolrFragmenter, NamedListInitializedPlugin


    public class RegexFragmenter
    extends HighlightingPluginBase
    implements SolrFragmenter
    Fragmenter that tries to produce snippets that "look" like a regular expression. solrconfig.xml parameters:
    • hl.regex.pattern: regular expression corresponding to "nice" fragments.
    • hl.regex.slop: how far the fragmenter can stray from the ideal fragment size. A slop of 0.2 means that the fragmenter can go over or under by 20%.
    • hl.regex.maxAnalyzedChars: how many characters to apply the regular expression to (independent from the global highlighter setting).
    NOTE: the default for maxAnalyzedChars is much lower for this fragmenter. After this limit is exhausted, fragments are produced in the same way as GapFragmenter