Hello,
I am implementing a search engine to search several thousand text files that I have on a mysql database, each of which are about 20 pages long.
I followed this article:
http://www.phpfreaks.com/tutorials/129/0.php
and am now happily able to search my files with either a "normal" full text search, or the more complicated, but powerful "boolean" search.
When the query gets a match, currently the modified script is outputting the entire article. This is not so great, because the user becomes bewildered with all the text output, since each article is about 20 pages.
Ideally, it would be great to use php to parse the matched file, and only display the first line in the file which matches. I might then even highlight the match, in the outputted line, as well as a link to the full article. Great!
As I started thinking about it though, I realized that I would have to take the user's input, which might be complicated boolean operators, if a boolean search is used, and somehow mimic how mysql was able to get a match, when I'm parsing mysql's output, in order to display only the first matched line in the output.
I have quickly realized that my work is just starting, and am kind of bewildered at what kind of coding skill in php I am going to have to possess to accomplish this!
So, has anyone tried to do this already? I searched and searched on google to see if any kind soul might have published a code fragment that would do what I need to do, but I came up empty. Maybe someone here as done this, and can provide a pointer, or maybe even some code which could help me out.
Any comments welcome!
Thanks a lot,
Clapper