serendipity0.6p11 not support multi-byte language's search,such as Chinese search.
i changed function serendipity_searchEntries in serendipity_functions.inc.php to fix it.
--------------------------------------------
function serendipity_searchEntries($term) {
global $serendipity;
$querystring = "SELECT
e.id,
e.author,
a.username,
a.email,
e.categoryid,
c.category_name,
e.timestamp,
e.comments,
e.title,
e.body,
e.extended,
e.trackbacks,
e.exflag
FROM
{$serendipity['dbPrefix']}entries e
LEFT JOIN {$serendipity['dbPrefix']}category c
ON e.categoryid = c.categoryid,
{$serendipity['dbPrefix']}authors a
WHERE
a.authorid = e.authorid
AND ((e.title LIKE ('%" . addslashes($term) . "%')) or (e.body LIKE ('%" . addslashes($term) . "%')) or (e.extended LIKE ('%" . addslashes($term) . "%')))
AND isdraft = 'false'
ORDER BY
timestamp DESC";
return serendipity_db_query($querystring);
}
------------------------------
i used
AND ((e.title LIKE ('%" . addslashes($term) . "%')) or (e.body LIKE ('%" . addslashes($term) . "%')) or (e.extended LIKE ('%" . addslashes($term) . "%')))
instead old
AND MATCH (title,body,extended) AGAINST ('".addslashes($term)."')
fix for multi-byte language search
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hm, the way you used multiple LIKE conditions is a lot slower than our MATCH method. Basically that's what MATCH was developed for, so it should be multibyte-compatible. If not, I'd consider this a serious MySQL bug.
Did you run a recent version of MySQL?
Did you run a recent version of MySQL?
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
version of MySQL is 4.0.18.
not MYSQL bug, serendipity's bug.
one solution is LIKE,but it is a lot slower ;
other solution use MATCH,maybe here:
http://www.evolt.org/article/Boolean_Fu ... index.html
not MYSQL bug, serendipity's bug.
one solution is LIKE,but it is a lot slower ;
other solution use MATCH,maybe here:
http://www.evolt.org/article/Boolean_Fu ... index.html
-
cody
I'm a chinese user, and found this problem too.
This is neither mySQL's bug, nor serendipity's bug. The reason is that the fulltext search of MySQL is based on words which are seperated by spaces. However, in chinese, there are no spaces between words. So you cannot get anything by full text search.
If you don't believe this, you can try to seperate your chinese words by spaces in your article, then try searching. You will get the disirable answer.
This problem is really difficult to solve because you have to use intelligent word dividing techniques to achieve good fulltext search.
This is neither mySQL's bug, nor serendipity's bug. The reason is that the fulltext search of MySQL is based on words which are seperated by spaces. However, in chinese, there are no spaces between words. So you cannot get anything by full text search.
If you don't believe this, you can try to seperate your chinese words by spaces in your article, then try searching. You will get the disirable answer.
This problem is really difficult to solve because you have to use intelligent word dividing techniques to achieve good fulltext search.