From 4a21707705ebfba3256f3820e6c1a77a0f1e1812 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Fri, 21 Nov 2025 12:41:21 +0000 Subject: [PATCH 01/10] Make `insertDocuments` public --- src/Meilisearch/Index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Meilisearch/Index.php b/src/Meilisearch/Index.php index 5b0fa55..9028004 100644 --- a/src/Meilisearch/Index.php +++ b/src/Meilisearch/Index.php @@ -66,7 +66,7 @@ public function exists() } } - protected function insertDocuments(Documents $documents) + public function insertDocuments(Documents $documents) { $this->getIndex()->updateDocuments($documents->all()); } From 87be5057b3df3cc115fc0399f1ce785322f615c2 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Fri, 21 Nov 2025 12:42:04 +0000 Subject: [PATCH 02/10] Drop custom implementation of `insertMultiple` Chunking is now handled in Statamic's native implementation. --- config/statamic-meilisearch.php | 9 --------- src/Meilisearch/Index.php | 19 ------------------- src/ServiceProvider.php | 10 ---------- 3 files changed, 38 deletions(-) delete mode 100644 config/statamic-meilisearch.php diff --git a/config/statamic-meilisearch.php b/config/statamic-meilisearch.php deleted file mode 100644 index b8d3706..0000000 --- a/config/statamic-meilisearch.php +++ /dev/null @@ -1,9 +0,0 @@ - 100, - -]; diff --git a/src/Meilisearch/Index.php b/src/Meilisearch/Index.php index 9028004..fb20548 100644 --- a/src/Meilisearch/Index.php +++ b/src/Meilisearch/Index.php @@ -31,25 +31,6 @@ public function insert($document) return $this->insertMultiple(collect([$document])); } - public function insertMultiple($documents) - { - $documents - ->chunk(config('statamic-meilisearch.insert_chunk_size', 100)) - ->each(function ($documents, $index) { - $documents = $documents - ->map(fn ($document) => array_merge( - $this->searchables()->fields($document), - $this->getDefaultFields($document), - )) - ->values() - ->toArray(); - - $this->insertDocuments(new Documents($documents)); - }); - - return $this; - } - public function delete($document) { $this->getIndex()->deleteDocument($this->getSafeDocumentID($document->getSearchReference())); diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 3d4a767..761dd06 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -11,16 +11,6 @@ class ServiceProvider extends AddonServiceProvider { public function bootAddon() { - $this->mergeConfigFrom(__DIR__.'/../config/statamic-meilisearch.php', 'statamic-meilisearch'); - - if ($this->app->runningInConsole()) { - - $this->publishes([ - __DIR__.'/../config/statamic-meilisearch.php' => config_path('statamic-meilisearch.php'), - ], 'statamic-meilisearch-config'); - - } - Search::extend('meilisearch', function (Application $app, array $config, $name, $locale = null) { $client = $app->makeWith(Client::class, [ 'url' => $config['credentials']['url'], From 952b4ad41570b6310aa44ba5cd9282346da693e8 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Fri, 21 Nov 2025 12:42:55 +0000 Subject: [PATCH 03/10] Add `fields` method to manipulate data before sending to Meilisearch --- src/Meilisearch/Index.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Meilisearch/Index.php b/src/Meilisearch/Index.php index fb20548..ce54bda 100644 --- a/src/Meilisearch/Index.php +++ b/src/Meilisearch/Index.php @@ -31,6 +31,14 @@ public function insert($document) return $this->insertMultiple(collect([$document])); } + public function fields(Searchable $searchable) + { + return array_merge( + $this->searchables()->fields($searchable), + $this->getDefaultFields($searchable) + ); + } + public function delete($document) { $this->getIndex()->deleteDocument($this->getSafeDocumentID($document->getSearchReference())); From 53fa32c84483e0ea5c772135e33f182614339911 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Fri, 21 Nov 2025 12:43:34 +0000 Subject: [PATCH 04/10] Drop support for Statamic 5 --- .github/workflows/run-tests.yml | 2 +- composer.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d60d52c..9d082ad 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -24,7 +24,7 @@ jobs: matrix: os: [ubuntu-latest] php: [8.3, 8.4] - laravel: [11.*, 12.*] + laravel: [12.*] stability: [prefer-lowest, prefer-stable] name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/composer.json b/composer.json index c9b97e8..c997546 100644 --- a/composer.json +++ b/composer.json @@ -27,12 +27,12 @@ "meilisearch/meilisearch-php": "^1.0", "guzzlehttp/guzzle": "^7.3", "http-interop/http-factory-guzzle": "^1.0", - "illuminate/support": "^10.0 || ^11.0 || ^12.0", + "illuminate/support": "^12.0", "statamic/cms": "^6.0" }, "require-dev": { "laravel/pint": "^1.21", - "orchestra/testbench": "^9.0 || ^10.0", + "orchestra/testbench": "^10.0", "phpunit/phpunit": "^11.5.10" }, "autoload": { From 1c04ac8dfa45649ef447e74727ef1ecca22e931e Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Wed, 21 Jan 2026 12:46:22 +0000 Subject: [PATCH 05/10] require alpha 18 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c997546..8d7b576 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "guzzlehttp/guzzle": "^7.3", "http-interop/http-factory-guzzle": "^1.0", "illuminate/support": "^12.0", - "statamic/cms": "^6.0" + "statamic/cms": "^6.0.0-alpha.18" }, "require-dev": { "laravel/pint": "^1.21", From 0427f5150fb9cd9bfc33b159bba0e05f735ea53c Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Wed, 21 Jan 2026 16:59:57 +0000 Subject: [PATCH 06/10] disable cp index --- tests/TestCase.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index 1d1ede1..9c05325 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -15,7 +15,6 @@ protected function resolveApplicationConfiguration($app) { parent::resolveApplicationConfiguration($app); - // add driver $app['config']->set('statamic.search.drivers.meilisearch', [ 'credentials' => [ 'url' => 'http://localhost:7700', @@ -23,7 +22,10 @@ protected function resolveApplicationConfiguration($app) ], ]); - // add index + $app['config']->set('statamic.search.indexes.cp', [ + 'driver' => 'null', + ]); + $app['config']->set('statamic.search.indexes.meilisearch_index', [ 'driver' => 'meilisearch', 'searchables' => ['collection:pages'], From 6fa38d62de02235f237a31b1813d337bf1210838 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Wed, 21 Jan 2026 17:04:58 +0000 Subject: [PATCH 07/10] temporarily use dev branch --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8d7b576..1815b84 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "guzzlehttp/guzzle": "^7.3", "http-interop/http-factory-guzzle": "^1.0", "illuminate/support": "^12.0", - "statamic/cms": "^6.0.0-alpha.18" + "statamic/cms": "dev-search-indexes-with-underscores", }, "require-dev": { "laravel/pint": "^1.21", From 8d3f7c590b897042c6c07d0855eeeebaac6b6ab2 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Wed, 21 Jan 2026 17:09:26 +0000 Subject: [PATCH 08/10] wip --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1815b84..9d56c00 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "guzzlehttp/guzzle": "^7.3", "http-interop/http-factory-guzzle": "^1.0", "illuminate/support": "^12.0", - "statamic/cms": "dev-search-indexes-with-underscores", + "statamic/cms": "dev-search-indexes-with-underscores" }, "require-dev": { "laravel/pint": "^1.21", From 40d35a2eb14054368a4f6032eb40f80385ede193 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Fri, 23 Jan 2026 12:16:46 +0000 Subject: [PATCH 09/10] wip --- composer.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 9d56c00..8315ec2 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,8 @@ "guzzlehttp/guzzle": "^7.3", "http-interop/http-factory-guzzle": "^1.0", "illuminate/support": "^12.0", - "statamic/cms": "dev-search-indexes-with-underscores" + "statamic/cms": "^6.0.0-beta.4", + "spatie/laravel-ray": "^1.0@dev" }, "require-dev": { "laravel/pint": "^1.21", @@ -68,5 +69,6 @@ "developer": "Statamic Rad Pack" } }, - "minimum-stability": "dev" + "minimum-stability": "dev", + "prefer-stable": true } From dcca4f1f47d4dafa1d0fa943c6cc9899893a8549 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Fri, 23 Jan 2026 12:37:52 +0000 Subject: [PATCH 10/10] ah, needed `->values()` --- src/Meilisearch/Index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Meilisearch/Index.php b/src/Meilisearch/Index.php index ce54bda..d15dbb5 100644 --- a/src/Meilisearch/Index.php +++ b/src/Meilisearch/Index.php @@ -57,7 +57,7 @@ public function exists() public function insertDocuments(Documents $documents) { - $this->getIndex()->updateDocuments($documents->all()); + $this->getIndex()->updateDocuments($documents->values()->all()); } protected function deleteIndex()