Esempio n. 1
0
 /**
  * @{inheritDoc}
  */
 public function mass_index($data)
 {
     $this->client->beginTransaction();
     foreach ($data as $row) {
         $object_type = $row['object_type'];
         $object_id = $row['object_id'];
         unset($row['object_type'], $row['object_id']);
         $this->index($object_type, $object_id, $row);
     }
     $this->client->commit();
 }
Esempio n. 2
0
 public function testIndexDocument2()
 {
     $a = new Article(null, 'Test Article', 'This is an article to test', 'the body of the article', time());
     $session = new ezcSearchSession($this->backend, new ezcSearchXmlManager($this->testFilesDir));
     $session->beginTransaction();
     for ($i = 0; $i < 100; $i++) {
         $session->index($a);
     }
     $session->commit();
     $q = $session->createFindQuery('Article');
     $q->where($q->eq('title', 'Article'));
     $r = $session->find($q);
     self::assertEquals(1, $r->resultCount);
 }
Esempio n. 3
0
 public function testIndexDocument2()
 {
     $content = file_get_contents('/home/derick/dev/ezcomponents-web/files/parsed_rst/coding_standards.xml');
     $a = new Article(null, 'Test Article', 'This is an article to test', $content, time());
     $session = new ezcSearchSession($this->backend, new ezcSearchXmlManager($this->testFilesDir));
     $session->beginTransaction();
     for ($i = 0; $i < 5; $i++) {
         $session->index($a);
     }
     $session->commit();
     $q = $session->createFindQuery('Article');
     $q->where($q->eq('title', 'Article'));
     $r = $session->find($q);
     self::assertEquals(5, $r->resultCount);
 }