brainy/.recovery-workspace/dist-backup-20250910-141917/indices/fieldIndex.d.ts
David Snelling 8ff382ca3b chore: recovery checkpoint - v3.0 API successfully recovered
CRITICAL CHECKPOINT - DO NOT PUSH TO GITHUB

Recovery Status:
- Successfully recovered brainy.ts from compiled JavaScript
- All core v3.0 API methods functional (add, get, update, delete, relate, find, etc.)
- Neural subsystem intact (562KB embedded patterns, NLP working)
- Augmentation pipeline operational (20+ augmentations)
- HNSW clustering system complete
- Triple Intelligence compiled (needs constructor fix)
- Test suite validates functionality

Changes preserved:
- 898 files with changes from last 3 days
- 144,475 insertions
- All augmentation improvements
- All test coverage enhancements
- Complete v3.0 feature set

This is a LOCAL checkpoint only - contains recovered work after corruption incident.
Created backup in .backups/brainy-full-20250910-151314.tar.gz

Branch: recovery-checkpoint-20250910-151433
Date: Wed Sep 10 03:18:04 PM PDT 2025
2025-09-10 15:18:04 -07:00

76 lines
1.8 KiB
TypeScript

/**
* Field Index for efficient field-based queries
* Provides O(log n) lookups for field values and range queries
*/
interface RangeQueryOptions {
field: string;
min?: any;
max?: any;
includeMin?: boolean;
includeMax?: boolean;
}
export declare class FieldIndex {
private indices;
private sortedIndices;
private indexedFields;
/**
* Add a document to the field index
*/
add(id: string, metadata: Record<string, any>): void;
/**
* Remove a document from the field index
*/
remove(id: string, metadata: Record<string, any>): void;
/**
* Query for exact field value match
* O(1) hash lookup
*/
queryExact(field: string, value: any): string[];
/**
* Query for multiple values (IN operator)
* O(k) where k is number of values
*/
queryIn(field: string, values: any[]): string[];
/**
* Query for range of values
* O(log n + m) where m is number of results
*/
queryRange(options: RangeQueryOptions): string[];
/**
* Query with complex where clause
*/
query(where: Record<string, any>): string[];
/**
* Mark sorted index as needing rebuild
*/
private markSortedIndexDirty;
/**
* Ensure sorted index is up to date for a field
*/
private ensureSortedIndex;
/**
* Binary search for start position (inclusive)
*/
private binarySearch;
/**
* Binary search for end position (inclusive)
*/
private binarySearchEnd;
/**
* Debug method to inspect index contents
*/
debugIndex(field?: string): any;
/**
* Get statistics about the index
*/
getStats(): {
indexedFields: number;
totalValues: number;
totalMappings: number;
};
/**
* Clear all indices
*/
clear(): void;
}
export {};