From a7f86aa0d4dc2b55381f31339f12524ec6eeebf7 Mon Sep 17 00:00:00 2001 From: Sergey Shliakhov Date: Sun, 3 Nov 2019 10:13:10 +0200 Subject: [PATCH 1/4] Throw exception if there are elasticsearch bulk error https://github.com/matchish/laravel-scout-elasticsearch/issues/37 --- src/Engines/ElasticSearchEngine.php | 6 ++++-- .../Engines/ElasticSearchEngineTest.php | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Engines/ElasticSearchEngine.php b/src/Engines/ElasticSearchEngine.php index 559fe7be..779ffacf 100644 --- a/src/Engines/ElasticSearchEngine.php +++ b/src/Engines/ElasticSearchEngine.php @@ -8,7 +8,6 @@ use Laravel\Scout\Builder as BaseBuilder; use Illuminate\Database\Eloquent\Collection; use ONGR\ElasticsearchDSL\Query\MatchAllQuery; -use Matchish\ScoutElasticSearch\ElasticSearch\Index; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Bulk; use Matchish\ScoutElasticSearch\ElasticSearch\SearchFactory; use Matchish\ScoutElasticSearch\ElasticSearch\SearchResults; @@ -43,7 +42,10 @@ public function update($models) { $params = new Bulk(); $params->index($models); - $this->elasticsearch->bulk($params->toArray()); + $response = $this->elasticsearch->bulk($params->toArray()); + if (array_key_exists('errors', $response) && $response['errors']) { + throw new \Exception('Bulk update error'); + } } /** diff --git a/tests/Integration/Engines/ElasticSearchEngineTest.php b/tests/Integration/Engines/ElasticSearchEngineTest.php index 7e0f4501..ab44786b 100644 --- a/tests/Integration/Engines/ElasticSearchEngineTest.php +++ b/tests/Integration/Engines/ElasticSearchEngineTest.php @@ -6,7 +6,9 @@ use App\Product; use Laravel\Scout\Builder; use Tests\IntegrationTestCase; +use Matchish\ScoutElasticSearch\ElasticSearch\Index; use Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine; +use Matchish\ScoutElasticSearch\ElasticSearch\Params\Indices\Create; final class ElasticSearchEngineTest extends IntegrationTestCase { @@ -55,6 +57,23 @@ public function test_update() } } + public function test_update_throw_exception_on_elasticsearch_error() + { + $this->expectException(\Exception::class); + $models = Product::all(); + $models->map(function ($model) { + $model->price = 'bad format'; + return $model; + }); + $index = Index::fromSearchable($models->first()); + $params = new Create( + 'products', + $index->config() + ); + $this->elasticsearch->indices()->create($params->toArray()); + $this->engine->update($models); + } + public function test_delete() { $models = Product::all(); From 4db20a5918ed158e95004ba5e85ccccd0212c631 Mon Sep 17 00:00:00 2001 From: Sergey Shlyakhov Date: Sun, 3 Nov 2019 08:54:38 +0000 Subject: [PATCH 2/4] Apply fixes from StyleCI --- .../EloquentHitsIteratorAggregate.php | 2 +- src/ElasticSearch/SearchFactory.php | 6 +++--- src/Engines/ElasticSearchEngine.php | 16 ++++++++-------- src/Jobs/ImportStages.php | 6 +++--- src/Jobs/Stages/CleanUp.php | 4 ++-- src/Jobs/Stages/CreateWriteIndex.php | 6 +++--- src/Jobs/Stages/PullFromSource.php | 6 +++--- src/Jobs/Stages/SwitchToNewAndRemoveOldIndex.php | 2 +- src/Mixed.php | 2 +- src/ProgressReportable.php | 2 +- src/ScoutElasticSearchServiceProvider.php | 4 ++-- src/Searchable/SearchableListFactory.php | 4 ++-- tests/Feature/FlushCommandTest.php | 2 +- tests/Feature/ImportCommandTest.php | 4 ++-- .../ScoutElasticSearchServiceProviderTest.php | 2 +- tests/Feature/SearchTest.php | 6 +++--- .../Engines/ElasticSearchEngineTest.php | 7 ++++--- tests/Integration/Jobs/ImportTest.php | 2 +- tests/Integration/Jobs/Stages/CleanUpTest.php | 4 ++-- .../Jobs/Stages/CreateWriteIndexTest.php | 2 +- .../Jobs/Stages/PullFromSourceTest.php | 4 ++-- .../Integration/Jobs/Stages/RefreshIndexTest.php | 4 ++-- .../Stages/SwitchToNewAndRemoveOldIndexTest.php | 4 ++-- tests/TestCase.php | 4 ++-- tests/Unit/ElasticSearch/IndexTest.php | 2 +- tests/Unit/ElasticSearch/Params/BulkTest.php | 2 +- tests/Unit/Engines/ElasticSearchEngineTest.php | 6 +++--- tests/Unit/Jobs/ImportStagesTest.php | 6 +++--- tests/Unit/MixedTest.php | 4 ++-- tests/laravel/app/Book.php | 2 +- tests/laravel/app/Product.php | 2 +- tests/laravel/app/Ticket.php | 2 +- .../2019_15_02_000002_create_books_table.php | 4 ++-- .../2019_15_02_000002_create_products_table.php | 4 ++-- .../2019_15_02_000002_create_tickets_table.php | 4 ++-- 35 files changed, 72 insertions(+), 71 deletions(-) diff --git a/src/ElasticSearch/EloquentHitsIteratorAggregate.php b/src/ElasticSearch/EloquentHitsIteratorAggregate.php index e76c07d9..fc93df27 100644 --- a/src/ElasticSearch/EloquentHitsIteratorAggregate.php +++ b/src/ElasticSearch/EloquentHitsIteratorAggregate.php @@ -8,9 +8,9 @@ namespace Matchish\ScoutElasticSearch\ElasticSearch; -use Traversable; use Laravel\Scout\Builder; use Laravel\Scout\Searchable; +use Traversable; /** * @internal diff --git a/src/ElasticSearch/SearchFactory.php b/src/ElasticSearch/SearchFactory.php index 0ad569b5..0ce6014e 100644 --- a/src/ElasticSearch/SearchFactory.php +++ b/src/ElasticSearch/SearchFactory.php @@ -3,11 +3,11 @@ namespace Matchish\ScoutElasticSearch\ElasticSearch; use Laravel\Scout\Builder; -use ONGR\ElasticsearchDSL\Search; -use ONGR\ElasticsearchDSL\Sort\FieldSort; use ONGR\ElasticsearchDSL\Query\Compound\BoolQuery; -use ONGR\ElasticsearchDSL\Query\TermLevel\TermQuery; use ONGR\ElasticsearchDSL\Query\FullText\QueryStringQuery; +use ONGR\ElasticsearchDSL\Query\TermLevel\TermQuery; +use ONGR\ElasticsearchDSL\Search; +use ONGR\ElasticsearchDSL\Sort\FieldSort; final class SearchFactory { diff --git a/src/Engines/ElasticSearchEngine.php b/src/Engines/ElasticSearchEngine.php index 779ffacf..20dbd000 100644 --- a/src/Engines/ElasticSearchEngine.php +++ b/src/Engines/ElasticSearchEngine.php @@ -2,18 +2,18 @@ namespace Matchish\ScoutElasticSearch\Engines; -use Laravel\Scout\Searchable; -use Laravel\Scout\Engines\Engine; -use ONGR\ElasticsearchDSL\Search; -use Laravel\Scout\Builder as BaseBuilder; use Illuminate\Database\Eloquent\Collection; -use ONGR\ElasticsearchDSL\Query\MatchAllQuery; +use Laravel\Scout\Builder as BaseBuilder; +use Laravel\Scout\Engines\Engine; +use Laravel\Scout\Searchable; +use Matchish\ScoutElasticSearch\ElasticSearch\EloquentHitsIteratorAggregate; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Bulk; -use Matchish\ScoutElasticSearch\ElasticSearch\SearchFactory; -use Matchish\ScoutElasticSearch\ElasticSearch\SearchResults; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Indices\Refresh; -use Matchish\ScoutElasticSearch\ElasticSearch\EloquentHitsIteratorAggregate; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Search as SearchParams; +use Matchish\ScoutElasticSearch\ElasticSearch\SearchFactory; +use Matchish\ScoutElasticSearch\ElasticSearch\SearchResults; +use ONGR\ElasticsearchDSL\Query\MatchAllQuery; +use ONGR\ElasticsearchDSL\Search; final class ElasticSearchEngine extends Engine { diff --git a/src/Jobs/ImportStages.php b/src/Jobs/ImportStages.php index b94d675c..505a777d 100644 --- a/src/Jobs/ImportStages.php +++ b/src/Jobs/ImportStages.php @@ -2,13 +2,13 @@ namespace Matchish\ScoutElasticSearch\Jobs; -use Illuminate\Support\Collection; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Collection; use Matchish\ScoutElasticSearch\ElasticSearch\Index; use Matchish\ScoutElasticSearch\Jobs\Stages\CleanUp; -use Matchish\ScoutElasticSearch\Jobs\Stages\RefreshIndex; -use Matchish\ScoutElasticSearch\Jobs\Stages\PullFromSource; use Matchish\ScoutElasticSearch\Jobs\Stages\CreateWriteIndex; +use Matchish\ScoutElasticSearch\Jobs\Stages\PullFromSource; +use Matchish\ScoutElasticSearch\Jobs\Stages\RefreshIndex; use Matchish\ScoutElasticSearch\Jobs\Stages\SwitchToNewAndRemoveOldIndex; class ImportStages extends Collection diff --git a/src/Jobs/Stages/CleanUp.php b/src/Jobs/Stages/CleanUp.php index c3d351ed..e8c4d07c 100644 --- a/src/Jobs/Stages/CleanUp.php +++ b/src/Jobs/Stages/CleanUp.php @@ -3,9 +3,9 @@ namespace Matchish\ScoutElasticSearch\Jobs\Stages; use Elasticsearch\Client; -use Laravel\Scout\Searchable; -use Illuminate\Database\Eloquent\Model; use Elasticsearch\Common\Exceptions\Missing404Exception; +use Illuminate\Database\Eloquent\Model; +use Laravel\Scout\Searchable; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Indices\Alias\Get as GetAliasParams; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Indices\Delete as DeleteIndexParams; diff --git a/src/Jobs/Stages/CreateWriteIndex.php b/src/Jobs/Stages/CreateWriteIndex.php index 6a7799e3..c4beff5c 100644 --- a/src/Jobs/Stages/CreateWriteIndex.php +++ b/src/Jobs/Stages/CreateWriteIndex.php @@ -3,12 +3,12 @@ namespace Matchish\ScoutElasticSearch\Jobs\Stages; use Elasticsearch\Client; -use Laravel\Scout\Searchable; use Illuminate\Database\Eloquent\Model; -use Matchish\ScoutElasticSearch\ElasticSearch\Index; -use Matchish\ScoutElasticSearch\ElasticSearch\WriteAlias; +use Laravel\Scout\Searchable; use Matchish\ScoutElasticSearch\ElasticSearch\DefaultAlias; +use Matchish\ScoutElasticSearch\ElasticSearch\Index; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Indices\Create; +use Matchish\ScoutElasticSearch\ElasticSearch\WriteAlias; /** * @internal diff --git a/src/Jobs/Stages/PullFromSource.php b/src/Jobs/Stages/PullFromSource.php index be34dfea..ba2da36c 100644 --- a/src/Jobs/Stages/PullFromSource.php +++ b/src/Jobs/Stages/PullFromSource.php @@ -2,10 +2,10 @@ namespace Matchish\ScoutElasticSearch\Jobs\Stages; -use Laravel\Scout\Searchable; -use Illuminate\Support\Collection; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Collection; +use Laravel\Scout\Searchable; /** * @internal diff --git a/src/Jobs/Stages/SwitchToNewAndRemoveOldIndex.php b/src/Jobs/Stages/SwitchToNewAndRemoveOldIndex.php index 025c7242..d51a5029 100644 --- a/src/Jobs/Stages/SwitchToNewAndRemoveOldIndex.php +++ b/src/Jobs/Stages/SwitchToNewAndRemoveOldIndex.php @@ -3,8 +3,8 @@ namespace Matchish\ScoutElasticSearch\Jobs\Stages; use Elasticsearch\Client; -use Laravel\Scout\Searchable; use Illuminate\Database\Eloquent\Model; +use Laravel\Scout\Searchable; use Matchish\ScoutElasticSearch\ElasticSearch\Index; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Indices\Alias\Get; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Indices\Alias\Update; diff --git a/src/Mixed.php b/src/Mixed.php index 4fd3985b..00c0f9fa 100644 --- a/src/Mixed.php +++ b/src/Mixed.php @@ -2,9 +2,9 @@ namespace Matchish\ScoutElasticSearch; +use Illuminate\Database\Eloquent\Model; use Laravel\Scout\Builder; use Laravel\Scout\Searchable; -use Illuminate\Database\Eloquent\Model; final class Mixed { diff --git a/src/ProgressReportable.php b/src/ProgressReportable.php index e4edcdb4..37e512d8 100644 --- a/src/ProgressReportable.php +++ b/src/ProgressReportable.php @@ -2,8 +2,8 @@ namespace Matchish\ScoutElasticSearch; -use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Helper\ProgressBar; +use Symfony\Component\Console\Output\NullOutput; trait ProgressReportable { diff --git a/src/ScoutElasticSearchServiceProvider.php b/src/ScoutElasticSearchServiceProvider.php index ff1e3870..51a3dc10 100644 --- a/src/ScoutElasticSearchServiceProvider.php +++ b/src/ScoutElasticSearchServiceProvider.php @@ -5,12 +5,12 @@ namespace Matchish\ScoutElasticSearch; use Elasticsearch\Client; -use Laravel\Scout\EngineManager; use Illuminate\Support\ServiceProvider; +use Laravel\Scout\EngineManager; use Laravel\Scout\ScoutServiceProvider; -use Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine; use Matchish\ScoutElasticSearch\Console\Commands\FlushCommand; use Matchish\ScoutElasticSearch\Console\Commands\ImportCommand; +use Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine; final class ScoutElasticSearchServiceProvider extends ServiceProvider { diff --git a/src/Searchable/SearchableListFactory.php b/src/Searchable/SearchableListFactory.php index 4fdf9c50..ad3fecb5 100644 --- a/src/Searchable/SearchableListFactory.php +++ b/src/Searchable/SearchableListFactory.php @@ -4,10 +4,10 @@ namespace Matchish\ScoutElasticSearch\Searchable; -use function in_array; +use Illuminate\Support\Collection; use Illuminate\Support\Str; +use function in_array; use Laravel\Scout\Searchable; -use Illuminate\Support\Collection; use Symfony\Component\Finder\Finder; final class SearchableListFactory diff --git a/tests/Feature/FlushCommandTest.php b/tests/Feature/FlushCommandTest.php index 14c4c0b6..6f066c9e 100644 --- a/tests/Feature/FlushCommandTest.php +++ b/tests/Feature/FlushCommandTest.php @@ -5,10 +5,10 @@ namespace Tests\Feature; use App\Product; -use Tests\IntegrationTestCase; use Illuminate\Support\Facades\Artisan; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Bulk; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Indices\Refresh; +use Tests\IntegrationTestCase; final class FlushCommandTest extends IntegrationTestCase { diff --git a/tests/Feature/ImportCommandTest.php b/tests/Feature/ImportCommandTest.php index bcb515b0..0346eac8 100644 --- a/tests/Feature/ImportCommandTest.php +++ b/tests/Feature/ImportCommandTest.php @@ -5,11 +5,11 @@ namespace Tests\Feature; use App\Book; -use stdClass; use App\Product; -use Tests\IntegrationTestCase; use Illuminate\Support\Facades\Artisan; +use stdClass; use Symfony\Component\Console\Output\BufferedOutput; +use Tests\IntegrationTestCase; final class ImportCommandTest extends IntegrationTestCase { diff --git a/tests/Feature/ScoutElasticSearchServiceProviderTest.php b/tests/Feature/ScoutElasticSearchServiceProviderTest.php index 99d7fb2e..df5fe60b 100644 --- a/tests/Feature/ScoutElasticSearchServiceProviderTest.php +++ b/tests/Feature/ScoutElasticSearchServiceProviderTest.php @@ -2,8 +2,8 @@ namespace Matchish\ScoutElasticSearch; -use Tests\TestCase; use Elasticsearch\Client; +use Tests\TestCase; class ScoutElasticSearchServiceProviderTest extends TestCase { diff --git a/tests/Feature/SearchTest.php b/tests/Feature/SearchTest.php index 41128710..c570d015 100644 --- a/tests/Feature/SearchTest.php +++ b/tests/Feature/SearchTest.php @@ -5,12 +5,12 @@ namespace Tests\Feature; use App\Book; -use App\Ticket; use App\Product; -use Tests\IntegrationTestCase; +use App\Ticket; use Illuminate\Pagination\Paginator; -use Matchish\ScoutElasticSearch\Mixed; use Illuminate\Support\Facades\Artisan; +use Matchish\ScoutElasticSearch\Mixed; +use Tests\IntegrationTestCase; final class SearchTest extends IntegrationTestCase { diff --git a/tests/Integration/Engines/ElasticSearchEngineTest.php b/tests/Integration/Engines/ElasticSearchEngineTest.php index ab44786b..fd2f25a5 100644 --- a/tests/Integration/Engines/ElasticSearchEngineTest.php +++ b/tests/Integration/Engines/ElasticSearchEngineTest.php @@ -2,13 +2,13 @@ namespace Tests\Integration\Engines; -use stdClass; use App\Product; use Laravel\Scout\Builder; -use Tests\IntegrationTestCase; use Matchish\ScoutElasticSearch\ElasticSearch\Index; -use Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Indices\Create; +use Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine; +use stdClass; +use Tests\IntegrationTestCase; final class ElasticSearchEngineTest extends IntegrationTestCase { @@ -63,6 +63,7 @@ public function test_update_throw_exception_on_elasticsearch_error() $models = Product::all(); $models->map(function ($model) { $model->price = 'bad format'; + return $model; }); $index = Index::fromSearchable($models->first()); diff --git a/tests/Integration/Jobs/ImportTest.php b/tests/Integration/Jobs/ImportTest.php index 60b55068..1d332ad4 100644 --- a/tests/Integration/Jobs/ImportTest.php +++ b/tests/Integration/Jobs/ImportTest.php @@ -3,11 +3,11 @@ namespace Tests\Integration\Jobs; use App\Product; -use Tests\IntegrationTestCase; use Illuminate\Console\OutputStyle; use Matchish\ScoutElasticSearch\Jobs\Import; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Tests\Fixtures\DummyOutput; +use Tests\IntegrationTestCase; class ImportTest extends IntegrationTestCase { diff --git a/tests/Integration/Jobs/Stages/CleanUpTest.php b/tests/Integration/Jobs/Stages/CleanUpTest.php index ca2c6442..8ae6431b 100644 --- a/tests/Integration/Jobs/Stages/CleanUpTest.php +++ b/tests/Integration/Jobs/Stages/CleanUpTest.php @@ -2,10 +2,10 @@ namespace Tests\Integration\Jobs\Stages; -use stdClass; use App\Product; -use Tests\IntegrationTestCase; use Matchish\ScoutElasticSearch\Jobs\Stages\CleanUp; +use stdClass; +use Tests\IntegrationTestCase; class CleanUpTest extends IntegrationTestCase { diff --git a/tests/Integration/Jobs/Stages/CreateWriteIndexTest.php b/tests/Integration/Jobs/Stages/CreateWriteIndexTest.php index 0877a117..c8906b88 100644 --- a/tests/Integration/Jobs/Stages/CreateWriteIndexTest.php +++ b/tests/Integration/Jobs/Stages/CreateWriteIndexTest.php @@ -6,9 +6,9 @@ use App\Product; use Elasticsearch\Client; -use Tests\IntegrationTestCase; use Matchish\ScoutElasticSearch\ElasticSearch\Index; use Matchish\ScoutElasticSearch\Jobs\Stages\CreateWriteIndex; +use Tests\IntegrationTestCase; final class CreateWriteIndexTest extends IntegrationTestCase { diff --git a/tests/Integration/Jobs/Stages/PullFromSourceTest.php b/tests/Integration/Jobs/Stages/PullFromSourceTest.php index f54851d6..de6313bb 100644 --- a/tests/Integration/Jobs/Stages/PullFromSourceTest.php +++ b/tests/Integration/Jobs/Stages/PullFromSourceTest.php @@ -4,10 +4,10 @@ namespace Tests\Integration\Jobs\Stages; -use stdClass; use App\Product; -use Tests\IntegrationTestCase; use Matchish\ScoutElasticSearch\Jobs\Stages\PullFromSource; +use stdClass; +use Tests\IntegrationTestCase; final class PullFromSourceTest extends IntegrationTestCase { diff --git a/tests/Integration/Jobs/Stages/RefreshIndexTest.php b/tests/Integration/Jobs/Stages/RefreshIndexTest.php index 6d32c0b3..39139b7e 100644 --- a/tests/Integration/Jobs/Stages/RefreshIndexTest.php +++ b/tests/Integration/Jobs/Stages/RefreshIndexTest.php @@ -4,10 +4,10 @@ namespace Tests\Integration\Jobs\Stages; -use stdClass; -use Tests\IntegrationTestCase; use Matchish\ScoutElasticSearch\ElasticSearch\Index; use Matchish\ScoutElasticSearch\Jobs\Stages\RefreshIndex; +use stdClass; +use Tests\IntegrationTestCase; final class RefreshIndexTest extends IntegrationTestCase { diff --git a/tests/Integration/Jobs/Stages/SwitchToNewAndRemoveOldIndexTest.php b/tests/Integration/Jobs/Stages/SwitchToNewAndRemoveOldIndexTest.php index f608f2ec..cff84d7d 100644 --- a/tests/Integration/Jobs/Stages/SwitchToNewAndRemoveOldIndexTest.php +++ b/tests/Integration/Jobs/Stages/SwitchToNewAndRemoveOldIndexTest.php @@ -4,11 +4,11 @@ namespace Tests\Integration\Jobs\Stages; -use stdClass; use App\Product; -use Tests\IntegrationTestCase; use Matchish\ScoutElasticSearch\ElasticSearch\Index; use Matchish\ScoutElasticSearch\Jobs\Stages\SwitchToNewAndRemoveOldIndex; +use stdClass; +use Tests\IntegrationTestCase; final class SwitchToNewAndRemoveOldIndexTest extends IntegrationTestCase { diff --git a/tests/TestCase.php b/tests/TestCase.php index 0e41c408..68dd1d58 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -6,10 +6,10 @@ use Illuminate\Support\Facades\Artisan; use Laravel\Scout\ScoutServiceProvider; -use Orchestra\Testbench\TestCase as BaseTestCase; -use Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine; use Matchish\ScoutElasticSearch\ElasticSearchServiceProvider; +use Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine; use Matchish\ScoutElasticSearch\ScoutElasticSearchServiceProvider; +use Orchestra\Testbench\TestCase as BaseTestCase; abstract class TestCase extends BaseTestCase { diff --git a/tests/Unit/ElasticSearch/IndexTest.php b/tests/Unit/ElasticSearch/IndexTest.php index 5ed99b43..13080f42 100644 --- a/tests/Unit/ElasticSearch/IndexTest.php +++ b/tests/Unit/ElasticSearch/IndexTest.php @@ -9,8 +9,8 @@ namespace Tests\Unit\ElasticSearch; use App\Product; -use Tests\TestCase; use Matchish\ScoutElasticSearch\ElasticSearch\Index; +use Tests\TestCase; class IndexTest extends TestCase { diff --git a/tests/Unit/ElasticSearch/Params/BulkTest.php b/tests/Unit/ElasticSearch/Params/BulkTest.php index 795721f0..42cc1062 100644 --- a/tests/Unit/ElasticSearch/Params/BulkTest.php +++ b/tests/Unit/ElasticSearch/Params/BulkTest.php @@ -3,8 +3,8 @@ namespace Tests\Unit\ElasticSearch\Params; use App\Product; -use Tests\TestCase; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Bulk; +use Tests\TestCase; class BulkTest extends TestCase { diff --git a/tests/Unit/Engines/ElasticSearchEngineTest.php b/tests/Unit/Engines/ElasticSearchEngineTest.php index a37768fd..5287a208 100644 --- a/tests/Unit/Engines/ElasticSearchEngineTest.php +++ b/tests/Unit/Engines/ElasticSearchEngineTest.php @@ -3,12 +3,12 @@ namespace Tests\Unit\Engines; use App\Product; -use Mockery as m; -use Tests\TestCase; use Elasticsearch\Client; use Laravel\Scout\Builder; -use ONGR\ElasticsearchDSL\Search; use Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine; +use Mockery as m; +use ONGR\ElasticsearchDSL\Search; +use Tests\TestCase; class ElasticSearchEngineTest extends TestCase { diff --git a/tests/Unit/Jobs/ImportStagesTest.php b/tests/Unit/Jobs/ImportStagesTest.php index 55d8fe78..195521fe 100644 --- a/tests/Unit/Jobs/ImportStagesTest.php +++ b/tests/Unit/Jobs/ImportStagesTest.php @@ -3,13 +3,13 @@ namespace Tests\Unit\Jobs; use App\Product; -use Tests\TestCase; use Matchish\ScoutElasticSearch\Jobs\ImportStages; use Matchish\ScoutElasticSearch\Jobs\Stages\CleanUp; -use Matchish\ScoutElasticSearch\Jobs\Stages\RefreshIndex; -use Matchish\ScoutElasticSearch\Jobs\Stages\PullFromSource; use Matchish\ScoutElasticSearch\Jobs\Stages\CreateWriteIndex; +use Matchish\ScoutElasticSearch\Jobs\Stages\PullFromSource; +use Matchish\ScoutElasticSearch\Jobs\Stages\RefreshIndex; use Matchish\ScoutElasticSearch\Jobs\Stages\SwitchToNewAndRemoveOldIndex; +use Tests\TestCase; class ImportStagesTest extends TestCase { diff --git a/tests/Unit/MixedTest.php b/tests/Unit/MixedTest.php index db42f16c..5d406dc9 100644 --- a/tests/Unit/MixedTest.php +++ b/tests/Unit/MixedTest.php @@ -2,10 +2,10 @@ namespace Tests\Unit; -use ReflectionClass; use Laravel\Scout\Searchable; -use PHPUnit\Framework\TestCase; use Matchish\ScoutElasticSearch\Mixed; +use PHPUnit\Framework\TestCase; +use ReflectionClass; class MixedTest extends TestCase { diff --git a/tests/laravel/app/Book.php b/tests/laravel/app/Book.php index aee0cbf8..066292f2 100644 --- a/tests/laravel/app/Book.php +++ b/tests/laravel/app/Book.php @@ -2,9 +2,9 @@ namespace App; -use Laravel\Scout\Searchable; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Laravel\Scout\Searchable; class Book extends Model { diff --git a/tests/laravel/app/Product.php b/tests/laravel/app/Product.php index f48250b9..ba1f4423 100644 --- a/tests/laravel/app/Product.php +++ b/tests/laravel/app/Product.php @@ -2,9 +2,9 @@ namespace App; -use Laravel\Scout\Searchable; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Laravel\Scout\Searchable; class Product extends Model { diff --git a/tests/laravel/app/Ticket.php b/tests/laravel/app/Ticket.php index 6582f259..232211c5 100644 --- a/tests/laravel/app/Ticket.php +++ b/tests/laravel/app/Ticket.php @@ -2,9 +2,9 @@ namespace App; -use Laravel\Scout\Searchable; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Laravel\Scout\Searchable; class Ticket extends Model { diff --git a/tests/laravel/database/migrations/2019_15_02_000002_create_books_table.php b/tests/laravel/database/migrations/2019_15_02_000002_create_books_table.php index ccf193f0..a7e172bd 100644 --- a/tests/laravel/database/migrations/2019_15_02_000002_create_books_table.php +++ b/tests/laravel/database/migrations/2019_15_02_000002_create_books_table.php @@ -2,9 +2,9 @@ declare(strict_types=1); -use Illuminate\Support\Facades\Schema; -use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; final class CreateBooksTable extends Migration { diff --git a/tests/laravel/database/migrations/2019_15_02_000002_create_products_table.php b/tests/laravel/database/migrations/2019_15_02_000002_create_products_table.php index 98bdeb78..6397e0a3 100644 --- a/tests/laravel/database/migrations/2019_15_02_000002_create_products_table.php +++ b/tests/laravel/database/migrations/2019_15_02_000002_create_products_table.php @@ -2,9 +2,9 @@ declare(strict_types=1); -use Illuminate\Support\Facades\Schema; -use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; final class CreateProductsTable extends Migration { diff --git a/tests/laravel/database/migrations/2019_15_02_000002_create_tickets_table.php b/tests/laravel/database/migrations/2019_15_02_000002_create_tickets_table.php index 81a2581c..69bd55a4 100644 --- a/tests/laravel/database/migrations/2019_15_02_000002_create_tickets_table.php +++ b/tests/laravel/database/migrations/2019_15_02_000002_create_tickets_table.php @@ -2,9 +2,9 @@ declare(strict_types=1); -use Illuminate\Support\Facades\Schema; -use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; final class CreateTicketsTable extends Migration { From 0559ce1bdf42d304b949947d4a8874a6a05278b5 Mon Sep 17 00:00:00 2001 From: Sergey Shlyakhov Date: Mon, 4 Nov 2019 06:17:14 +0200 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb2b4c97..addc33b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/) ## [Unreleased] +## [2.0.3] - 2019-11-04 +### Fixed +- Throw exception if there are elasticsearch errors on update + ## [2.0.2] - 2019-05-10 ### Added - Search amongst multiple models From d56339c89bb5d7a4fd34b43bf4f18fcee7d2f7d4 Mon Sep 17 00:00:00 2001 From: Sergey Shlyakhov Date: Mon, 4 Nov 2019 06:18:00 +0200 Subject: [PATCH 4/4] Bump version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e5fd3f2f..21963efc 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "matchish/laravel-scout-elasticsearch", "description": "This package extends Laravel Scout adding full power of ElasticSearch", - "version": "2.0.2", + "version": "2.0.3", "keywords": [ "laravel", "scout",