Hello,
I am rolling my own site search engine so I can customize it for my needs.
The indexer and searcher are working just fine, but I'd like to produce more dynamic descriptions based on the given keyword.
It would be sort of like Google. For example:
If the keyword is "bob", and the file contains:
blah blah, and today, bob walked down the street to the market to get some bread.
I need to find the first occurrence of “bob” and then backtrack a few characters, to ultimately produce something like this:
...today, bob walked down the street...
If I could just find out the byte of the first letter in bob, I would be able to do this. (I guess it would be called a byte if you go by the rule every character is equal to one byte). In this case, the letter "b" in "bob" would be 22 (starting at 0).
I would then subtract something like 8 and begin reading the file out at byte 16 until I get to 22 + 30.
Thanks for your help!
-Aaron