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