View Full Version : Version 1.6.3 Highlight Bug & Fix

11-16-2003, 08:35 AM
Hi. The version 1.6.3 highlight fix to fix the version 1.6.2 highlight problem with exact words has a bug.

The bug is that with version 1.6.3, if you search on say 'php' using words begin or any words part, you will see something like 'blah blah phpdigHighlight">php' in the search results.

To fix this in version 1.6.3 do the following.

In robot_functions.php find:

//replace any group of blank characters by an unique space
$text = ereg_replace("[[:blank:]]+"," ",eregi_replace("<[^>]*>","",$text));

and right after add:

//strip characters used in highlighting
$text = str_replace("^#_","",str_replace("_#^","",$text));

In phpdig_functions.php replace the phpdigHighlight function with the following:

function phpdigHighlight($ereg='',$string='')
if ($ereg) {
// return @eregi_replace($ereg,"\\\\1<span class=\"phpdigHighlight\">\\\\2</span>\\\\3",$string);
$string = @eregi_replace($ereg,"\\\\1<^#_>\\\\2</_#^>\\\\3",@eregi_replace($ereg,"\\\\1<^#_>\\\\2</_#^>\\\\3",$string));
$string = str_replace("^#_","span class=\"phpdigHighlight\"",str_replace("_#^","span",$string));
return $string;
else {
return $result;

In search_function.php there are four places where the following occurs:


In these four places, remove the following from each line:

// the first instance of phpdigHighlight($reg_strings,
// and also one ending ) to match parentheses

Remember to remove any "word" wrapping in the above code.

EDIT: PhpDig version 1.6.4 includes this fix. See the Changelog (http://www.phpdig.net/info/changelog.txt) for more details.

11-17-2003, 12:05 AM
so is this the cure for the 2 word highlight thing in exact words or something else?

11-17-2003, 12:16 AM
Hi. This is the fix to the fix for the word highlighting in exact word searches. I'd recommend just installing version 1.6.4. ;)