Class PostingsSolrHighlighter

  • All Implemented Interfaces:

    public class PostingsSolrHighlighter
    extends SolrHighlighter
    implements PluginInfoInitialized
    Highlighter impl that uses PostingsHighlighter

    Example configuration:

       <requestHandler name="/select" class="solr.SearchHandler">
         <lst name="defaults">
           <str name="hl.method">postings</str>
           <int name="hl.snippets">1</int>
           <str name="hl.tag.pre">&lt;em&gt;</str>
           <str name="">&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=""></str>
           <str name=""></str>
           <str name=""></str>
           <str name="">SENTENCE</str>
           <int name="hl.maxAnalyzedChars">10000</int>
           <str name="hl.multiValuedSeparatorChar"> </str>
           <bool name="hl.highlightMultiTerm">false</bool>


    • fields to highlight must be configured with storeOffsetsWithPositions="true"
    • hl.q (string) can specify the query
    • hl.fl (string) specifies the field list.
    • hl.snippets (int) specifies how many underlying passages form the resulting snippet.
    • hl.tag.pre (string) specifies text which appears before a highlighted term.
    • (string) specifies text which appears after a highlighted term.
    • hl.tag.ellipsis (string) specifies text which joins non-adjacent passages.
    • hl.defaultSummary (bool) specifies if a field should have a default summary.
    • 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'
    • (string) specifies how to divide text into passages: [SENTENCE, LINE, WORD, CHAR, WHOLE]
    • (string) specifies language code for BreakIterator. default is empty string (root locale)
    • (string) specifies country code for BreakIterator. default is empty string (root locale)
    • (string) specifies country code for BreakIterator. default is empty string (root locale)
    • hl.maxAnalyzedChars specifies how many characters at most will be processed in a document.
    • hl.multiValuedSeparatorChar specifies the logical separator between values for multi-valued fields.
    • hl.highlightMultiTerm enables highlighting for range/wildcard/fuzzy/prefix queries. NOTE: currently hl.maxAnalyzedChars cannot yet be specified per-field