public function testCustomPrimaryKey() { $tnt = new TNTSearch(); $tnt->loadConfig($this->config); $indexer = $tnt->createIndex($this->indexName); $indexer->setPrimaryKey('post_id'); $indexer->disableOutput = true; $indexer->query('SELECT * FROM posts;'); $indexer->run(); $tnt->selectIndex($this->indexName); $res = $tnt->search('second'); //the most relevant doc has the id 9 $this->assertEquals("2", $res['ids'][0]); }
/** * @expectedException TeamTNT\TNTSearch\Exceptions\IndexNotFoundException * @expectedExceptionCode 1 */ public function testIndexDoesNotExistException() { $tnt = new TNTSearch(); $tnt->loadConfig($this->config); $tnt->selectIndex('IndexThatDoesNotExist'); }