/** * Get organisations matching a user profile * @param AppBundle\Entity\Person $user the user for which the vacancies have to be retrieved */ public function organisatiesOpMaatAction($user) { $es = $this->get("ElasticsearchQuery"); $query = '{ "query": { "function_score": { "filter": { "bool": { "must": [ { "term": { "deleted": false }}'; $query .= ' ] } }, "functions": ['; if ($user->getLatitude() && $user->getLongitude()) { $query .= '{ "filter": { "exists": { "field": "location" } }, "gauss":{ "location":{ "origin": { "lat": ' . $user->getLatitude() . ', "lon": ' . $user->getLongitude() . ' }, "offset": "1km", "scale": "1km" } }, "weight": 2 },'; } $query .= '{ "gauss": { "likers": { "origin": 50, "scale": 5 } } }'; $userSectors = $user->esGetSectors(); if (!is_null($userSectors) && !$userSectors->isEmpty()) { foreach ($userSectors as $key => $sector) { $query .= ',{ "filter": { "term": { "sectors.name": "' . $sector->getName() . '" } }, "weight": 1 }'; } } $query .= '], "score_mode": "sum" } } }'; return $this->render("organisation/verenigingOpMaat.html.twig", ['organisations' => $es->requestByType($query, 'organisation'), 'viewMode' => 'tile']); }
/** * Get all saved vacancies for a user * @param AppBundle\Entity\Person $user the user for which the vacancies have to be retrieved */ public function listSavedVacanciesAction($user) { return $this->render("vacancy/vacatures_oplijsten.html.twig", ["vacancies" => $user->getLikedVacancies(), "viewMode" => 'tile']); }