Merge pull request #77 from MrPetovan/bug/76-remove-at-sign-fulltext-search

Remove at sign (@) from fulltext query string
This commit is contained in:
Michael Vogel 2021-06-22 16:05:21 +02:00 committed by GitHub
commit 750e369f57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View file

@ -48,6 +48,8 @@ class MatchSearch
$pager->setPage(filter_input(INPUT_POST, 'p', FILTER_SANITIZE_NUMBER_INT));
$sql_where = "MATCH (p.`tags`) AGAINST (:query)";
// At sign (@) is a reserved symbol in InnoDB full-text search, it can't be escaped
$query = str_replace('@', ' ', $query);
$values = ['query' => $query];

View file

@ -51,6 +51,8 @@ class Search
} else {
$sql_where = "MATCH (p.`name`, p.`pdesc`, p.`username`, p.`locality`, p.`region`, p.`country`, p.`tags` )
AGAINST (:query IN BOOLEAN MODE)";
// At sign (@) is a reserved symbol in InnoDB full-text search, it can't be escaped
$query = str_replace('@', ' ', $query);
}
$values = ['query' => $query];

View file

@ -73,6 +73,8 @@ class Search extends BaseController
} else {
$sql_where = "MATCH (p.`name`, p.`pdesc`, p.`username`, p.`locality`, p.`region`, p.`country`, p.`tags` )
AGAINST (:query IN BOOLEAN MODE)";
// At sign (@) is a reserved symbol in InnoDB full-text search, it can't be escaped
$query = str_replace('@', ' ', $query);
}
$values = ['query' => $query];