第 1 頁 (共 1 頁)
[問題] 請問如何限制搜尋時輸入的關鍵字
發表於 : 2004-02-05 15:17
由 men_lok
phpBB 2.0.6
怕資料庫及電腦負荷過大\r
如何限制所有會員 (包括 Admin) 於搜尋文章時只可最多使用 2 個關鍵字 (即不可一直加入 AND , OR, NOT 這些導致資料庳繁忙,最多加一個,例如 123 AND 456)
謝謝指點 ^___^
發表於 : 2004-02-05 15:56
由 動感超人
http://phpbb-tw.net/phpbb/viewtopic.php?t=18300
如果只要限制關鍵字個數,改下面這段就好了。
代碼: 選擇全部
#-----[ OPEN ]------------------------------------------
#
search.php
#-----[ FIND ]------------------------------------------
#
$word_match = array();
$result_list = array();
for($i = 0; $i < count($split_search); $i++)
{
switch ( $split_search[$i] )
{
case 'and':
$current_match_type = 'and';
break;
#
#-----[ REPLACE ]---------------------------------------
#
$word_match = array();
$result_list = array();
if ( count($split_search) > [color=red]2[/color] )
{
message_die(GENERAL_MESSAGE, $lang['No_search_match']);
}
for($i = 0; $i < count($split_search); $i++)
{
switch ( $split_search[$i] )
{
case 'and':
$current_match_type = 'and';
break;
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
發表於 : 2004-02-05 17:47
由 men_lok
謝謝^^
發表於 : 2004-02-05 17:54
由 men_lok
請問安裝好後使用多於一個 AND 是否顯示為 "沒有相關主題或文章符合您要搜尋的條件"??
謝^^
發表於 : 2004-02-05 23:21
由 動感超人
是的。
自訂錯誤訊息:
代碼: 選擇全部
if ( count($split_search) > 2 )
{
message_die(GENERAL_MESSAGE, $lang['No_search_match']);
}
改成:
代碼: 選擇全部
if ( count($split_search) > 2 )
{
message_die(GENERAL_MESSAGE, '[color=red]您使用的搜尋條件太多[/color]');
}
就可以了。
發表於 : 2004-02-05 23:43
由 men_lok
謝謝動感超人 ^^