/** * Check for mispelled terms * * @param Query $query * @return Suggestion */ protected function checkSpelling() { // advanced search? no thanks! if ($this->request->getParam('advanced') != null) { return new Suggestion(); } $id = $this->query->getHash(); // have we checked it already? $suggestion = $this->request->getSessionData("spelling_{$id}"); if ($suggestion == null) { $suggestion = $this->query->checkSpelling(); // check it $this->request->setSessionData("spelling_{$id}", serialize($suggestion)); // save for later } else { $suggestion = unserialize($suggestion); // resurrect it, like shane } return $suggestion; }