| 搜尋
---------------------------------------------------------------------------------------
// found some results for current word
$wordids = array();
while ($getword = $DB_site->fetch_array($getwords))
{
$wordids[] = $getword['wordid'];
}
// query post ids for current word...
// if $titleonly is specified, also get the value of postindex.intitle
$postmatches = $DB_site->query("
SELECT postid" . iif($titleonly, ', intitle') . iif($sortby == 'rank', ", score AS origscore,
CASE intitle
WHEN 1 THEN score + $vboptions[posttitlescore]
WHEN 2 THEN score + $vboptions[posttitlescore] + $vboptions[threadtitlescore]
ELSE score
END AS score") . "
FROM " . TABLE_PREFIX . "postindex
WHERE wordid IN(" . implode(',', $wordids) . ")
");
| 取代為
---------------------------------------------------------------------------------------
// query post ids for current word...
// if $titleonly is specified, also get the value of postindex.intitle
if (!$vboptions['searchposttable']) {
// found some results for current word
$wordids = array();
while ($getword = $DB_site->fetch_array($getwords))
{
$wordids[] = $getword['wordid'];
}
$postmatches = $DB_site->query("
SELECT postid" . iif($titleonly, ', intitle') . iif($sortby == 'rank', ", score AS origscore,
CASE intitle
WHEN 1 THEN score + $vboptions[posttitlescore]
WHEN 2 THEN score + $vboptions[posttitlescore] + $vboptions[threadtitlescore]
ELSE score
END AS score") . "
FROM " . TABLE_PREFIX . "postindex
WHERE wordid IN(" . implode(',', $wordids) . ")
");
} else {
$postmatches = $DB_site->query("
SELECT postid
FROM " . TABLE_PREFIX . "post
WHERE title LIKE '%$word%'" . iif($titleonly == 0, " OR pagetext LIKE '%$word%'")
);
}
---------------------------------------------------------------------------------------
| 搜尋
---------------------------------------------------------------------------------------
// #############################################################################
// get highlight words (part 2);
foreach ($display['highlight'] AS $key => $word)
{
if (!isset($queryWords["$word"]))
{
unset($display['highlight']["$key"]);
}
}
|