Skip to content

Commit

Permalink
处理存在表前缀的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
vanry committed Apr 17, 2020
1 parent 7c3b309 commit 139b627
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Engines/TNTSearchEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Laravel\Scout\Builder;
use TeamTNT\TNTSearch\TNTSearch;
use Laravel\Scout\Engines\Engine;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Builder as Query;
use TeamTNT\TNTSearch\Exceptions\IndexNotFoundException;
Expand Down Expand Up @@ -227,7 +228,11 @@ protected function applyOrders(Query $query, array $ids)
{
if (empty($this->builder->orders)) {
return $query->orderByRaw(
sprintf('field(%s,%s)', $query->getModel()->getQualifiedKeyName(), implode(',', $ids))
sprintf('field(%s%s,%s)',
DB::getTablePrefix(),
$query->getModel()->getQualifiedKeyName(),
implode(',', $ids)
)
);
}

Expand Down

0 comments on commit 139b627

Please sign in to comment.