From 641bcd051a0d31a7c03c826f7f90eaa536c6577b Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Tue, 14 Jun 2005 09:45:17 +0000 Subject: [PATCH] Support MySQL Boolean search mode --- docs/NEWS | 5 +++++ include/functions_entries.inc.php | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) 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(); -- 2.39.5