예제 #1
0
 public function gettagsAction()
 {
     $key = $this->getRequest()->getParam('key');
     if (strlen($key) > 1) {
         $forumModel = new Application_Model_forum($this->registry->DB);
         $this->view->result = $forumModel->gettags($key);
     }
 }
예제 #2
0
 public function gettagsAction()
 {
     $tags = $this->getRequest()->getParam('tag');
     //$this->view->result=$post;
     /**
      * Open index
      */
     $index = Search_MyLucene::open($this->_forumindexPath);
     //$term=new Zend_search_lucene_i
     Zend_Search_Lucene_Search_Query_Wildcard::setMinPrefixLength(0);
     //$query = 'name:' . $post['name'];
     $query = 'tags:' . $tags . '*';
     $results = $index->find($query);
     $matches = array();
     foreach ($results as $values) {
         $string = explode(' ', $values->tags);
         foreach ($string as $str) {
             if (stripos($str, $tags) === 0) {
                 array_push($matches, strtolower($str));
             }
         }
     }
     $matches = array_unique($matches);
     $gettags = new Application_Model_forum($this->registry['DB']);
     $this->view->result = $gettags->gettags($matches);
 }