strapi-plugin-meilisearch-plus 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/index.js +15 -6
- package/dist/server/index.mjs +15 -6
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -485,14 +485,23 @@ const indexSettings = ({ strapi }) => ({
|
|
|
485
485
|
if (!sortableAttributes.includes("_contentType")) {
|
|
486
486
|
sortableAttributes.unshift("_contentType");
|
|
487
487
|
}
|
|
488
|
+
const maxTotalHits = await storeService.getStoreKey({
|
|
489
|
+
key: "meilisearch-max-total-hits"
|
|
490
|
+
});
|
|
488
491
|
strapi.log.info(
|
|
489
|
-
`[meilisearch-plus] Applying settings: filterable=[${filterableAttributes.join(", ")}], sortable=[${sortableAttributes.join(", ")}]`
|
|
492
|
+
`[meilisearch-plus] Applying settings: filterable=[${filterableAttributes.join(", ")}], sortable=[${sortableAttributes.join(", ")}], maxTotalHits=${maxTotalHits}`
|
|
490
493
|
);
|
|
494
|
+
const indexSettings2 = {
|
|
495
|
+
filterableAttributes,
|
|
496
|
+
sortableAttributes
|
|
497
|
+
};
|
|
498
|
+
if (maxTotalHits) {
|
|
499
|
+
indexSettings2.pagination = {
|
|
500
|
+
maxTotalHits
|
|
501
|
+
};
|
|
502
|
+
}
|
|
491
503
|
await meilisearchService.updateIndexSettings({
|
|
492
|
-
settings:
|
|
493
|
-
filterableAttributes,
|
|
494
|
-
sortableAttributes
|
|
495
|
-
}
|
|
504
|
+
settings: indexSettings2
|
|
496
505
|
});
|
|
497
506
|
ctx.body = {
|
|
498
507
|
data: {
|
|
@@ -1376,7 +1385,7 @@ const contentTypes = ({ strapi }) => ({
|
|
|
1376
1385
|
filter: [`_contentType = "${contentType}"`],
|
|
1377
1386
|
limit: 1
|
|
1378
1387
|
});
|
|
1379
|
-
return result.total || result.estimatedTotalHits || 0;
|
|
1388
|
+
return result.nbHits || result.total || result.estimatedTotalHits || 0;
|
|
1380
1389
|
} catch (error) {
|
|
1381
1390
|
if (error?.message?.includes("not found")) {
|
|
1382
1391
|
strapi.log.debug(
|
package/dist/server/index.mjs
CHANGED
|
@@ -484,14 +484,23 @@ const indexSettings = ({ strapi }) => ({
|
|
|
484
484
|
if (!sortableAttributes.includes("_contentType")) {
|
|
485
485
|
sortableAttributes.unshift("_contentType");
|
|
486
486
|
}
|
|
487
|
+
const maxTotalHits = await storeService.getStoreKey({
|
|
488
|
+
key: "meilisearch-max-total-hits"
|
|
489
|
+
});
|
|
487
490
|
strapi.log.info(
|
|
488
|
-
`[meilisearch-plus] Applying settings: filterable=[${filterableAttributes.join(", ")}], sortable=[${sortableAttributes.join(", ")}]`
|
|
491
|
+
`[meilisearch-plus] Applying settings: filterable=[${filterableAttributes.join(", ")}], sortable=[${sortableAttributes.join(", ")}], maxTotalHits=${maxTotalHits}`
|
|
489
492
|
);
|
|
493
|
+
const indexSettings2 = {
|
|
494
|
+
filterableAttributes,
|
|
495
|
+
sortableAttributes
|
|
496
|
+
};
|
|
497
|
+
if (maxTotalHits) {
|
|
498
|
+
indexSettings2.pagination = {
|
|
499
|
+
maxTotalHits
|
|
500
|
+
};
|
|
501
|
+
}
|
|
490
502
|
await meilisearchService.updateIndexSettings({
|
|
491
|
-
settings:
|
|
492
|
-
filterableAttributes,
|
|
493
|
-
sortableAttributes
|
|
494
|
-
}
|
|
503
|
+
settings: indexSettings2
|
|
495
504
|
});
|
|
496
505
|
ctx.body = {
|
|
497
506
|
data: {
|
|
@@ -1375,7 +1384,7 @@ const contentTypes = ({ strapi }) => ({
|
|
|
1375
1384
|
filter: [`_contentType = "${contentType}"`],
|
|
1376
1385
|
limit: 1
|
|
1377
1386
|
});
|
|
1378
|
-
return result.total || result.estimatedTotalHits || 0;
|
|
1387
|
+
return result.nbHits || result.total || result.estimatedTotalHits || 0;
|
|
1379
1388
|
} catch (error) {
|
|
1380
1389
|
if (error?.message?.includes("not found")) {
|
|
1381
1390
|
strapi.log.debug(
|
package/package.json
CHANGED