org.apache.solr.highlight
Class DefaultSolrHighlighter

java.lang.Object
  extended by org.apache.solr.highlight.SolrHighlighter
      extended by org.apache.solr.highlight.DefaultSolrHighlighter
All Implemented Interfaces:
PluginInfoInitialized

public class DefaultSolrHighlighter
extends SolrHighlighter
implements PluginInfoInitialized

Since:
solr 1.3

Field Summary
static org.slf4j.Logger log
           
 
Fields inherited from class org.apache.solr.highlight.SolrHighlighter
boundaryScanners, encoders, formatters, fragListBuilders, fragmenters, fragmentsBuilders
 
Constructor Summary
DefaultSolrHighlighter()
           
DefaultSolrHighlighter(SolrCore solrCore)
           
 
Method Summary
 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  Encoder getEncoder(String fieldName, SolrParams params)
          Return an Encoder appropriate for this field.
protected  Formatter getFormatter(String fieldName, SolrParams params)
          Return a Formatter appropriate for this field.
protected  FragListBuilder getFragListBuilder(String fieldName, SolrParams params)
           
protected  Fragmenter getFragmenter(String fieldName, SolrParams params)
          Return a Fragmenter appropriate for this field.
protected  FragmentsBuilder getFragmentsBuilder(String fieldName, SolrParams params)
           
protected  Highlighter getHighlighter(Query query, String fieldName, SolrQueryRequest request)
          Return a Highlighter appropriate for this field.
protected  int getMaxSnippets(String fieldName, SolrParams params)
          Return the max number of snippets for this field.
protected  Highlighter getPhraseHighlighter(Query query, String fieldName, SolrQueryRequest request, CachingTokenFilter tokenStream)
          Return a phrase Highlighter appropriate for this field.
 void init(PluginInfo info)
           
 void initalize(SolrConfig config)
          Deprecated. 
protected  boolean isMergeContiguousFragments(String fieldName, SolrParams params)
          Return whether adjacent fragments should be merged.
 
Methods inherited from class org.apache.solr.highlight.SolrHighlighter
emptyArray, getHighlightFields, isHighlightingEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static org.slf4j.Logger log
Constructor Detail

DefaultSolrHighlighter

public DefaultSolrHighlighter()

DefaultSolrHighlighter

public DefaultSolrHighlighter(SolrCore solrCore)
Method Detail

init

public void init(PluginInfo info)
Specified by:
init in interface PluginInfoInitialized

initalize

@Deprecated
public void initalize(SolrConfig config)
Deprecated. 

Specified by:
initalize in class SolrHighlighter

getPhraseHighlighter

protected Highlighter getPhraseHighlighter(Query query,
                                           String fieldName,
                                           SolrQueryRequest request,
                                           CachingTokenFilter tokenStream)
                                    throws IOException
Return a phrase Highlighter appropriate for this field.

Parameters:
query - The current Query
fieldName - The name of the field
request - The current SolrQueryRequest
tokenStream - document text CachingTokenStream
Throws:
IOException - If there is a low-level I/O error.

getHighlighter

protected Highlighter getHighlighter(Query query,
                                     String fieldName,
                                     SolrQueryRequest request)
Return a Highlighter appropriate for this field.

Parameters:
query - The current Query
fieldName - The name of the field
request - The current SolrQueryRequest

getMaxSnippets

protected int getMaxSnippets(String fieldName,
                             SolrParams params)
Return the max number of snippets for this field. If this has not been configured for this field, fall back to the configured default or the solr default.

Parameters:
fieldName - The name of the field
params - The params controlling Highlighting

isMergeContiguousFragments

protected boolean isMergeContiguousFragments(String fieldName,
                                             SolrParams params)
Return whether adjacent fragments should be merged.

Parameters:
fieldName - The name of the field
params - The params controlling Highlighting

getFormatter

protected Formatter getFormatter(String fieldName,
                                 SolrParams params)
Return a Formatter appropriate for this field. If a formatter has not been configured for this field, fall back to the configured default or the solr default (SimpleHTMLFormatter).

Parameters:
fieldName - The name of the field
params - The params controlling Highlighting
Returns:
An appropriate Formatter.

getEncoder

protected Encoder getEncoder(String fieldName,
                             SolrParams params)
Return an Encoder appropriate for this field. If an encoder has not been configured for this field, fall back to the configured default or the solr default (DefaultEncoder).

Parameters:
fieldName - The name of the field
params - The params controlling Highlighting
Returns:
An appropriate Encoder.

getFragmenter

protected Fragmenter getFragmenter(String fieldName,
                                   SolrParams params)
Return a Fragmenter appropriate for this field. If a fragmenter has not been configured for this field, fall back to the configured default or the solr default (GapFragmenter).

Parameters:
fieldName - The name of the field
params - The params controlling Highlighting
Returns:
An appropriate Fragmenter.

getFragListBuilder

protected FragListBuilder getFragListBuilder(String fieldName,
                                             SolrParams params)

getFragmentsBuilder

protected FragmentsBuilder getFragmentsBuilder(String fieldName,
                                               SolrParams params)

doHighlighting

public NamedList<Object> doHighlighting(DocList docs,
                                        Query query,
                                        SolrQueryRequest req,
                                        String[] defaultFields)
                                 throws IOException
Generates a list of Highlighted query fragments for each item in a list of documents, or returns null if highlighting is disabled.

Specified by:
doHighlighting in class SolrHighlighter
Parameters:
docs - query results
query - the query
req - the current request
defaultFields - default list of fields to summarize
Returns:
NamedList containing a NamedList for each document, which in turns contains sets (field, summary) pairs.
Throws:
IOException


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.