Skip to content

Commit cbb8b4c

Browse files
authored
Merge pull request #370 from studioespresso/feature/366-scout-import-cli-command-does-not-produce-any-output-when-targeting-an-index-that-has-multiple-elements
STU-197 Echo status when importing multiple element types
2 parents 980dd6e + 5e3b0b6 commit cbb8b4c

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## 5.0.6 - 2025-06-02
6+
### Fixed
7+
- Fixed an issue when Craft Commerce was installed but not enabled ([#368](https://github.com/studioespresso/craft-scout/issues/368))
8+
9+
### Added
10+
- Importing indexes with multiple element types now echo the element count for each type ([#366](https://github.com/studioespresso/craft-scout/issues/366))
11+
512
## 5.0.5 - 2025-03-28
613
### Fixed
714
- Fix regression when indexRelations is false ([#364](https://github.com/studioespresso/craft-scout/pull/364))

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "studioespresso/craft-scout",
33
"description": "Craft Scout provides a simple solution for adding full-text search to your entries. Scout will automatically keep your search indexes in sync with your entries.",
44
"type": "craft-plugin",
5-
"version": "5.0.5",
5+
"version": "5.0.6",
66
"keywords": [
77
"craft",
88
"cms",
@@ -53,7 +53,8 @@
5353
"scripts": {
5454
"check-cs": "ecs check --ansi",
5555
"fix-cs": "ecs check --ansi --fix",
56-
"phpstan": "phpstan --memory-limit=1G"
56+
"phpstan": "phpstan --memory-limit=1G",
57+
"ci": "ecs check --ansi --fix && phpstan --memory-limit=1G"
5758
},
5859
"autoload": {
5960
"psr-4": {

src/console/controllers/scout/IndexController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,17 @@ public function actionImport($index = '')
7474
$elementsUpdated = 0;
7575

7676
foreach ($engine->scoutIndex->criteria as $query) {
77+
$totalElements = $query->count();
78+
$elementsUpdated = 0;
7779
$batch = $query->batch(
7880
Scout::$plugin->getSettings()->batch_size
7981
);
8082

83+
8184
foreach ($batch as $elements) {
8285
$engine->update($elements);
86+
$elementsUpdated += count($elements);
87+
$this->stdout("Updated {$elementsUpdated}/{$totalElements} element(s) ({$query->elementType}) in {$engine->scoutIndex->indexName}\n", Console::FG_GREEN);
8388
}
8489
}
8590
} else {

0 commit comments

Comments
 (0)