Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] change extend method name to elasticsearch #276

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/elasticsearch.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine;

return [
'host' => env('ELASTICSEARCH_HOST'),
'user' => env('ELASTICSEARCH_USER'),
Expand All @@ -26,4 +28,5 @@
],
],
],
'extended_as' => env('ELASTICSEARCH_EXTENDED_AS',ElasticSearchEngine::class)
Aryalav marked this conversation as resolved.
Show resolved Hide resolved
];
2 changes: 1 addition & 1 deletion src/ScoutElasticSearchServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function boot(): void
{
$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'scout');

$this->app->make(EngineManager::class)->extend(ElasticSearchEngine::class, function () {
$this->app->make(EngineManager::class)->extend(config('elasticsearch.extended_as'), function () {
Aryalav marked this conversation as resolved.
Show resolved Hide resolved
$elasticsearch = app(Client::class);

return new ElasticSearchEngine($elasticsearch);
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Support\Facades\Artisan;
use Laravel\Scout\ScoutServiceProvider;
use Matchish\ScoutElasticSearch\ElasticSearchServiceProvider;
use Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine;
use Matchish\ScoutElasticSearch\ScoutElasticSearchServiceProvider;
use Orchestra\Testbench\TestCase as BaseTestCase;

Expand All @@ -32,7 +31,7 @@ public function setUp(): void
*/
protected function getEnvironmentSetUp($app)
{
$app['config']->set('scout.driver', ElasticSearchEngine::class);
$app['config']->set('scout.driver', config('elasticsearch.extended_as'));
$app['config']->set('scout.chunk.searchable', 3);
$app['config']->set('scout.queue', false);
// Setup default database to use sqlite :memory:
Expand Down
Loading