fix: exclude __words__ keyword index from corruption detection and getStats()
The __words__ keyword index stores 50-5000 entries per entity (one per word), which inflated avg entries/entity well above the corruption threshold of 100. This caused: 1. validateConsistency() to falsely detect corruption on every startup, triggering unnecessary clearAllIndexData() + rebuild() cycles 2. getStats() to log false "Metadata index may be corrupted" warnings and report inflated totalEntries/totalIds stats Both methods now skip __words__ when counting, so stats and health checks reflect metadata fields only (noun, type, createdAt, etc.). Keyword search is unaffected since the __words__ field index itself is not modified.
This commit is contained in:
parent
32dbdcec61
commit
364360d447
128 changed files with 5637 additions and 5682 deletions
|
|
@ -21,7 +21,7 @@ let brainyInstance: Brainy | null = null
|
|||
const getBrainy = async (): Promise<Brainy> => {
|
||||
if (!brainyInstance) {
|
||||
brainyInstance = new Brainy()
|
||||
await brainyInstance.init() // v5.0.1: Initialize brain (VFS auto-initialized here!)
|
||||
await brainyInstance.init() // Initialize brain (VFS auto-initialized here!)
|
||||
}
|
||||
return brainyInstance
|
||||
}
|
||||
|
|
@ -52,8 +52,8 @@ export const vfsCommands = {
|
|||
const spinner = ora('Reading file...').start()
|
||||
|
||||
try {
|
||||
const brain = await getBrainy() // v5.0.1: Await async getBrainy
|
||||
// v5.0.1: VFS auto-initialized, no need for vfs.init()
|
||||
const brain = await getBrainy() // Await async getBrainy
|
||||
// VFS auto-initialized, no need for vfs.init()
|
||||
const buffer = await brain.vfs.readFile(path, {
|
||||
encoding: options.encoding as any
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue