feat: implement incremental sorted indices and Triple Intelligence find()

- Add incremental sorted index updates during CRUD operations for consistent <5ms range queries
- Implement parallel search optimization with vector, metadata, and graph intelligence fusion
- Fix metadata-only query handling to properly return results without vector search
- Fix NLP recursive call issue by using embed() instead of add()
- Add cardinality tracking for smart index optimization
- Store entity data in metadata for proper retrieval
- Add comprehensive performance documentation

This improves query performance from O(n) to O(log n) for range queries
and ensures consistent fast performance without lazy loading delays.
This commit is contained in:
David Snelling 2025-09-12 12:36:11 -07:00
parent 0996c72468
commit 33c6b06649
9 changed files with 1023 additions and 181 deletions

View file

@ -118,17 +118,8 @@ export class PatternLibrary {
return this.embeddingCache.get(text)!
}
// Use add/get/delete pattern to get embeddings
const id = await this.brain.add({
data: text,
type: 'document'
})
const entity = await this.brain.get(id)
const embedding = entity?.vector || []
// Clean up temporary entity
await this.brain.delete(id)
// Use brain's embed method directly to avoid recursion
const embedding = await (this.brain as any).embed(text)
this.embeddingCache.set(text, embedding)
return embedding