public class DocumentHighlighter extends Highlighter implements IDocumentHighlighter
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 DocumentHighlighter(outputAdapter);
index.highlight(document, highlighter);
core| Constructor and Description |
|---|
DocumentHighlighter(OutputAdapter outputAdapter)
Initializes a new instance of the
DocumentHighlighter class. |
| Modifier and Type | Method and Description |
|---|---|
OutputAdapter |
getOutputAdapter()
Gets the output adapter passed in the constructor.
|
getCore, getOutputFormatclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetOutputFormatpublic DocumentHighlighter(OutputAdapter outputAdapter)
DocumentHighlighter class.outputAdapter - The output adapter transferring a result of the highlighting.public final OutputAdapter getOutputAdapter()
getOutputAdapter in interface IDocumentHighlighterCopyright © 2026. All rights reserved.