diff --git a/src/importers/VFSStructureGenerator.ts b/src/importers/VFSStructureGenerator.ts index 46b74cf5..e638d747 100644 --- a/src/importers/VFSStructureGenerator.ts +++ b/src/importers/VFSStructureGenerator.ts @@ -189,8 +189,7 @@ export class VFSStructureGenerator { reportProgress('metadata', `Preserved source file: ${options.sourceFilename}`) } - // Note: groups already calculated above for progress tracking - // const groups = this.groupEntities(importResult, options) + // `groups` was already computed above (for progress tracking) and is reused here. // Create directories and files for each group for (const [groupName, entities] of groups.entries()) { diff --git a/src/storage/adapters/fileSystemStorage.ts b/src/storage/adapters/fileSystemStorage.ts index 3f8f5118..fdca6e13 100644 --- a/src/storage/adapters/fileSystemStorage.ts +++ b/src/storage/adapters/fileSystemStorage.ts @@ -661,35 +661,6 @@ export class FileSystemStorage extends BaseStorage { return allEdges } - /** - * Get edges by source - */ - protected async getEdgesBySource(sourceId: string): Promise { - // This method is deprecated and would require loading metadata for each edge - // For now, return empty array since this is not efficiently implementable with new storage pattern - console.warn('getEdgesBySource is deprecated and not efficiently supported in new storage pattern') - return [] - } - - /** - * Get edges by target - */ - protected async getEdgesByTarget(targetId: string): Promise { - // This method is deprecated and would require loading metadata for each edge - // For now, return empty array since this is not efficiently implementable with new storage pattern - console.warn('getEdgesByTarget is deprecated and not efficiently supported in new storage pattern') - return [] - } - - /** - * Get edges by type - */ - protected async getEdgesByType(type: string): Promise { - // This method is deprecated and would require loading metadata for each edge - // For now, return empty array since this is not efficiently implementable with new storage pattern - console.warn('getEdgesByType is deprecated and not efficiently supported in new storage pattern') - return [] - } /** * Delete an edge from storage diff --git a/src/utils/metadataIndex.ts b/src/utils/metadataIndex.ts index 31fca200..59259150 100644 --- a/src/utils/metadataIndex.ts +++ b/src/utils/metadataIndex.ts @@ -2311,81 +2311,6 @@ export class MetadataIndexManager implements MetadataIndexProvider { return normalized } - /** - * DEPRECATED - Old implementation for backward compatibility - */ - private async getIdsForFilterOld(filter: any): Promise { - if (!filter || Object.keys(filter).length === 0) { - return [] - } - - // Handle logical operators - if (filter.allOf && Array.isArray(filter.allOf)) { - // For allOf, we need intersection of all sub-filters - const allIds: string[][] = [] - for (const subFilter of filter.allOf) { - const subIds = await this.getIdsForFilter(subFilter) - allIds.push(subIds) - } - - if (allIds.length === 0) return [] - if (allIds.length === 1) return allIds[0] - - // Intersection of all sets - return allIds.reduce((intersection, currentSet) => - intersection.filter(id => currentSet.includes(id)) - ) - } - - if (filter.anyOf && Array.isArray(filter.anyOf)) { - // For anyOf, we need union of all sub-filters - const unionIds = new Set() - for (const subFilter of filter.anyOf) { - const subIds = await this.getIdsForFilter(subFilter) - subIds.forEach(id => unionIds.add(id)) - } - return Array.from(unionIds) - } - - // Handle regular field filters - const criteria = this.convertFilterToCriteria(filter) - const idSets: string[][] = [] - const unindexedFields: string[] = [] - - for (const { field, values } of criteria) { - const unionIds = new Set() - try { - for (const value of values) { - const ids = await this.getIds(field, value) - ids.forEach(id => unionIds.add(id)) - } - } catch (err) { - if (err instanceof BrainyError && err.type === 'FIELD_NOT_INDEXED') { - unindexedFields.push(field) - // Treat as no matches and continue — same semantics as the main - // getIdsForFilter() path. - } else { - throw err - } - } - idSets.push(Array.from(unionIds)) - } - - if (unindexedFields.length > 0) { - prodLog.warn( - `[brainy] find() where-clause referenced unindexed field(s) ` + - `${unindexedFields.join(', ')}; their clauses contributed no rows.` - ) - } - if (idSets.length === 0) return [] - if (idSets.length === 1) return idSets[0] - - // Intersection of all field criteria (implicit $and) - return idSets.reduce((intersection, currentSet) => - intersection.filter(id => currentSet.includes(id)) - ) - } - /** * Flush dirty entries to storage (non-blocking version) * NOTE: Sparse indices are flushed immediately in add/remove operations