Re:
punbb version 1.3 final
The search engine is very well for English, but is not good for Chinese.
it only can get Result for English, no Result for Chinese!
i debug the code ,find that
include/search_functions.php
@108 'WHERE' statement
$query = array(
'SELECT' => 'm.post_id',
'FROM' => 'search_words AS w',
'JOINS' => array(
array(
'INNER JOIN' => 'search_matches AS m',
'ON' => 'm.word_id=w.id'
)
),
'WHERE' => 'w.word LIKE \''.$forum_db->escape(str_replace('*', '%', $cur_word)).'\''
);
$query value is like
SELECT m.post_id FROM search_words AS w INNER JOIN search_matches AS m ON m.word_id=w.id WHERE w.word LIKE '数据库'
my debug code is
echo 'search_functions.php@116@query=SELECT '.$query['SELECT'].' FROM '.$query['FROM'].' INNER JOIN '.'search_matches AS m'. ' ON '.'m.word_id=w.id'.' WHERE '.$query['WHERE'];
url is http://cilinux.cn/forum2/search.php?act C%E7%B4%A2
the keywords is '数据库', in English is 'database'
the final sql statement missing '%' around keywords.
maybe ths bug in all non English language.
the code
'WHERE' => 'w.word LIKE \''.$forum_db->escape(str_replace('*', '%', $cur_word)).'\''
modify to
'WHERE' => 'w.word LIKE \'%'.$forum_db->escape(str_replace('*', '%', $cur_word)).'%\''
then OK for keyword: '数据库'
but other keywords also have no Result.
most language is single byte/character, but Chinese is double byte/character(word) ,
in utf-8, most Chinese Word is 2 byte, other is 3byte or 4 byte.
this is a problem!
so on.
Last edited by vankon (2008-11-19 05:10:53)