Skip to content

Commit

Permalink
Merge pull request #170 from matchish/scout9
Browse files Browse the repository at this point in the history
Support Scout 9
  • Loading branch information
matchish authored Jun 5, 2021
2 parents 87981a2 + b9e09ab commit 86aa41f
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/)

## [Unreleased]

## [4.0.7] - 2021-04-21
Support Scout 9
## [4.0.6] - 2021-04-21
### Fixed
- Hot fix for https://github.com/matchish/laravel-scout-elasticsearch/issues/160
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ shell: up ## Start shell into application container
$(docker_compose_bin) exec "$(APP_CONTAINER_NAME)" /bin/sh

install: up ## Install application dependencies into application container
$(docker_compose_bin) exec "$(APP_CONTAINER_NAME)" composer install --no-interaction --ansi --no-suggest
$(docker_compose_bin) exec "$(APP_CONTAINER_NAME)" composer install --no-interaction --ansi

test: up ## Execute application tests
$(docker_compose_bin) exec "$(APP_CONTAINER_NAME)" ./vendor/bin/phpstan analyze
Expand Down
12 changes: 5 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "matchish/laravel-scout-elasticsearch",
"description": "Search among multiple models with ElasticSearch and Laravel Scout",
"version": "4.0.6",
"version": "4.0.7",
"keywords": [
"laravel",
"scout",
Expand All @@ -19,17 +19,15 @@
"require": {
"php": "^7.2|^7.3",
"elasticsearch/elasticsearch": ">=7.2",
"laravel/scout": "^8.0 <8.6.1",
"laravel/scout": "^8.0|^9.0",
"ongr/elasticsearch-dsl": "^7.0",
"roave/better-reflection": "^3.3|^4.3"
},
"require-dev": {
"fzaninotto/faker": "^1.8",
"orchestra/testbench": "^4.0|^5.0",
"phpunit/phpunit": "^8.0|~9.4.0",
"illuminate/support": "^6.0|^7.0|^8.0",
"laravel/legacy-factories": "^1.0",
"nunomaduro/larastan": "~0.6",
"laravel/legacy-factories": "^1.0"
"orchestra/testbench": "^6.18",
"phpunit/phpunit": "^8.0|~9.4.0"
},
"autoload-dev": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion docker/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# See https://github.com/docker-library/php/blob/master/7.1/fpm/Dockerfile
FROM php:7.2-fpm as php
FROM php:7.3-fpm as php
ARG TIMEZONE

MAINTAINER Shliakhov Sergey <[email protected]>
Expand Down
37 changes: 37 additions & 0 deletions src/Engines/ElasticSearchEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Elasticsearch\Common\Exceptions\ServerErrorResponseException;
use Illuminate\Database\Eloquent\Collection;
use Laravel\Scout\Builder;
use Laravel\Scout\Builder as BaseBuilder;
use Laravel\Scout\Engines\Engine;
use Matchish\ScoutElasticSearch\ElasticSearch\HitsIteratorAggregate;
Expand Down Expand Up @@ -117,6 +118,42 @@ public function map(BaseBuilder $builder, $results, $model)
return new Collection($hits);
}

/**
* 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)
{
throw new \Error('Not implemented');
}

/**
* Create a search index.
*
* @param string $name
* @param array $options
* @return mixed
*/
public function createIndex($name, array $options = [])
{
throw new \Error('Not implemented');
}

/**
* Delete a search index.
*
* @param string $name
* @return mixed
*/
public function deleteIndex($name)
{
throw new \Error('Not implemented');
}

/**
* {@inheritdoc}
*/
Expand Down
3 changes: 2 additions & 1 deletion src/Mixed.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ final class Mixed
*/
public static function search($query = '', $callback = null)
{
return new Builder(new class extends Model {
return new Builder(new class extends Model
{
use Searchable;
}, $query, $callback);
}
Expand Down
1 change: 0 additions & 1 deletion src/ScoutElasticSearchServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public function boot(): void

return new ElasticSearchEngine($elasticsearch);
});

$this->registerCommands();
}

Expand Down

0 comments on commit 86aa41f

Please sign in to comment.