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:
parent
0996c72468
commit
33c6b06649
9 changed files with 1023 additions and 181 deletions
|
|
@ -45,20 +45,11 @@ async function buildEmbeddedPatterns() {
|
|||
|
||||
for (const example of pattern.examples || []) {
|
||||
try {
|
||||
// Add the example temporarily to get its embedding
|
||||
const id = await brain.add({
|
||||
data: example,
|
||||
type: 'document' // Use document type for text
|
||||
})
|
||||
|
||||
// Get the entity with its embedding
|
||||
const entity = await brain.get(id)
|
||||
if (entity?.vector && Array.isArray(entity.vector)) {
|
||||
embeddings.push(entity.vector)
|
||||
// Use brain's embed method directly - no add/delete needed!
|
||||
const embedding = await (brain as any).embed(example)
|
||||
if (embedding && Array.isArray(embedding)) {
|
||||
embeddings.push(embedding)
|
||||
}
|
||||
|
||||
// Remove the temporary entity
|
||||
await brain.delete(id)
|
||||
} catch (error) {
|
||||
console.warn(` ⚠️ Failed to embed example: "${example}"`)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue