dtSearch Engine API Reference 2023.02
Highlighting hits in HTML files

How to display retrieved HTML documents with hits highlighted.

When an HTML file is retrieved in a search, dtSearch can highlight hits in the HTML file by inserting hit highlight markings around hits in the HTML without any conversion. As a result, all aspects of the original HTML file's formatting and structure are preserved. 

The encoding of the HTML file is changed to UTF-8, and any Content-Type META tag in the original is replaced by a UTF-8 Content-Type META tag. 

The following ConvertFlags can be used to control highlighting of HTML files:

JavaScript in HTML files can cause errors if displayed outside of the expected context of the script. The dtsConvertRemoveScripts flag tells the dtSearch Engine to remove JavaScript from HTML files when adding hit highlight markings.
If a hit cannot be displayed in HTML because the text is not visible, this flag tells the dtSearch Engine not to insert any tags for the hit. If this flag is not set, a pair of beforeHit/afterHit tags will be added before the next visible text in the file.