Skip to content

Commit

Permalink
Merge branch 'release/4.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
janhenckens committed Dec 2, 2024
2 parents db9e31a + a3ee345 commit 0b9a74b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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

## 4.1.2 - 2024-12-02
### Fixed
- Don't through an error on the CP Utility when an index isn't created yet ([#343](https://github.com/studioespresso/craft-scout/issues/343))

## 4.1.1 - 2024-07-15
### Fixed
- Removed debug log that tripped some Sentry loggers ([#312](https://github.com/studioespresso/craft-scout/issues/312))
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "studioespresso/craft-scout",
"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.",
"type": "craft-plugin",
"version": "4.1.1",
"version": "4.1.2",
"keywords": [
"craft",
"cms",
Expand Down
6 changes: 5 additions & 1 deletion src/templates/utility.twig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
</tr>
<tr>
<th class="light">{{ "Records in Index"|t("scout") }}</th>
<td>{{ index.indexed }}</td>
{% if not index.indexEmpty %}
<td>{{ index.indexed }}</td>
{% else %}
<td>{{ "Index not synced yet"|t("scout") }}</td>
{% endif %}
</tr>
{% endif %}
<tr>
Expand Down
13 changes: 11 additions & 2 deletions src/utilities/ScoutUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace rias\scout\utilities;

use Algolia\AlgoliaSearch\Exceptions\NotFoundException;
use Craft;
use craft\base\Utility;
use Illuminate\Support\Arr;
Expand Down Expand Up @@ -61,11 +62,19 @@ public static function contentHtml(): string

$elementType = $engine->scoutIndex->enforceElementType ? $engine->scoutIndex->elementType : 'Mixed Element Types';

try {
$totalRecords = $engine->getTotalRecords();
$indexEmpty = false;
} catch (NotFoundException $e) {
$totalRecords = 0;
$indexEmpty = true;
}

$stats = array_merge($stats, [
'elementType' => $elementType,
'sites' => $sites,
'indexed' => $engine->getTotalRecords(),
'elements' => $totalElements,
'indexed' => $totalRecords,
'indexEmpty' => $indexEmpty, 'elements' => $totalElements,
]);
}
return $stats;
Expand Down

0 comments on commit 0b9a74b

Please sign in to comment.