org.apache.solr.highlight

Class SolrHighlighter

    • Method Detail

      • isHighlightingEnabled

        public boolean isHighlightingEnabled(SolrParams params)
        Check whether Highlighting is enabled for this request.
        Parameters:
        params - The params controlling Highlighting
        Returns:
        true if highlighting enabled, false if not.
      • getHighlightFields

        public String[] getHighlightFields(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 Query
        request - The current SolrQueryRequest
        defaultFields - Programmatic default highlight fields, used if nothing is specified in the handler config or the request.
      • doHighlighting

        public abstract NamedList<ObjectdoHighlighting(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.
        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