Close
dtSearch Engine API for Java
SearchResults.getHitByteOffsets Method
Syntax
Java
public native int getHitByteOffsets();

Generates a list of byte offsets of the hits in a file, for plain text files only

 

After a search, the dtSearch Engine provides a list of hits for each file retrieved. This list provides the word offset of each word in a file that matches the search request. 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 and, optionally, the word offset, the page number, and the paragraph number. The map is provided as an integer array.  

getHitByteOffsets() returns an array of byte offsets, one per hit.  

getHitBytePageParaOffsets() returns an array with four integers for each hit: the byte offset, page offset, paragraph offset, and word offset.