1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Fixed single word quoted search terms

Fixes #170
This commit is contained in:
Dan Brown
2016-08-25 17:17:26 +01:00
parent f2ceba978a
commit f83de5f834
3 changed files with 17 additions and 7 deletions

View File

@ -167,7 +167,8 @@ class Entity extends Ownable
foreach ($terms as $key => $term) {
$term = htmlentities($term, ENT_QUOTES);
$term = preg_replace('/[+\-><\(\)~*\"@]+/', ' ', $term);
if (preg_match('/\s/', $term)) {
if (preg_match('/&quot;.*?&quot;/', $term)) {
$term = str_replace('&quot;', '', $term);
$exactTerms[] = '%' . $term . '%';
$term = '"' . $term . '"';
} else {
@ -206,5 +207,5 @@ class Entity extends Ownable
return $search->orderBy($orderBy, 'desc');
}
}