Remove at sign (@) from fulltext query string
- InnoDB uses it as a special character and it can't be escaped
This commit is contained in:
parent
7112c65166
commit
4d7067b381
3 changed files with 6 additions and 0 deletions
|
@ -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];
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue