I could be wrong here but I think the search results are
"ranked" only by the topic title. The number of hits is irrelevant.
If you have Topic A and Topic C both of which contain the search
string, Topic A will always we shown first in the list as it's
topic title is alphabetically before topic C. Note I said topic
title not the file name.
As far as mimicing Zoomsearch, I'm not aware of anything and
as a CHM file is a compiled file and therefore contains everything
needed to use it I'd say it would be impossible to mimic but what
do I know.
Perhaps someone with more experience of CHM file
makeup can confirm this. If I am right, one way around this may be
to use one of the many pieces of software that can search a CHM
file's contents but it would mean having to implement two
things.