dtSearch Text Retrieval Engine Programmer's Reference

Search flag to get details on how search terms were matched in a document.

The dtsSearchWantHitDetails search flag tells the dtSearch Engine to generate additional information during a search that matches each term to the words retrieved, for each document. This is what the data returned looks like, after a search for "comment~ or writ*".

term="comment~" word="commenters" count="1" hits="1063 " term="comment~" word="comment" count="4" hits="1055 1706 1870 1890 " term="writ*" word="written" count="3" hits="147 1122 2538 " term="comment~" word="comments" count="7" hits="50 127 148 178 1274 1885 1911 "


The original search term, as modified by any search features (fuzziness, phonic, etc.) 


The word matched in the index 


Number of hits for this word 


Word offsets of each hit for this word 


The name of the field where this word was found. Example:

term="edward" field="play/act/scene/speech/line" word="edward" count="4" hits="1216 1650 1698 1710 " term="edward" field="play/act/scene/stagedir" word="edward" count="1" hits="24 "

For ease of parsing, all values in the table will be expressed as something="value" -- no space around the =, the quote always present. There may be additional items added in the future, and the order may change, so calling applications should look for "word=", "term=", etc. 

Phrases are not grouped in the hit details report, so the report from a search for apple pie will contain separate items for apple and pie. To get hits listed with phrases grouped (so a single instance of a phrase is a single hit), use the dtsSearchWantHitsByWord flag. 

In an unindexed search, only the search terms will be listed, without separate entries for each of the words actually matched in the file.

Accessing HitDetails after a search

C++: dtsSearchResultsItem.hitDetails 

.NET: SearchResultsItem.HitDetails 

Java: SearchResults.getDocDetailItem("_hitDetails") 

COM: SearchResults.DocDetails or SearchResults.DocDetailItem("_hitDetails")