Browse Source

fix(elasticsearch): Set default score to 0

Hendrik Depauw 5 years ago
parent
commit
dbf26e1af0
1 changed files with 2 additions and 2 deletions
  1. 2 2
      packages/elasticsearch-plugin/src/elasticsearch.service.ts

+ 2 - 2
packages/elasticsearch-plugin/src/elasticsearch.service.ts

@@ -294,7 +294,7 @@ export class ElasticsearchService implements OnModuleInit, OnModuleDestroy {
             priceWithTax: {
                 value: source.priceWithTax,
             },
-            score: hit._score,
+            score: hit._score || 0,
         };
 
         this.addCustomMappings(result, source, this.options.customProductVariantMappings);
@@ -328,7 +328,7 @@ export class ElasticsearchService implements OnModuleInit, OnModuleDestroy {
                 max: source.priceWithTaxMax,
             },
             channelIds: [],
-            score: hit._score,
+            score: hit._score || 0,
         };
         this.addCustomMappings(result, source, this.options.customProductMappings);
         return result;