/** * @{inheritDoc} */ public function truncate($object_type = false) { $this->query = $this->client->createDeleteQuery('\\phpbb\\titania\\search\\document'); if ($object_type !== false) { $this->query->where($this->query->eq('type', $object_type)); } $this->client->delete($this->query); }
public function testDeleteQuery() { $session = new ezcSearchSession($this->backend, new ezcSearchXmlManager($this->testFilesDir)); $a = new Article(null, 'Test Article Eén', 'This is the first article to test', 'the body of the article', time() - 86400); $session->index($a); $a = new Article(null, 'Test Article Twee', 'This is the second article to test', 'the body of the article', time()); $session->index($a); $q = $session->createFindQuery('Article'); $r = $session->find($q); self::assertEquals(2, $r->resultCount); $q = $session->createDeleteQuery('Article'); $q->where($q->eq('title', 'Twee')); $session->delete($q); $this->backend->sendRawPostCommand('update', array('wt' => 'json'), '<commit/>'); $q = $session->createFindQuery('Article'); $r = $session->find($q); self::assertEquals(1, $r->resultCount); }