Class HtmlHighlighter

  • Deprecated. 
    Please, use the DocumentHighlighter class instead.

    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
     // Search for the phase 'Theory of Relativity'
     SearchResult result ="\"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)

        Initializes a new instance of the HtmlHighlighter class.

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

      • getOutputAdapter

        public final OutputAdapter getOutputAdapter()

        Gets the output adapter passed in the constructor.

        The output adapter passed in the constructor.