Search flag to get a list of the words or phrases matched in a document.
The dtsSearchWantHitsByWord search flag tells the dtSearch Engine to generate a list of the words that were matched in each document found in a search. This is what the data returned looks like, after a search for apple pie and bana*:
The list shows each term from the search request that was found, and the number of hits. If the dtsSearchWantHitsArray flag is also set, the list includes the word offsets of the hits:
Fields. If the search includes a field criterion, the matching field is listed after the hit count and hits. For example, if the search was for subject contains apple pie, the hitsByWord report would look like this:
The field is listed only if it was part of the search request, so a search for apple pie would not include subject in the hitsByWord report, even if apple pie happened to be found in that field.
Phrases. The hitsByWord report treats each instance of a phrase as a single hit. This differs from the way hits are counted in search results, where a "hit" is always a single word. For example, so if "apple pie" occurs 7 times in a document, the document would have 14 hits reported in the search results list. When the dtsSearchWantHitsByWord flag is set, the search results list will include a phraseCount value for each document indicating the number of hits found, with each phrase counted as a single hit.
Ordinals. Set the flag dtsSearchWantHitsByWordOrdinals to add zero-based ordinals in front of each term, like this:
The ordinals will be consistent for all documents retrieved, regardless of which terms are retrieved in each document. For example, if a document only includes "bana*", it would still have ordinal  instead.
COM: SearchResults.DocDetails or SearchResults.DocDetailItem("_hitsByWord")