This commit is contained in:
2026-01-02 01:50:54 +01:00
parent 262f62a179
commit 4f056c68b7

View File

@@ -26,13 +26,13 @@ final class Search
foreach ($tokens as $tok) { foreach ($tokens as $tok) {
$tok = trim($tok); $tok = trim($tok);
if ($tok === '') continue; if ($tok === '') continue;
$conditions[] = "(title LIKE ? OR teaser_public LIKE ? OR description LIKE ? OR city LIKE ? OR region LIKE ? OR zip LIKE ?)"; $conditions[] = "(title LIKE CONCAT('%', ?, '%') OR teaser_public LIKE CONCAT('%', ?, '%') OR description LIKE CONCAT('%', ?, '%') OR city LIKE CONCAT('%', ?, '%') OR region LIKE CONCAT('%', ?, '%') OR zip LIKE CONCAT('%', ?, '%'))";
$bind[] = '%' . $tok . '%'; $bind[] = $tok;
$bind[] = '%' . $tok . '%'; $bind[] = $tok;
$bind[] = '%' . $tok . '%'; $bind[] = $tok;
$bind[] = '%' . $tok . '%'; $bind[] = $tok;
$bind[] = '%' . $tok . '%'; $bind[] = $tok;
$bind[] = '%' . $tok . '%'; $bind[] = $tok;
$i++; $i++;
} }
@@ -77,9 +77,8 @@ final class Search
$sql .= " LIMIT {$limit}"; $sql .= " LIMIT {$limit}";
$stmt = $this->pdo->prepare($sql); $stmt = $this->pdo->prepare($sql);
try { try {
$stmt->execute(); $stmt->execute($bind);
return $stmt->fetchAll(\PDO::FETCH_ASSOC) ?: []; return $stmt->fetchAll(\PDO::FETCH_ASSOC) ?: [];
} catch (\PDOException $e) { } catch (\PDOException $e) {
// Log into /debug/search_debug.log and continue with empty results // Log into /debug/search_debug.log and continue with empty results