Skip to content

Commit

Permalink
s9y#844 add another regex to avoid boolean operator alone that could …
Browse files Browse the repository at this point in the history
…lead to error
  • Loading branch information
GuillaumeValadas committed Jul 23, 2024
1 parent b8881a7 commit f5960fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/functions_entries.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') {
$cond['distinct'] = '';
$term = str_replace('"', '"', $term);
$relevance_enabled = true;
if (preg_match('@[\+\-\*~<>\(\)"].[\S]*@', $term)) {
if (preg_match('@[\+\-\*~<>\(\)"].[\S]*@', $term) && preg_match('@\s*[\+\-\*~<>\(\)]\s*$@', $term) === 0 ) {
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('$term' IN BOOLEAN MODE)";
} else {
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('$term')";
Expand Down

0 comments on commit f5960fc

Please sign in to comment.