Close
dtSearch Engine API for .NET Framework 2.x-4.x 2023.02
SearchResults::GetHitByteOffsets Method

Calculate byte offset of each hit (for plain text files only)

public String GetHitByteOffsets();

The easiest way to highlight hits in files retrieved with the dtSearch Engine is to use a FileConverter to convert the retrieved file to an HTML document with the hits highlighted. For plain text files, the dtSearch Engine provides an alternative method. Instead of highlighting the hits directly, the Engine can provide a map of the hits in each file. The map contains, for each hit, the byte offset in the file, the word offset, the page number, and the paragraph number. 

The map is expressed as a string consisting of a series of entries delimited with the ";" character. The entries are formatted as follows: 

 

wordOffset1 byteOffset1 page1 paragraph1; wordOffset2 byteOffset2 page2 paragraph2;

GetHitByteOffsets produces meaningful results only for plain text files. For other file types, including HTML or RTF, GetHitByteOffsets will not work.