public function testIfWillFindDocument() { $model = new SimpleModel(); $model->_id = new MongoId(); $model->title = 'New York, Tokyo, Los Angeles, Paris, Shanghai'; $im = new IndexManager($model); $im->index(); $val = $im->get(); // Need to wait here, or it will fail... sleep(1); $q = new QueryBuilder($model); /* @var $result SimpleModel[] */ $result = $q->search('tokyo'); codecept_debug($result); $this->assertTrue(count($result) > 0); unset($result); }
public function getTotalItemCount() { if ($this->totalItemCount === null) { $qb = new QueryBuilder($this->getModel()); $this->totalItemCount = $qb->count($this->getCriteria()->getSearch()); } return $this->totalItemCount; }