/**
  * Test delete
  */
 public function testDelete()
 {
     $project = new Project_Models_Project();
     $project->find(1);
     $project->delete();
     $search = new Phprojekt_Search();
     $result = (array) $search->search('Karlsruhe');
     $this->assertEquals(0, count($result));
 }
 /**
  * Search for words.
  *
  * Returns a list of items that have the word, sorted by module with:
  * <pre>
  *  - id            => id of the item found.
  *  - moduleId      => id of the module.
  *  - moduleName    => Name of the module.
  *  - moduleLabel   => Display for the module.
  *  - firstDisplay  => Firts display for the item (Ej. title).
  *  - secondDisplay => Second display for the item (Ej. notes).
  *  - projectId     => Parent project id of the item.
  * </pre>
  *
  * REQUIRES request parameters:
  * <pre>
  *  - string <b>words</b> An string of words (Will be separated by the spaces).
  * </pre>
  *
  * OPTIONAL request parameters:
  * <pre>
  *  - integer <b>count</b> Number of results.
  * </pre>
  *
  * The return is in JSON format.
  *
  * @return void
  */
 public function jsonSearchAction()
 {
     $words = (string) $this->getRequest()->getParam('words');
     $count = (int) $this->getRequest()->getParam('count', null);
     $offset = (int) $this->getRequest()->getParam('start', null);
     $search = new Phprojekt_Search();
     $tags = new Phprojekt_Tags();
     $searchresults = $search->search($words, $count);
     $tagresults = $tags->search($words, $count);
     $results = array('search' => $searchresults, 'tags' => $tagresults);
     Phprojekt_Converter_Json::echoConvert($results);
 }
Exemple #3
0
 /**
  * Test delete
  */
 public function testDelete()
 {
     $project = new Project_Models_Project();
     $project->find(Zend_Registry::get('searchInsertedId'));
     $project->delete();
     $search = new Phprojekt_Search();
     $result = (array) $search->search('CCÄC DDÖD');
     $this->assertEquals(0, count($result));
 }
Exemple #4
0
 private function _regenerateSearch()
 {
     $step = 100;
     $start = 0;
     $max = $this->_db->select()->from('calendar2', 'MAX(id)')->query()->fetchColumn();
     $model = new Calendar2_Models_Calendar2();
     $search = new Phprojekt_Search();
     while ($start <= $max) {
         if ($this->_debug) {
             Phprojekt::getInstance()->getLog()->debug($start . ' - ' . ($start + $step));
         }
         $events = $model->fetchAll("id >= {$start} AND id < " . ($start + $step));
         $start += $step;
         foreach ($events as $e) {
             $search->indexObjectItem($e);
         }
     }
 }