You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Model indexes: OnIndexBuildFailure(Skip | Throw) and a public RebuildIndexAsync(name) #190
Since #175, a model-declared index (HasIndex / HasVectorIndex / HasSpatialIndex) added over existing documents is filled when the context opens. If a document can't be indexed (a vector dimension mismatch, or, with #176, a unique index over duplicates), the open throws and nothing is saved. Every later open fails the same way until the data is fixed or the index is removed from OnModelCreating, so the app can't recover without a code change.
OnIndexBuildFailure(IndexBuildFailure.Skip | IndexBuildFailure.Throw), per index on the ModelBuilder or as a context-wide default. Throw is today's behaviour and the default. Skip builds the index from the documents that can be indexed. It needs a way to report what was left out (a log/metrics event or a list of ids), and a rule for what happens when such a document is later updated.
A public DocumentCollection.RebuildIndexAsync(string name, CancellationToken ct = default) that rebuilds one index from the documents through the swap-after-commit path from fix(vacuum): rebuild typed-collection indexes into fresh trees (#167) #170 (CreateUnregisteredCopy / ReplaceIndex). After fixing the data, an app can rebuild without a full VacuumAsync(RebuildIndexes = true).
Open questions: should Skip cover unique-constraint violations as well as values that can't be indexed? And should later writes to a skipped document fail, or be skipped too?
Activity