org.apache.solr.highlight

Class UnifiedSolrHighlighter

  • All Implemented Interfaces:
    PluginInfoInitialized


    public class UnifiedSolrHighlighter
    extends SolrHighlighter
    implements PluginInfoInitialized
    Highlighter impl that uses UnifiedHighlighter

    Example configuration with default values:

     <requestHandler name="/select" class="solr.SearchHandler">
     <lst name="defaults">
     <str name="hl.method">unified</str>
     <int name="hl.snippets">1</int>
     <str name="hl.tag.pre">&lt;em&gt;</str>
     <str name="hl.tag.post">&lt;/em&gt;</str>
     <str name="hl.simple.pre">&lt;em&gt;</str>
     <str name="hl.simple.post">&lt;/em&gt;</str>
     <str name="hl.tag.ellipsis">... </str>
     <bool name="hl.defaultSummary">true</bool>
     <str name="hl.encoder">simple</str>
     <float name="hl.score.k1">1.2</float>
     <float name="hl.score.b">0.75</float>
     <float name="hl.score.pivot">87</float>
     <str name="hl.bs.language"></str>
     <str name="hl.bs.country"></str>
     <str name="hl.bs.variant"></str>
     <str name="hl.bs.type">SENTENCE</str>
     <int name="hl.maxAnalyzedChars">10000</int>
     <bool name="hl.highlightMultiTerm">true</bool>
     <bool name="hl.usePhraseHighlighter">true</bool>
     <int name="hl.cacheFieldValCharsThreshold">524288</int>
     <str name="hl.offsetSource"></str>
     </lst>
     </requestHandler>
     

    Notes:

    • hl.q (string) can specify the query
    • hl.fl (string) specifies the field list.
    • hl.snippets (int) specifies how many snippets to return.
    • hl.tag.pre (string) specifies text which appears before a highlighted term.
    • hl.tag.post (string) specifies text which appears after a highlighted term.
    • hl.simple.pre (string) specifies text which appears before a highlighted term. (prefer hl.tag.pre)
    • hl.simple.post (string) specifies text which appears before a highlighted term. (prefer hl.tag.post)
    • hl.tag.ellipsis (string) specifies text which joins non-adjacent passages. The default is to retain each value in a list without joining them.
    • hl.defaultSummary (bool) specifies if a field should have a default summary of the leading text.
    • hl.encoder (string) can be 'html' (html escapes content) or 'simple' (no escaping).
    • hl.score.k1 (float) specifies bm25 scoring parameter 'k1'
    • hl.score.b (float) specifies bm25 scoring parameter 'b'
    • hl.score.pivot (float) specifies bm25 scoring parameter 'avgdl'
    • hl.bs.type (string) specifies how to divide text into passages: [SENTENCE, LINE, WORD, CHAR, WHOLE]
    • hl.bs.language (string) specifies language code for BreakIterator. default is empty string (root locale)
    • hl.bs.country (string) specifies country code for BreakIterator. default is empty string (root locale)
    • hl.bs.variant (string) specifies country code for BreakIterator. default is empty string (root locale)
    • hl.maxAnalyzedChars (int) specifies how many characters at most will be processed in a document for any one field.
    • hl.highlightMultiTerm (bool) enables highlighting for range/wildcard/fuzzy/prefix queries at some cost. default is true
    • hl.usePhraseHighlighter (bool) enables phrase highlighting. default is true
    • hl.cacheFieldValCharsThreshold (int) controls how many characters from a field are cached. default is 524288 (1MB in 2 byte chars)
    • hl.offsetSource (string) specifies which offset source to use, prefers postings, but will use what's available if not specified