This component uses ElasticSearch to search items in the forum
Exemplo n.º 1
0
 public function run()
 {
     $search = new Indexer();
     $search->indexAll();
     //print_r($search->searchCommon(array('title' => 'ubuntu', 'category' => 6)));
 }
Exemplo n.º 2
0
 /**
  * Finds related posts
  */
 public function showRelatedAction()
 {
     $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
     $post = Posts::findFirstById($this->request->getPost('id'));
     if ($post) {
         $indexer = new Indexer();
         $posts = $indexer->search(['title' => $post->title, 'category' => $post->categories_id], 5, true);
         if (count($posts) == 0) {
             $posts = $indexer->search(['title' => $post->title], 5, true);
         }
         $this->view->setVar('posts', $posts);
     } else {
         $this->view->setVar('posts', []);
     }
 }
Exemplo n.º 3
0
 public function run()
 {
     $search = new Indexer();
     $search->indexAll();
 }