The following example demonstrates how to highlight search results in the text of an entire document.
The full document URL in a browser might look like this: To navigate the occurrences, the following text is added to the URL in a browser: If after generation the text of a document was saved to a file, this file can be opened by an Internet browser to navigate the occurrences of the words found. Details on the output adapters are presented on the page Output adapters. To highlight search results in the text of the whole document, a highlighter of the HtmlHighlighter class is used. To create a highlighter of this type, you must pass an object of a class derived from the abstract class OutputAdapter to its constructor. The other options are used for highlighting occurrences in text fragments. setHighlightColor method sets a color used to highlight occurrences.setUseInlineStyles method sets a flag to specify whether inline styles or CSS class are used to highlight occurrences.getMetadataIndexingOptions method returns an object for specifying metadata indexing options.setGenerateHead method sets a flag to specify whether the Head tag is generated in the output HTML.setCancellation method sets an object used to cancel the operation.setAdditionalFields method sets additional document fields added during document indexing which are also necessary if the document text was not saved in the index.setCustomExtractor method sets an extractor used during indexing, it is necessary if the text of the document was not saved in the index.The HighlightOptions class contains properties for setting the following options: The Index class also represents an overload of the highlight method, which takes an object of the HighlightOptions class as an argument. To do this, a highlighter of the corresponding type must be passed as an argument to the method. Hit highlighting in the text of entire documentĪfter performing a search, occurrences of found words and phrases for a particular document can be highlighted in the text of the document using the highlight method of the Index class. This page describes how to highlight search results in the text of a document.