Skip to content

Commit

Permalink
get key name
Browse files Browse the repository at this point in the history
  • Loading branch information
nticaric committed Aug 23, 2016
1 parent cd402e2 commit 6123aa4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Engines/TNTSearchEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function initIndex($model)
$indexer->setDatabaseHandle($model->getConnection()->getPdo());
$indexer->disableOutput = true;
$fields = implode(', ', $model->searchable);
$indexer->query("SELECT id, $fields FROM $indexName");
$indexer->query("SELECT {$model->getKeyName()} as id, $fields FROM $indexName");
$indexer->run();
}
}
Expand Down
5 changes: 5 additions & 0 deletions tests/TNTSearchEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public function getKey()
return 1;
}

public function getKeyName()
{
return 'id';
}

public function toSearchableArray()
{
return ['id' => 1];
Expand Down

0 comments on commit 6123aa4

Please sign in to comment.