From: garvinhicking Date: Tue, 14 Jun 2005 09:45:17 +0000 (+0000) Subject: Support MySQL Boolean search mode X-Git-Tag: 0.9~398 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=641bcd051a0d31a7c03c826f7f90eaa536c6577b;p=s9y.git Support MySQL Boolean search mode --- diff --git a/docs/NEWS b/docs/NEWS index c5e8450..2476768 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,11 @@ Version 0.9 () ------------------------------------------------------------------------ + * Support use of Boolean search mode in MySQL. Is activated when using + special characters like "()~*+-<>. Syntax see + http://dev.mysql.com/doc/mysql/en/fulltext-boolean.html. + (garvinhicking) + * Apply patch to allow usage of Feedburner RSS feeds, by Anders Clerwall * Fixed using "_" instead of "-" in the approve trackback/comments diff --git a/include/functions_entries.inc.php b/include/functions_entries.inc.php index 7736e86..ce98731 100644 --- a/include/functions_entries.inc.php +++ b/include/functions_entries.inc.php @@ -470,7 +470,12 @@ function serendipity_searchEntries($term, $limit = '') { } else { $group = 'GROUP BY e.id'; $distinct = ''; - $find_part = "MATCH(title,body,extended) AGAINST('$term')"; + $term = str_replace('"', '"', $term); + if (preg_match('@["\+\-\*~<>\(\)]+@', $term)) { + $find_part = "MATCH(title,body,extended) AGAINST('$term' IN BOOLEAN MODE)"; + } else { + $find_part = "MATCH(title,body,extended) AGAINST('$term')"; + } } $cond = array();