Skip to content

Commit fff5594

Browse files
stloydnorberttech
andauthored
Adjust Meilisearch adapter to newer library code (#1289)
* Drop support for PHP 8.1 * Adjust Meilisearch adapter to newer library code --------- Co-authored-by: Norbert Orzechowicz <[email protected]>
1 parent 258f07c commit fff5594

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

.github/workflows/test-suite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
ports:
4040
- 9200:9200
4141
meilisearch:
42-
image: getmeili/meilisearch:v1.11
42+
image: getmeili/meilisearch:latest
4343
env:
4444
MEILI_MASTER_KEY: masterKey
4545
MEILI_NO_ANALYTICS: true

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"google/apiclient": "^2.13",
2828
"halaxa/json-machine": "^1.1",
2929
"jawira/case-converter": "^3.4",
30-
"meilisearch/meilisearch-php": "~1.11.0",
30+
"meilisearch/meilisearch-php": "^1.11",
3131
"monolog/monolog": "^2.0||^3.0",
3232
"packaged/thrift": "^0.15.0",
3333
"php-http/discovery": "^1.0",

composer.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/adapter/etl-adapter-meilisearch/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
1515
"ext-hash": "*",
1616
"ext-json": "*",
17-
"meilisearch/meilisearch-php": "~1.11.0",
17+
"meilisearch/meilisearch-php": "^1.11",
1818
"flow-php/etl": "^0.10.0 || 1.x-dev"
1919
},
2020
"config": {

src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/SearchResults.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ public function toRows(EntryFactory $entryFactory) : Rows
4848

4949
public function total() : int
5050
{
51-
try {
52-
return $this->results->getTotalHits() ?: 0;
53-
} catch (\Error) {
54-
return $this->results->getEstimatedTotalHits();
51+
// Estimated total hits are set only in paginated result list
52+
if (null !== $this->results->getOffset()) {
53+
return $this->results->getEstimatedTotalHits() ?: $this->results->getHitsCount() ?: 0;
5554
}
55+
56+
return $this->results->getTotalHits() ?: $this->results->getHitsCount() ?: 0;
5657
}
5758
}

0 commit comments

Comments
 (0)