Remove at sign (@) from fulltext query string #77

Merged
MrPetovan merged 1 commit from bug/76-remove-at-sign-fulltext-search into stable 2021-06-22 16:05:21 +02:00
3 changed files with 6 additions and 0 deletions
Showing only changes of commit 4d7067b381 - Show all commits

View file

@ -48,6 +48,8 @@ class MatchSearch
$pager->setPage(filter_input(INPUT_POST, 'p', FILTER_SANITIZE_NUMBER_INT)); $pager->setPage(filter_input(INPUT_POST, 'p', FILTER_SANITIZE_NUMBER_INT));
$sql_where = "MATCH (p.`tags`) AGAINST (:query)"; $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]; $values = ['query' => $query];

View file

@ -51,6 +51,8 @@ class Search
} else { } else {
$sql_where = "MATCH (p.`name`, p.`pdesc`, p.`username`, p.`locality`, p.`region`, p.`country`, p.`tags` ) $sql_where = "MATCH (p.`name`, p.`pdesc`, p.`username`, p.`locality`, p.`region`, p.`country`, p.`tags` )
AGAINST (:query IN BOOLEAN MODE)"; 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]; $values = ['query' => $query];

View file

@ -73,6 +73,8 @@ class Search extends BaseController
} else { } else {
$sql_where = "MATCH (p.`name`, p.`pdesc`, p.`username`, p.`locality`, p.`region`, p.`country`, p.`tags` ) $sql_where = "MATCH (p.`name`, p.`pdesc`, p.`username`, p.`locality`, p.`region`, p.`country`, p.`tags` )
AGAINST (:query IN BOOLEAN MODE)"; 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]; $values = ['query' => $query];