diff --git a/packages/orama/src/components/index.ts b/packages/orama/src/components/index.ts index b0ca4c740..a47a9d5e3 100644 --- a/packages/orama/src/components/index.ts +++ b/packages/orama/src/components/index.ts @@ -527,9 +527,9 @@ export async function searchByWhereClause { docs: Map @@ -56,7 +57,7 @@ function innerCreate( if (typeof type === 'object' && !Array.isArray(type)) { // Nested const ret = innerCreate(orama, sharedInternalDocumentStore, type, sortableDeniedProperties, path) - sorter.sortableProperties.push(...ret.sortableProperties) + safeArrayPush(sorter.sortableProperties, ret.sortableProperties); sorter.sorts = { ...sorter.sorts, ...ret.sorts, diff --git a/packages/orama/src/trees/flat.ts b/packages/orama/src/trees/flat.ts index 355c04995..c67b1e8a7 100644 --- a/packages/orama/src/trees/flat.ts +++ b/packages/orama/src/trees/flat.ts @@ -1,6 +1,6 @@ import { InternalDocumentID } from "../components/internal-document-id-store.js" import { EnumArrComparisonOperator, EnumComparisonOperator, Nullable, ScalarSearchableValue } from "../types.js" -import { intersect } from "../utils.js" +import { intersect, safeArrayPush } from "../utils.js" export interface FlatTree { numberToDocumentId: Map @@ -69,7 +69,7 @@ export function filter(root: FlatTree, operation: EnumComparisonOperator): Inter for (const v of value) { const ids = root.numberToDocumentId.get(v) if (ids) { - result.push(...ids) + safeArrayPush(result, ids) } } return result @@ -85,7 +85,7 @@ export function filter(root: FlatTree, operation: EnumComparisonOperator): Inter } const ids = root.numberToDocumentId.get(key) if (ids) { - result.push(...ids) + safeArrayPush(result, ids) } } return result