![]() |
|
|||||||
| 論壇說明 |
|
歡迎您來到『史萊姆論壇』 ^___^ 您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的! 請點擊這裡:『註冊成為我們的一份子!』 |
|
|
主題工具 | 顯示模式 |
|
|
#4 (permalink) |
|
長老會員
![]() |
| 後面加上
--------------------------------------------------------------------------------------- // ############################################################################# // 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,
|