diff --git a/src/Engines/AlgoliaEngine.php b/src/Engines/AlgoliaEngine.php index ad4aee5a..446c0314 100644 --- a/src/Engines/AlgoliaEngine.php +++ b/src/Engines/AlgoliaEngine.php @@ -90,7 +90,7 @@ public function delete($models) $index = $this->algolia->initIndex($models->first()->searchableAs()); $keys = $models instanceof RemoveableScoutCollection - ? $models->pluck($models->first()->getUnqualifiedScoutKeyName()) + ? $models->pluck($models->first()->getScoutKeyName()) : $models->map->getScoutKey(); $index->deleteObjects($keys->all()); diff --git a/src/Engines/MeiliSearchEngine.php b/src/Engines/MeiliSearchEngine.php index e27df873..8404b1cc 100644 --- a/src/Engines/MeiliSearchEngine.php +++ b/src/Engines/MeiliSearchEngine.php @@ -90,7 +90,7 @@ public function delete($models) $index = $this->meilisearch->index($models->first()->searchableAs()); $keys = $models instanceof RemoveableScoutCollection - ? $models->pluck($models->first()->getUnqualifiedScoutKeyName()) + ? $models->pluck($models->first()->getScoutKeyName()) : $models->map->getScoutKey(); $index->deleteDocuments($keys->all()); diff --git a/src/Searchable.php b/src/Searchable.php index a7f9f467..d873aacc 100644 --- a/src/Searchable.php +++ b/src/Searchable.php @@ -4,7 +4,6 @@ use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Collection as BaseCollection; -use Illuminate\Support\Str; trait Searchable { @@ -392,16 +391,6 @@ public function getScoutKeyName() return $this->getKeyName(); } - /** - * Get the unqualified Scout key name. - * - * @return string - */ - public function getUnqualifiedScoutKeyName() - { - return Str::afterLast($this->getScoutKeyName(), '.'); - } - /** * Determine if the current class should use soft deletes with searching. * diff --git a/tests/Unit/AlgoliaEngineTest.php b/tests/Unit/AlgoliaEngineTest.php index 3ce27013..4138e78d 100644 --- a/tests/Unit/AlgoliaEngineTest.php +++ b/tests/Unit/AlgoliaEngineTest.php @@ -93,7 +93,7 @@ public function test_remove_from_search_job_uses_custom_search_key() $engine = m::mock(AlgoliaEngine::class); $engine->shouldReceive('delete')->once()->with(m::on(function ($collection) { - $keyName = ($model = $collection->first())->getUnqualifiedScoutKeyName(); + $keyName = ($model = $collection->first())->getScoutKeyName(); return $model->getAttributes()[$keyName] === 'my-algolia-key.5'; })); diff --git a/tests/Unit/MeiliSearchEngineTest.php b/tests/Unit/MeiliSearchEngineTest.php index 00ace846..8fdc3465 100644 --- a/tests/Unit/MeiliSearchEngineTest.php +++ b/tests/Unit/MeiliSearchEngineTest.php @@ -97,7 +97,7 @@ public function test_remove_from_search_job_uses_custom_search_key() $engine = m::mock(MeiliSearchEngine::class); $engine->shouldReceive('delete')->once()->with(m::on(function ($collection) { - $keyName = ($model = $collection->first())->getUnqualifiedScoutKeyName(); + $keyName = ($model = $collection->first())->getScoutKeyName(); return $model->getAttributes()[$keyName] === 'my-meilisearch-key.5'; }));