DVSemanticIndex<T> class

Semantic search over one model.

Constructors

DVSemanticIndex({required String name, required DVEmbedder? embedder, required DVVectorAdapter vectors, required String idOf(T record), required Map<String, String Function(T record)> fields, required Future<T?> load(String id), String? tenantOf(T record)?, Map<String, String> attributesOf(T record)?, FutureOr<bool> canSee(T record)?, DVSearchProvider<T, Object?>? keyword, Map<String, Object?> toJson(T record)?, List<DVEmbedder> previousEmbedders = const <DVEmbedder>[], DVChunking chunking = const DVChunking(), Set<String> sensitiveFields = const <String>{}, DVQueues queues = const DVQueues(), String queue = 'semantic', int maxAttempts = 3, int refillMultiple = 4, DVSemanticMetering? metering})

Properties

attributesOf → Map<String, String> Function(T record)?
Values a query may filter on.
final
canSee → FutureOr<bool> Function(T record)?
The policy check a result must pass — the same one find uses, so a search can never return a row a lookup would refuse.
final
chunking → DVChunking
final
embedder → DVEmbedder
final
fields → Map<String, String Function(T record)>
The semantic fields, by name.
final
generation → String
The generation this index's embedder and chunking build.
no setter
hashCode → int
The hash code for this object.
no setterinherited
idOf → String Function(T record)
final
keyword → DVSearchProvider<T, Object?>?
The keyword index, for keyword and hybrid modes.
final
load → Future<T?> Function(String id)
Loads a record by id, so a result is always the record as it is now.
final
maxAttempts → int
final
metering → DVSemanticMetering?
final
name → String
The model's name, which prefixes every generation's name.
final
previousEmbedders → List<DVEmbedder>
Embedders of earlier generations, so a rebuilding index can keep answering from the generation still active.
final
queue → String
final
queues → DVQueues
final
refillMultiple → int
How far past the requested page a refill may look, as a multiple of it.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sensitiveFields → Set<String>
final
tenantOf → String? Function(T record)?
The record's tenant. Non-null makes the index tenant-scoped.
final
toJson → Map<String, Object?> Function(T record)?
The record as data, for retrieve.
final
vectors → DVVectorAdapter
final

Methods

absentRecords() → Future<List<String>>
Records whose embedding job dead-lettered, and so are absent from the index (DV-SEMANTIC-004, reported once per record).
backfill(Iterable<T> records, {bool complete = false}) → Future<DVSemanticBackfill>
Embeds records into this index's generation, skipping records a previous run already did, so a failure part-way resumes rather than re-embedding — and re-paying for — the records before it.
indexed(T record) → Future<void>
Enqueues record for embedding. Nothing is embedded inline: an embedder is a rate-limited network call, and a save that waits on one is a timeout during somebody else's outage.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query(String text, {DVSearchMode mode = DVSearchMode.keyword, int limit = 10, Map<String, String> where = const <String, String>{}}) → Future<DVSemanticPage<T>>
Searches the index. where holds conditions on attributesOf's values, pushed into the vector query where the adapter can filter.
removed(String recordId) → Future<void>
Enqueues removal of a record's vectors.
retrieve(String question, {int limit = 8, DVSearchMode mode = DVSearchMode.semantic, Map<String, String> where = const <String, String>{}}) → Future<DVSemanticRetrieval<T>>
The rows an AI feature needs, filtered by the caller's own policies and without sensitive fields.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

resetRegistry() → void
Forgets every registered index. Tests use this.