/** * Called in index action. * Based on an article match and various settings, generates tracking events and routes user to appropriate page. * @param Wikia\Search\Config $searchConfig * @return boolean true if on page 1 and not routed, false if not on page 1 */ protected function handleArticleMatchTracking(Wikia\Search\Config $searchConfig) { if ($searchConfig->getPage() != 1) { return false; } $query = $searchConfig->getQuery()->getSanitizedQuery(); if ($searchConfig->hasArticleMatch()) { $article = Article::newFromID($searchConfig->getArticleMatch()->getId()); $title = $article->getTitle(); if ($this->getVal('fulltext', '0') === '0') { wfRunHooks('SpecialSearchIsgomatch', array($title, $query)); $this->setVarnishCacheTime(WikiaResponse::CACHE_DISABLED); $this->response->redirect($title->getFullUrl()); } } else { $title = Title::newFromText($query); if ($title !== null) { wfRunHooks('SpecialSearchNogomatch', array(&$title)); } } return true; }