@reactionary/meilisearch 0.7.5 → 0.7.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.
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
ProductSearchResultItemVariantSchema
|
|
5
5
|
} from "@reactionary/core";
|
|
6
6
|
import { MeiliSearch } from "meilisearch";
|
|
7
|
+
import { getProductIndexNameForLocale } from "../core/index-utils.js";
|
|
7
8
|
class MeilisearchProductRecommendationsCapability extends ProductRecommendationsCapability {
|
|
8
9
|
config;
|
|
9
10
|
constructor(config, cache, context) {
|
|
@@ -26,7 +27,7 @@ class MeilisearchProductRecommendationsCapability extends ProductRecommendations
|
|
|
26
27
|
host: this.config.apiUrl,
|
|
27
28
|
apiKey: this.config.apiKey
|
|
28
29
|
});
|
|
29
|
-
const index = client.index(this.config.indexName);
|
|
30
|
+
const index = client.index(getProductIndexNameForLocale(this.config.indexName, this.context.languageContext.locale));
|
|
30
31
|
if (!this.config.useAIEmbedding) {
|
|
31
32
|
console.warn("AI embedding is not enabled in configuration. Similar product recommendations will be based on keyword matching, which may not provide optimal results.");
|
|
32
33
|
return [];
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
success
|
|
24
24
|
} from "@reactionary/core";
|
|
25
25
|
import { MeiliSearch } from "meilisearch";
|
|
26
|
+
import { getProductIndexNameForLocale } from "../core/index-utils.js";
|
|
26
27
|
class MeilisearchProductSearchCapability extends ProductSearchCapability {
|
|
27
28
|
config;
|
|
28
29
|
factory;
|
|
@@ -66,7 +67,7 @@ class MeilisearchProductSearchCapability extends ProductSearchCapability {
|
|
|
66
67
|
host: this.config.apiUrl,
|
|
67
68
|
apiKey: this.config.apiKey
|
|
68
69
|
});
|
|
69
|
-
const index = client.index(this.config.indexName);
|
|
70
|
+
const index = client.index(getProductIndexNameForLocale(this.config.indexName, this.context.languageContext.locale));
|
|
70
71
|
const remote = await index.search(payload.search.term, this.queryByTermPayload(payload));
|
|
71
72
|
const result = this.parsePaginatedResult(remote, payload);
|
|
72
73
|
for (const selectedFacet of payload.search.facets) {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/meilisearch",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"vitest": "^4.0.9",
|
|
9
9
|
"@nx/vite": "22.4.5",
|
|
10
|
-
"@reactionary/core": "0.7.
|
|
10
|
+
"@reactionary/core": "0.7.6",
|
|
11
11
|
"zod": "4.1.9",
|
|
12
12
|
"meilisearch": "^0.55.0"
|
|
13
13
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getProductIndexNameForLocale(baseIndexName: string, locale: string): string;
|