From 863b154fc44d36a46edec5c08c551bea1c76a688 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 21 Dec 2024 11:55:19 +0100 Subject: [PATCH] feat(vendure): test fix --- .../src/build-elastic-body.spec.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/elasticsearch-plugin/src/build-elastic-body.spec.ts b/packages/elasticsearch-plugin/src/build-elastic-body.spec.ts index e52d30887c..b9815a0f81 100644 --- a/packages/elasticsearch-plugin/src/build-elastic-body.spec.ts +++ b/packages/elasticsearch-plugin/src/build-elastic-body.spec.ts @@ -21,7 +21,8 @@ describe('buildElasticBody()', () => { multi_match: { query: 'test', type: 'best_fields', - fields: ['productName^1', 'productVariantName^1', 'description^1', 'sku^1'], + fuzziness: 'AUTO', + fields: ['productName^5', 'productVariantName^5', 'description^1', 'sku^1'], }, }, ], @@ -389,7 +390,8 @@ describe('buildElasticBody()', () => { multi_match: { query: 'test', type: 'best_fields', - fields: ['productName^1', 'productVariantName^1', 'description^1', 'sku^1'], + fuzziness: 'AUTO', + fields: ['productName^5', 'productVariantName^5', 'description^1', 'sku^1'], }, }, ], @@ -427,7 +429,8 @@ describe('buildElasticBody()', () => { multi_match: { query: 'test', type: 'phrase', - fields: ['productName^1', 'productVariantName^1', 'description^1', 'sku^1'], + fuzziness: 'AUTO', + fields: ['productName^5', 'productVariantName^5', 'description^1', 'sku^1'], }, }, ], @@ -456,6 +459,7 @@ describe('buildElasticBody()', () => { multi_match: { query: 'test', type: 'best_fields', + fuzziness: 'AUTO', fields: ['productName^3', 'productVariantName^4', 'description^2', 'sku^5'], }, }, @@ -482,7 +486,7 @@ describe('buildElasticBody()', () => { const result = buildElasticBody({ term: 'test' }, config, CHANNEL_ID, LanguageCode.en); expect(result.script_fields).toEqual({ test: { - script: 'doc[\'property\'].dummyScript(test)', + script: "doc['property'].dummyScript(test)", }, }); });