查看單個文章
舊 2005-06-21, 03:04 PM   #4 (permalink)
貝斯特 帥哥
長老會員
 
貝斯特 的頭像
榮譽勳章
UID - 90669
在線等級: 級別:1 | 在線時長:11小時 | 升級還需:1小時
註冊日期: 2003-08-06
住址: The Gates of Hell
文章: 1758
現金: 15064 金幣
資產: 5185909 金幣
預設

| 後面加上
---------------------------------------------------------------------------------------
// #############################################################################
// get highlight words (part3);
if (!$vboptions['searchposttable'] && count($display['highlight']) % 2 == 0)
{
if (!preg_match("/^[[:alpha:]]+$/", end($display['highlight']))) {
$display['highlight']['temp'] = substr(end($display['highlight']), -2);
}
}

---------------------------------------------------------------------------------------
| 搜尋
---------------------------------------------------------------------------------------

// check that word exists in the title
if ($titleonly)

| 取代為
---------------------------------------------------------------------------------------
// check that word exists in the title
if ($titleonly && !$vboptions['searchposttable'])

儲存檔案!



開啟includes/functions_databuild.php
---------------------------------------------------------------------------------------
| 搜尋
---------------------------------------------------------------------------------------
// ###################### Start indexpost #######################
function build_post_index($postid, $foruminfo, $firstpost = -1, $post = false)
{
global $vboptions;

if ($vboptions['fulltextsearch'])
{
return;
}

| 取代為
---------------------------------------------------------------------------------------
// ###################### Start indexpost #######################
function build_post_index($postid, $foruminfo, $firstpost = -1, $post = false)
{
global $vboptions;

if ($vboptions['fulltextsearch'] || $vboptions['searchposttable'])
{
return;
}


---------------------------------------------------------------------------------------
| 搜尋
---------------------------------------------------------------------------------------
$words = fetch_postindex_text($threadinfo['title']);
$allwords .= $words;
$wordarray = explode(' ', $words);


| 取代為
---------------------------------------------------------------------------------------
$words = fetch_postindex_text($threadinfo['title']);
// 007pig
$wordarray = sp_str($words);
$allwords .= implode(" ", $wordarray);
---------------------------------------------------------------------------------------
| 搜尋
---------------------------------------------------------------------------------------
$words = fetch_postindex_text($post['title']);
$allwords .= ' ' . $words;
$wordarray = explode(' ', $words);


| 取代為
---------------------------------------------------------------------------------------
$words = fetch_postindex_text($post['title']);
// 007pig
$wordarray = sp_str($words);
$allwords .= implode(" ", $wordarray);

---------------------------------------------------------------------------------------
| 搜尋
---------------------------------------------------------------------------------------
$words = fetch_postindex_text($post['pagetext']);
$allwords .= ' ' . $words;
$wordarray = explode(' ', $words);


| 取代為
---------------------------------------------------------------------------------------
$words = fetch_postindex_text($post['pagetext']);
// 007pig
$wordarray = sp_str($words);
$allwords .= implode(" ", $wordarray);

---------------------------------------------------------------------------------------
| 搜尋
---------------------------------------------------------------------------------------
$text = strip_tags($text); // clean out HTML as it's probably not going to be indexed well anyway


| 取代為
---------------------------------------------------------------------------------------
//$text = strip_tags($text); // clean out HTML as it's probably not going to be indexed well anyway

---------------------------------------------------------------------------------------
| 搜尋
---------------------------------------------------------------------------------------
// ###################### Start unindexpost #######################
function delete_post_index($postid, $title = '', $pagetext = '')
{
global $DB_site, $vboptions;

if ($vboptions['fulltextsearch'])
{
return;
}


| 取代為
---------------------------------------------------------------------------------------
// ###################### Start unindexpost #######################
function delete_post_index($postid, $title = '', $pagetext = '')
{
global $DB_site, $vboptions;

if ($vboptions['fulltextsearch'] || $vboptions['searchposttable'])
{
return;
}

儲存檔案!

開啟includes/functions.php
---------------------------------------------------------------------------------------
| 在檔案末端
---------------------------------------------------------------------------------------
/*======================================================================*\
|| ####################################################################
|| # *
|| # CVS: $RCSfile: functions.php,v $ - $Revision: 1.944 $
|| ####################################################################
\*======================================================================*/
?>

之前


| 增加
---------------------------------------------------------------------------------------
// ###################### 中文二元語法(bigram)切分詞 #######################
// 007pig
function sp_str($str)
{
// 如果只是單字,則直接返回
if (strlen($str) <= 3) {
$ahz[] = $str;
return $ahz;
}

$ahz = array();
$search = array(",", "/", "\\", ".", ";", ":", "\"", "!", "~", "`", "^", "(", ")", "?", "-", "\t", "\n", "'", "<", ">", "\r", "\r\n", "$", "&", "%", "#", "@", "+", "=", "{", "}", "[", "]", ":", ")", "(", ".", "。", ",", "!", ";", "「", "」", "『", "』", "〔", "〕", "、", "—", " ", "《", "》", "-", "…", "【", "】",);
$str = str_replace($search," ",$str);
$strarr = explode(" ", $str);

foreach ($strarr as $str)
{
if (preg_match("/^[[:alpha:]]+$/", $str)) {
array_push($ahz, $str);
} else {
$n = strlen($str);
$m = 0;
$j = 0;
$en = '';
for($i=0;$i<$n;$i++)
{
if(ord($str[$i]) > 128)
{
$hz[$m] = $str[$i].$str[$i+1];
if($m > 0)
{
array_push($ahz, $hz[$m-1].$hz[$m]);
$j++;
}
$m++;
$i++;
if (!empty($en)) {
array_push($ahz, $en);
$en='';
}
}
else
{
$en .= $str[$i];
}

}

$a_e = preg_split("/[\s,]+/",$en);
$n_e = count($a_e);
for($u = 0;$u < $n_e;$u++)
{
if(strlen($a_e[$u]) < 4 || strlen($a_e[$u]) > 50)
continue;
array_push($ahz, strtolower($a_e[$u]));
$n_a++;
}
$en='';
}
}

return $ahz;
}
儲存檔案!
開啟includes/functions_showthread.php
---------------------------------------------------------------------------------------
| 搜尋
---------------------------------------------------------------------------------------
// ###################### Start process_highlight_postbit #######################
function process_highlight_postbit($text, $words, $prepend)
{
$text = str_replace('\"', '"', $text);
foreach ($words AS $replaceword)
{
$text = preg_replace('#(?<=[\s"\]>()]|^)(' . $replaceword . ')(([.,:;-?!()\s"<\[]|$))#siU', '<span class="highlight">\\1</span>\\2', $text);
//$text = preg_replace('#(?<=[^\w=])(' . $replaceword . ')(?=[^\w=])#siU', '<span class="highlight">\\1</span>', $text);
}

return "$prepend$text";
}
__________________

給自己看也給所有需要這些話鼓勵的人看!

認真不一定會得到美好的結果,但是不認真就一定沒有

想要有什麼結果,就秉持你的雙手
放手去做
總比什麼都沒付出最後失敗了才嘆氣來的好吧
沒努力的人.沒有資格說放棄
努力過的人.更要有勇氣繼續努力下去
貝斯特 目前離線  
送花文章: 1, 收花文章: 38 篇, 收花: 123 次
回覆時引用此帖