| java.lang.Object org.apache.solr.util.HighlightingUtils
HighlightingUtils | public class HighlightingUtils (Code) | | Collection of Utility and Factory methods for Highlighting.
|
Method Summary | |
public static NamedList | 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. | public static Formatter | getFormatter(String fieldName, SolrQueryRequest request) Return a formatter appropriate for this field. | public static Fragmenter | getFragmenter(String fieldName, SolrQueryRequest request) Return a fragmenter appropriate for this field. | public static String[] | getHighlightFields(Query query, SolrQueryRequest request, String[] defaultFields) Return a String array of the fields to be highlighted. | public static Highlighter | getHighlighter(Query query, String fieldName, SolrQueryRequest request) Return a Highlighter appropriate for this field. | public static int | getMaxSnippets(String fieldName, SolrQueryRequest request) Return the max number of snippets for this field. | public static QueryScorer | getQueryScorer(Query query, String fieldName, SolrQueryRequest request) Return a QueryScorer suitable for this Query and field. | public static boolean | isHighlightingEnabled(SolrQueryRequest request) Check whether Highlighting is enabled for this request. |
doHighlighting | public static NamedList doHighlighting(DocList docs, Query query, SolrQueryRequest req, String[] defaultFields) throws IOException(Code) | | Generates a list of Highlighted query fragments for each item in a list
of documents, or returns null if highlighting is disabled.
Parameters: docs - query results Parameters: query - the query Parameters: req - the current request Parameters: defaultFields - default list of fields to summarize NamedList containing a NamedList for each document, which inturns contains sets (field, summary) pairs. |
getFormatter | public static Formatter getFormatter(String fieldName, SolrQueryRequest request)(Code) | | 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 Parameters: request - The current SolrQueryRequest An appropriate Formatter. |
getFragmenter | public static Fragmenter getFragmenter(String fieldName, SolrQueryRequest request)(Code) | | 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 Parameters: request - The current SolrQueryRequest An appropriate Fragmenter. |
getHighlightFields | public static String[] getHighlightFields(Query query, SolrQueryRequest request, String[] defaultFields)(Code) | | Return a String array of the fields to be highlighted.
Falls back to the programatic defaults, or the default search field if the list of fields
is not specified in either the handler configuration or the request.
Parameters: query - The current Query Parameters: request - The current SolrQueryRequest Parameters: defaultFields - Programmatic default highlight fields, used if nothing is specified in the handler config or the request. |
getHighlighter | public static Highlighter getHighlighter(Query query, String fieldName, SolrQueryRequest request)(Code) | | Return a Highlighter appropriate for this field.
Parameters: query - The current Query Parameters: fieldName - The name of the field Parameters: request - The current SolrQueryRequest |
getMaxSnippets | public static int getMaxSnippets(String fieldName, SolrQueryRequest request)(Code) | | 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 Parameters: request - The current SolrQueryRequest |
getQueryScorer | public static QueryScorer getQueryScorer(Query query, String fieldName, SolrQueryRequest request)(Code) | | Return a QueryScorer suitable for this Query and field.
Parameters: query - The current query Parameters: fieldName - The name of the field Parameters: request - The SolrQueryRequest |
isHighlightingEnabled | public static boolean isHighlightingEnabled(SolrQueryRequest request)(Code) | | Check whether Highlighting is enabled for this request.
Parameters: request - The current SolrQueryRequest true if highlighting enabled, false if not. |
|
|