Skip to content

Commit 859915a

Browse files
Issue s9y#844 Bring back if statement to switch over boolean mode or not + change regex to only catch BOOLEAN Operator that prefix a word
1 parent f625eaf commit 859915a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/functions_entries.inc.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -882,8 +882,11 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') {
882882
$cond['distinct'] = '';
883883
$term = str_replace('"', '"', $term);
884884
$relevance_enabled = true;
885-
$term = serendipity_db_escape_string($term);
886-
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('\"$term\"' IN BOOLEAN MODE)";
885+
if (preg_match('@([\+\-\*~<>\(\)"])\s*(\b\w+\b)@', $term)) {
886+
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('$term' IN BOOLEAN MODE)";
887+
} else {
888+
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('$term')";
889+
}
887890
}
888891

889892
switch($serendipity['searchsort']) {

0 commit comments

Comments
 (0)