/** * @method POST */ function get() { parse_str($this->request->data, $request); // parse request $term = $request['term']; $language = $request['language']; $siteUniqId = SITE_UNIQ_ID; $site = Site::GetBySiteUniqId($siteUniqId); $showSecure = false; if (isset($_SESSION[$site['FriendlyId'] . '.UserId'])) { $showSecure = true; } $results = SearchIndex::Search($siteUniqId, $language, $term, $showSecure); // return a json response $response = new Tonic\Response(Tonic\Response::OK); $response->contentType = 'application/json'; $response->body = json_encode($results); return $response; }