|
|
|
@ -45,11 +45,18 @@ class HandleLocations
|
|
|
|
|
$response = null;
|
|
|
|
|
//$utils = new StringTools();
|
|
|
|
|
//$term = $utils->removeCommonWords($terms);
|
|
|
|
|
$terms = str_replace(",", "", $terms);
|
|
|
|
|
$terms = str_replace(" ", "|", $terms);
|
|
|
|
|
$rawSearch = $terms;
|
|
|
|
|
$terms = str_replace(",", "", $terms);
|
|
|
|
|
$terms = str_replace(" ", "|", $terms);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$search = $this->connection->fetchAllAssociative("SELECT * FROM searchlocations('$terms')");
|
|
|
|
|
$active = [];
|
|
|
|
|
foreach ($search as $item) {
|
|
|
|
|
if ($item["active"] == true) {
|
|
|
|
|
array_push($active, $item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (PDOException $error) {
|
|
|
|
|
$errorMessage = $error->getMessage();
|
|
|
|
|
} catch (DBALException $error) {
|
|
|
|
@ -71,8 +78,8 @@ class HandleLocations
|
|
|
|
|
$response = [
|
|
|
|
|
"status" => true,
|
|
|
|
|
"message" => "Good Reqeust",
|
|
|
|
|
"items" => $search,
|
|
|
|
|
"terms" => $terms,
|
|
|
|
|
"items" => $active,
|
|
|
|
|
"terms" => $rawSearch,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|