/**
  * Use this Method the get some results for your ajax autoCompleter.
  *
  * @throws \Exception
  * @throws \Zend_Search_Lucene_Exception
  */
 public function autoCompleteAction()
 {
     $this->removeViewRenderer();
     $terms = Plugin::wildcardFindTerms($this->query, $this->frontendIndex);
     if (empty($terms)) {
         $terms = Plugin::fuzzyFindTerms($this->query, $this->frontendIndex);
     }
     $suggestions = array();
     $counter = 1;
     foreach ($terms as $term) {
         $t = $term->text;
         //check if term can be found for current language
         $hits = NULL;
         $query = new \Zend_Search_Lucene_Search_Query_Boolean();
         $userQuery = \Zend_Search_Lucene_Search_QueryParser::parse($t, 'utf-8');
         $query->addSubquery($userQuery, TRUE);
         $this->addLanguageQuery($query);
         $this->addCategoryQuery($query);
         $this->addCountryQuery($query);
         $this->addRestrictionQuery($query);
         $validHits = $this->getValidHits($this->frontendIndex->find($query));
         if (count($validHits) > 0 and !in_array($t, $suggestions)) {
             $suggestions[] = $t;
             if ($counter >= $this->maxSuggestions) {
                 break;
             }
             $counter++;
         }
     }
     $data = [];
     foreach ($suggestions as $suggestion) {
         $data[] = $suggestion;
     }
     $this->_helper->json($data);
 }