From 462b298f6d2641f09a7e01dc41a3233fad03c463 Mon Sep 17 00:00:00 2001 From: casperiv <53900565+casperiv0@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:30:36 +0100 Subject: [PATCH] chore: remove debug changes --- .../indexer/indexer.controller.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/core/src/plugin/default-search-plugin/indexer/indexer.controller.ts b/packages/core/src/plugin/default-search-plugin/indexer/indexer.controller.ts index 7fefeb6919..b301156a7b 100644 --- a/packages/core/src/plugin/default-search-plugin/indexer/indexer.controller.ts +++ b/packages/core/src/plugin/default-search-plugin/indexer/indexer.controller.ts @@ -400,6 +400,8 @@ export class IndexerController { } private async saveVariants(ctx: MutableRequestContext, variants: ProductVariant[]) { + const items: SearchIndexItem[] = []; + await this.removeSyntheticVariants(ctx, variants); const productMap = new Map(); @@ -419,8 +421,6 @@ export class IndexerController { ? unique(ctx.channel.availableCurrencyCodes) : [ctx.channel.defaultCurrencyCode]; - const items: SearchIndexItem[] = []; - for (const currencyCode of availableCurrencyCodes) { for (const languageCode of availableLanguageCodes) { const productTranslation = this.getTranslation(product, languageCode); @@ -445,7 +445,6 @@ export class IndexerController { ctx.setChannel(ch); await this.productPriceApplicator.applyChannelPriceAndTax(variant, ctx); - const item = new SearchIndexItem({ channelId: ctx.channelId, languageCode, @@ -504,18 +503,16 @@ export class IndexerController { ); item.productInStock = productInStock; } - items.push(item); } } } - - ctx.setChannel(originalChannel); - - await this.queue.push(() => - this.connection.rawConnection.getRepository(SearchIndexItem).save(items, { chunk: 2500 }), - ); } + ctx.setChannel(originalChannel); + + await this.queue.push(() => + this.connection.getRepository(ctx, SearchIndexItem).save(items, { chunk: 2500 }), + ); } /**