"
. sprintf(gettext ("Searching for \"%s\" ....."),
htmlspecialchars($full))
. "\n\n";
// search matching pages
$query = InitFullSearch($dbi, $full);
// quote regexp chars (space are treated as "or" operator)
$full = preg_replace("/\s+/", "|", preg_quote($full));
$found = 0;
$count = 0;
while ($pagehash = FullSearchNextMatch($dbi, $query)) {
$html .= "- " . LinkExistingWikiWord($pagehash["pagename"]) . "\n";
$count++;
// print out all matching lines, highlighting the match
for ($j = 0; $j < (count($pagehash["content"])); $j++) {
if ($hits = preg_match_all("/$full/i", $pagehash["content"][$j], $dummy)) {
$matched = preg_replace("/$full/i",
"${FieldSeparator}OT\\0${FieldSeparator}CT",
$pagehash["content"][$j]);
$matched = htmlspecialchars($matched);
$matched = str_replace("${FieldSeparator}OT", '', $matched);
$matched = str_replace("${FieldSeparator}CT", '', $matched);
$html .= "
- $matched
\n";
$found += $hits;
}
}
}
$html .= "
\n
"
. sprintf (gettext ("%d matches found in %d pages."),
$found, $count)
. "\n";
GeneratePage('MESSAGE', $html, gettext ("Full Text Search Results"), 0);
?>