Explorar el Código

fix(elasticsearch-plugin): Get tests passing, small formatting fixes

The e2e tests were failing due to the use of `relationLoadStrategy: 'query'`,
which is unfortunately buggy when combined with nested object relations.
Michael Bromley hace 1 año
padre
commit
8cab59032d

+ 3 - 5
packages/elasticsearch-plugin/src/indexing/indexer.controller.ts

@@ -31,8 +31,8 @@ import { Observable } from 'rxjs';
 import { In, IsNull } from 'typeorm';
 
 import { ELASTIC_SEARCH_OPTIONS, VARIANT_INDEX_NAME, loggerCtx } from '../constants';
-import type { ElasticsearchOptions } from '../options';
-import type {
+import { ElasticsearchOptions } from '../options';
+import {
     BulkOperation,
     BulkOperationDoc,
     BulkResponseBody,
@@ -500,7 +500,6 @@ export class ElasticsearchIndexerController implements OnModuleInit, OnModuleDes
             product = await this.connection
                 .getRepository(ctx, Product)
                 .find({
-                    relationLoadStrategy: 'query',
                     where: { id: productId, deletedAt: IsNull() },
                     relations: this.productRelations,
                 })
@@ -524,10 +523,9 @@ export class ElasticsearchIndexerController implements OnModuleInit, OnModuleDes
                 order: {
                     id: 'ASC',
                 },
-                relationLoadStrategy: 'query',
             });
         } catch (e: any) {
-            console.log(e);
+            Logger.error(e.message, loggerCtx, e.stack);
         }
 
         // eslint-disable-next-line @typescript-eslint/no-non-null-assertion

+ 4 - 5
packages/elasticsearch-plugin/src/options.ts

@@ -15,7 +15,6 @@ import {
     CustomScriptMapping,
     ElasticSearchInput,
     ElasticSearchSortInput,
-    ElasticSearchSortParameter,
     GraphQlPrimitive,
     PrimitiveTypeVariations,
 } from './types';
@@ -160,8 +159,8 @@ export interface ElasticsearchOptions {
      * @description
      * Products limit chunk size for each loop iteration when indexing products.
      *
-     * @default
-     * 500
+     * @default 2500
+     * @since 2.1.7
      */
     reindexProductsChunkSize?: number;
     /**
@@ -170,8 +169,8 @@ export interface ElasticsearchOptions {
      * index operations. This option sets the maximum number of operations in the memory buffer before a
      * bulk operation is executed.
      *
-     * @default
-     * 3000
+     * @default 3000
+     * @since 2.1.7
      */
     reindexBulkOperationSizeLimit?: number;
     /**