com.groupdocs.search.highlighters

Class HtmlHighlighter


  • Deprecated. 
    Please, use the DocumentHighlighter class instead.

    @Deprecated
    public class HtmlHighlighter
    extends Highlighter
    Represents a search result highlighter that highlights search results in an entire document text formatted in HTML.

    Learn more

    The example demonstrates a typical usage of the class.

     
     String indexFolder = "c:\\MyIndex\\";
     String documentsFolder = "c:\\MyDocuments\\";
     // Creating an index
     Index index = new Index(indexFolder);
     // Indexing documents from the specified folder
     index.add(documentsFolder);
     // Search for the phase 'Theory of Relativity'
     SearchResult result = index.search("\"Theory of Relativity\"");
     // Highlighting found words in the text of a document
     FoundDocument document = result.getFoundDocument(0);
     OutputAdapter outputAdapter = new FileOutputAdapter(OutputFormat.Html, "Highlighted.html");
     Highlighter highlighter = new HtmlHighlighter(outputAdapter);
     index.highlight(document, highlighter);
     
     
    • Constructor Detail

      • HtmlHighlighter

        public HtmlHighlighter(OutputAdapter outputAdapter)
        Deprecated. 

        Initializes a new instance of the HtmlHighlighter class.

        Parameters:
        outputAdapter - The output adapter transferring a result of the highlighting.
    • Method Detail

      • getOutputAdapter

        public final OutputAdapter getOutputAdapter()
        Deprecated. 

        Gets the output adapter passed in the constructor.

        Returns:
        The output adapter passed in the constructor.