KnowledgeIndex class

Synchronizes one bundle and searches an explicit eligible concept set.

The caller owns the store and embedder. Synchronization must not overlap searches on this instance. Separate instances should coordinate writes to the same bundle. Dense scoring is exact after eligibility filtering; ObjectBox supplies indexed vector reads rather than a post-filtered ANN pool.

Constructors

KnowledgeIndex({required BaseStore store, required BaseEmbedder embedder, bool includeContext = false, Future<int> countTokens(String)?, int? maxTokens, String? bundleRoot})
KnowledgeIndex.fromSnapshot({required KnowledgeSnapshot snapshot, required BaseStore store, required BaseEmbedder embedder, bool includeContext = false, String? bundleRoot})
Opens the snapshot and store from the same completed index generation.

Properties

bundleRoot → String?
The bundle's directory on disk, where a source path that leaves the bundle, such as ../../lib/billing.dart, is looked up. Without it such a path is never reported as KnowledgeNoticeCode.unresolvedSource: the snapshot alone cannot tell whether it exists.
final
countTokens → Future<int> Function(String)?
final
embedder → BaseEmbedder
final
embeddingModelName → String
no setter
hashCode → int
The hash code for this object.
no setterinherited
includeContext → bool
final
maxTokens → int?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
store → BaseStore
final

Methods

contextForMatches(Iterable<SearchResult> ranked, {KnowledgeSearchPolicy? policy, int limit = 5, int? contextLimit}) → KnowledgeSearchResponse
Applies the same eligibility and context policy to externally ranked hits. Unknown or excluded chunk IDs are ignored. Scores do not establish authority.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
Ranks the eligible passages by their similarity to query and adds the policy's context.
synchronize(KnowledgeSnapshot input, {void onEmbedded(int embedded, int total)?, WayfinderCancellation? cancel}) → Future<({int embeddedChunks, int removedChunks, int writtenChunks})>
Embeds missing/changed inputs before one atomic replacement. Failed loads or inference leave the prior store/index usable. Other bundles are retained.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited