public class PostingsSolrHighlighter extends SolrHighlighter implements PluginInfoInitialized
PostingsHighlighter
Example configuration:
<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> <str name="hl.multiValuedSeparatorChar"> </str> </lst> </requestHandler>...
<searchComponent class="solr.HighlightComponent" name="highlight"> <highlighting class="org.apache.solr.highlight.PostingsSolrHighlighter"/> </searchComponent>
Notes:
log
Constructor and Description |
---|
PostingsSolrHighlighter() |
Modifier and Type | Method and Description |
---|---|
NamedList<Object> |
doHighlighting(DocList docs,
Query query,
SolrQueryRequest req,
String[] defaultFields)
Generates a list of Highlighted query fragments for each item in a list
of documents, or returns null if highlighting is disabled.
|
protected NamedList<Object> |
encodeSnippets(String[] keys,
String[] fieldNames,
Map<String,String[]> snippets)
Encodes the resulting snippets into a namedlist
|
protected String[] |
getUniqueKeys(SolrIndexSearcher searcher,
int[] docIDs)
Retrieves the unique keys for the topdocs to key the results
|
void |
init(PluginInfo info) |
void |
initalize(SolrConfig config) |
protected BreakIterator |
parseBreakIterator(String type,
Locale locale)
parse a break iterator type for the specified locale
|
protected Locale |
parseLocale(String language,
String country,
String variant)
parse a locale from a language+country+variant spec
|
protected int[] |
toDocIDs(DocList docs)
Converts solr's DocList to the int[] docIDs
|
emptyArray, getHighlightFields, isHighlightingEnabled
public void initalize(SolrConfig config)
initalize
in class SolrHighlighter
public void init(PluginInfo info)
init
in interface PluginInfoInitialized
public NamedList<Object> doHighlighting(DocList docs, Query query, SolrQueryRequest req, String[] defaultFields) throws IOException
SolrHighlighter
doHighlighting
in class SolrHighlighter
docs
- query resultsquery
- the queryreq
- the current requestdefaultFields
- default list of fields to summarizeIOException
protected NamedList<Object> encodeSnippets(String[] keys, String[] fieldNames, Map<String,String[]> snippets)
keys
- the document unique keysfieldNames
- field names to highlight in the ordersnippets
- map from field name to snippet array for the docsprotected int[] toDocIDs(DocList docs)
protected String[] getUniqueKeys(SolrIndexSearcher searcher, int[] docIDs) throws IOException
IOException
protected BreakIterator parseBreakIterator(String type, Locale locale)
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.