fix: flush all native providers on shutdown to prevent data loss
Shutdown/close/flush now properly flushes all 4 components in parallel: metadataIndex, graphIndex, HNSW dirty nodes, and storage counts. Previously only counts were flushed, causing native provider data loss on restart. Also: - Wire roaring, msgpack, entityIdMapper provider consumption from plugins - Fix allOf filter O(n²) intersection → O(n) Set-based - Fix ne/exists negation filter to use Set-based exclusion - Add setMsgpackImplementation() swap in SSTable for native msgpack - Add setRoaringImplementation() swap for native CRoaring bitmaps - Add getAllIntIds() to EntityIdMapper for bitmap operations - Remove TypeAwareHNSWIndex from default index creation path - Export memory detection utilities from internals - Clean up 26 permanently-skipped dead tests
This commit is contained in:
parent
b87426409d
commit
773c5171c3
24 changed files with 297 additions and 1268 deletions
|
|
@ -681,12 +681,18 @@ export class HNSWIndex {
|
|||
queryVector: Vector,
|
||||
k: number = 10,
|
||||
filter?: (id: string) => Promise<boolean>,
|
||||
options?: { rerank?: { multiplier: number } }
|
||||
options?: { rerank?: { multiplier: number }; candidateIds?: string[] }
|
||||
): Promise<Array<[string, number]>> {
|
||||
if (this.nouns.size === 0) {
|
||||
return []
|
||||
}
|
||||
|
||||
// Metadata-first: convert candidateIds to filter function if no explicit filter
|
||||
if (!filter && options?.candidateIds && options.candidateIds.length > 0) {
|
||||
const candidateSet = new Set(options.candidateIds)
|
||||
filter = async (id: string) => candidateSet.has(id)
|
||||
}
|
||||
|
||||
// Check if query vector is defined
|
||||
if (!queryVector) {
|
||||
throw new Error('Query vector is undefined or null')
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ export class TypeAwareHNSWIndex {
|
|||
k: number = 10,
|
||||
type?: NounType | NounType[],
|
||||
filter?: (id: string) => Promise<boolean>,
|
||||
options?: { rerank?: { multiplier: number } }
|
||||
options?: { rerank?: { multiplier: number }; candidateIds?: string[] }
|
||||
): Promise<Array<[string, number]>> {
|
||||
// Single-type search (fast path)
|
||||
if (type && typeof type === 'string') {
|
||||
|
|
@ -288,7 +288,7 @@ export class TypeAwareHNSWIndex {
|
|||
k: number,
|
||||
types: NounType[],
|
||||
filter?: (id: string) => Promise<boolean>,
|
||||
options?: { rerank?: { multiplier: number } }
|
||||
options?: { rerank?: { multiplier: number }; candidateIds?: string[] }
|
||||
): Promise<Array<[string, number]>> {
|
||||
const allResults: Array<[string, number]> = []
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ export class TypeAwareHNSWIndex {
|
|||
queryVector: Vector,
|
||||
k: number,
|
||||
filter?: (id: string) => Promise<boolean>,
|
||||
options?: { rerank?: { multiplier: number } }
|
||||
options?: { rerank?: { multiplier: number }; candidateIds?: string[] }
|
||||
): Promise<Array<[string, number]>> {
|
||||
const allResults: Array<[string, number]> = []
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue