PostingsHighlighter is a new highlighter in Solr4.3 to summarize documents for summary results.
There are already two highlighters, why another?
storeOffsetsWithPositions
, IndexWriter enforces that the offsets are correct and won't allow bogus data into the index. This allows for efficient highlighting algorithms and data compression.This is a configuration with all the defaults. All of the configuration can be specified at query-time too, and per-field (e.g. f.text.hl.tag.post=xxxx):
<searchComponent class="solr.HighlightComponent" name="highlight"> <highlighting class="org.apache.solr.highlight.PostingsSolrHighlighter"/> </searchComponent> <requestHandler name="standard" class="solr.StandardRequestHandler"> <lst name="defaults"> <int name="hl.snippets">1</int> <str name="hl.tag.pre"><em></str> <str name="hl.tag.post"></em></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> </lst> </requestHandler> |
To use this highlighter, you need to store offsets in parallel with the position data in the index.
<field name="text" type="text" indexed="true" stored="true" storeOffsetsWithPositions="true"/> |
See the javadoc for a full description.