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
Deleting a crate's structural index removes entities other crates share #35
An entity's id is its primary key, so when several crates contain the same entity (for example https://github.com/Language-Research-Technology/crate-o), only the first crate to be indexed stores it. StructuralIndexer.index sets rootCollection to that crate, and every later crate's prisma.entity.create fails with a duplicate-key error, which is logged as "Error indexing entity" and skipped (src/indexer/structural.ts).
StructuralIndexer.delete(crateId) deletes by rootCollection, so deleting the first crate's index removes the shared entity (and its file) for every crate. The other crates have no copy until one of them is reindexed.
This predates the admin pages, but the admin pages' Delete action (#32) makes it easy to hit.
Reproduce
Index two crates that both contain the same entity.
Delete the index of whichever was indexed first.
The entity is gone from the structural index, though the second crate still references it.
Expected
Deleting one crate's index leaves entities that other indexed crates still contain.
Possible directions: track which crates contain each entity (a join table) and delete an entity only when no crate is left; or reindex the remaining owners after a delete. Needs a design decision.
Activity