Skip to content

Commit

Permalink
create index creates the index without calling ->run
Browse files Browse the repository at this point in the history
  • Loading branch information
nticaric committed Dec 22, 2016
1 parent e0fcd7c commit f098641
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/Engines/TNTSearchEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function search(Builder $builder)
public function paginate(Builder $builder, $perPage, $page)
{
$results = $this->performSearch($builder);

if ($builder->limit) {
$results['hits'] = $builder->limit;
}
Expand Down Expand Up @@ -193,11 +193,7 @@ public function initIndex($model)
if (!file_exists($this->tnt->config['storage']."/{$indexName}.index")) {
$indexer = $this->tnt->createIndex("$indexName.index");
$indexer->setDatabaseHandle($model->getConnection()->getPdo());
$indexer->disableOutput = true;
$indexer->setPrimaryKey($model->getKeyName());
$fields = implode(', ', array_keys($model->toSearchableArray()));
$indexer->query("SELECT {$model->getKeyName()}, $fields FROM {$model->getTablePrefix()}{$model->getTable()} WHERE {$model->getKeyName()} = {$model->getKey()}");
$indexer->run();
}
}
}

0 comments on commit f098641

Please sign in to comment.