]> git.mjollnir.org Git - s9y.git/commitdiff
Support MySQL Boolean search mode
authorgarvinhicking <garvinhicking>
Tue, 14 Jun 2005 09:45:17 +0000 (09:45 +0000)
committergarvinhicking <garvinhicking>
Tue, 14 Jun 2005 09:45:17 +0000 (09:45 +0000)
docs/NEWS
include/functions_entries.inc.php

index c5e845052de9b2a3efc0f87555cee81f8f8e31d8..2476768720df21feb496132e450957415cb9be67 100644 (file)
--- 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 
index 7736e86cfd8eff5d8bc796117f3f77c8a64905e2..ce98731a66245fa7f644d788ef456e85c5727ab4 100644 (file)
@@ -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('&quot;', '"', $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();