Package org.apache.solr.highlight
Class SolrHighlighter
java.lang.Object
org.apache.solr.highlight.SolrHighlighter
- Direct Known Subclasses:
DefaultSolrHighlighter,UnifiedSolrHighlighter
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.apache.solr.common.util.NamedList<Object> doHighlighting(DocList docs, org.apache.lucene.search.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 booleanemptyArray(String[] arr) protected static String[]expandWildcardsInFields(Supplier<Collection<String>> availableFieldNamesSupplier, String... inFields) String[]getHighlightFields(org.apache.lucene.search.Query query, SolrQueryRequest request, String[] defaultFields) Return a String array of the fields to be highlighted.booleanisHighlightingEnabled(org.apache.solr.common.params.SolrParams params) Check whether Highlighting is enabled for this request.
-
Field Details
-
DEFAULT_MAX_CHARS
public static int DEFAULT_MAX_CHARS -
DEFAULT_PHRASE_LIMIT
public static int DEFAULT_PHRASE_LIMIT
-
-
Constructor Details
-
SolrHighlighter
public SolrHighlighter()
-
-
Method Details
-
isHighlightingEnabled
public boolean isHighlightingEnabled(org.apache.solr.common.params.SolrParams params) Check whether Highlighting is enabled for this request.- Parameters:
params- The params controlling Highlighting- Returns:
trueif highlighting enabled,falseif not.
-
getHighlightFields
public String[] getHighlightFields(org.apache.lucene.search.Query query, SolrQueryRequest request, String[] defaultFields) Return a String array of the fields to be highlighted. Falls back to the programmatic 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 Queryrequest- The current SolrQueryRequestdefaultFields- Programmatic default highlight fields, used if nothing is specified in the handler config or the request.
-
emptyArray
-
expandWildcardsInFields
protected static String[] expandWildcardsInFields(Supplier<Collection<String>> availableFieldNamesSupplier, String... inFields) -
doHighlighting
public abstract org.apache.solr.common.util.NamedList<Object> doHighlighting(DocList docs, org.apache.lucene.search.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.- Parameters:
docs- query resultsquery- the queryreq- the current requestdefaultFields- default list of fields to summarize- Returns:
- NamedList containing a NamedList for each document, which in turns contains sets (field, summary) pairs.
- Throws:
IOException
-