asdasd
This commit is contained in:
@@ -23,9 +23,21 @@ final class Search
|
|||||||
$params = [];
|
$params = [];
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($tokens as $tok) {
|
foreach ($tokens as $tok) {
|
||||||
$ph = ':kw' . $i++;
|
$tok = trim($tok);
|
||||||
$conditions[] = "(title LIKE $ph OR teaser_public LIKE $ph OR description LIKE $ph OR city LIKE $ph OR region LIKE $ph OR zip LIKE $ph)";
|
if ($tok === '') continue;
|
||||||
$params[$ph] = '%' . $tok . '%';
|
$ph = [
|
||||||
|
':t' . $i . 'a',
|
||||||
|
':t' . $i . 'b',
|
||||||
|
':t' . $i . 'c',
|
||||||
|
':t' . $i . 'd',
|
||||||
|
':t' . $i . 'e',
|
||||||
|
':t' . $i . 'f',
|
||||||
|
];
|
||||||
|
$conditions[] = "(title LIKE {$ph[0]} OR teaser_public LIKE {$ph[1]} OR description LIKE {$ph[2]} OR city LIKE {$ph[3]} OR region LIKE {$ph[4]} OR zip LIKE {$ph[5]})";
|
||||||
|
foreach ($ph as $p) {
|
||||||
|
$params[$p] = '%' . $tok . '%';
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
$where = $conditions ? ('AND ' . implode(' AND ', $conditions)) : '';
|
$where = $conditions ? ('AND ' . implode(' AND ', $conditions)) : '';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user