/**
  * Advanced search screen
  */
 public function advancedAction()
 {
     $this->cache = new Cache();
     $id = $this->id . '_facets';
     // get a cached copy if we got it
     $facets = $this->cache->get($id);
     if (!$facets instanceof Facets) {
         $facets = $this->engine->getAllFacets();
         $this->cache->set($id, $facets, time() + 7 * 24 * 60 * 60);
         // one week cache
     }
     $terms_number = count($this->query->getQueryTerms());
     // add blank terms to get us to 4 rows
     if ($terms_number < 4) {
         for ($x = $terms_number + 1; $x <= 4; $x++) {
             $this->query->addTerm($x, null, null, null, null);
         }
     }
     $this->response->setVariable('query', $this->query);
     $this->response->setVariable('limits', $facets);
     $this->response->setView('search/advanced.xsl');
     return $this->response;
 }