Fixed
upsert_document()'s docstring claimed writes were idempotent and safe to re-run, which was false for two real reasons:- Weight-doubling: re-upserting identical content doubled
CONTAINSedge weight every call. - Stale entities: re-upserting changed content left old
CONTAINSedges to no-longer-mentioned entities in place forever.
- Weight-doubling: re-upserting identical content doubled
- Fixed by deleting a document's existing
CONTAINSedges before rewriting them per upsert. Safe becauseCONTAINSis a clean 1:1 document-to-entity link.
Known limitation (deliberately not fixed here)
CO_OCCURS_WITH/RELATES_AShave the same weight-doubling bug but aren't touched — those edges aggregate weight across multiple different documents by design, and there's no per-document contribution tracking yet to fix it safely. Needs a real schema addition, tracked as upcoming 0.6.0 work.
Verified
- Both bugs reproduced live before any code changed. Full suite re-run: 78 passed, 1 skipped (unrelated), zero regressions.
PyPI: https://pypi.org/project/ragleap-graph/0.5.4/
Full CHANGELOG: https://github.com/antonyrag/ragleap-core/blob/main/packages/ragleap-graph/CHANGELOG.md