diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3991ffa..8d8c1c8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,6 +5,7 @@ on: branches: - master pull_request: + workflow_dispatch: jobs: tests: @@ -15,10 +16,14 @@ jobs: matrix: php: [7.2, 7.3, 7.4] laravel: [^6.0, ^7.0, ^8.0] - scout: [^7.0, ^8.0] + scout: [^7.0, ^8.0, ^9.0] exclude: - php: 7.2 laravel: ^8.0 + - laravel: ^6.0 + scout: ^9.0 + - laravel: ^7.0 + scout: ^9.0 - laravel: ^8.0 scout: ^7.0 include: @@ -49,4 +54,4 @@ jobs: composer update --prefer-dist --no-interaction --no-progress - name: Run tests - run: vendor/bin/phpunit --verbose \ No newline at end of file + run: vendor/bin/phpunit --verbose diff --git a/composer.json b/composer.json index 305a86c..fdf56d5 100644 --- a/composer.json +++ b/composer.json @@ -24,10 +24,10 @@ ], "require": { "php": "^7.2|^8.0", - "illuminate/contracts": "~6.0|~7.0|~8.0", - "illuminate/database": "~6.0|~7.0|~8.0", - "illuminate/support": "~6.0|~7.0|~8.0", - "laravel/scout": "~7.0|~8.0" + "illuminate/contracts": "~6.0|~7.0|~8.0|~9.0", + "illuminate/database": "~6.0|~7.0|~8.0|~9.0", + "illuminate/support": "~6.0|~7.0|~8.0|~9.0", + "laravel/scout": "~7.0|~8.0|~9.0" }, "require-dev": { "phpunit/phpunit": "^8.3", diff --git a/src/PostgresEngine.php b/src/PostgresEngine.php index b92b3e0..004f7f0 100644 --- a/src/PostgresEngine.php +++ b/src/PostgresEngine.php @@ -561,4 +561,24 @@ public function flush($model) ->table($model->searchableAs()) ->update([$indexColumn => null]); } + + /** + * Map the given results to instances of the given model via a lazy collection. + * + * @param \Laravel\Scout\Builder $builder + * @param mixed $results + * @param \Illuminate\Database\Eloquent\Model $model + * @return \Illuminate\Support\LazyCollection + */ + public function lazyMap(Builder $builder, $results, $model) { + if ($this->getTotalCount($results) === 0) { + return LazyCollection::empty(); + } + + return LazyCollection::make($results->all()); + } + + public function createIndex($name, array $options = []) {} + + public function deleteIndex($name) {} }