Chroma: text_exists() is always True, so an edited chunk is removed from the index
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 38/100
Direzione di ricerca
Start at ChromaVector.text_exists in the Chroma vector store provider under api/core/rag/datasource/vdb/chroma/, and read the existing unit test that mocks a miss as {} — Chroma's get() returns a dict of result fields even when nothing matches, so the length check never goes to zero. The affected caller is the chunk update path in services/knowledge/segments/indexing.py, which deletes the old node then calls add_texts(..., duplicate_check=True). Done means an empty result is detected correctly, the unit test no longer passes on a fabricated {}, and the Chroma e2e test round-trips the edited chunk. Note the reporter says a fix and PR are already prepared, so check with them before starting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Self Checks
- I have read the Contributing Guide and Language Policy.
- This is only for bug report, if you would like to ask a question, please head to Discussions.
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report, otherwise it will be closed.
- 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- Please do not modify this template :) and fill in all the required fields.
Dify version
main (580416d, api 1.20.0)
Cloud or Self Hosted
Self Hosted (Source)### Steps to reproduce
- Set
VECTOR_STORE=chromaand create a High Quality knowledge base with a document in General mode. - Edit one of its chunks (segments) and save.
- Search the knowledge base (hit testing) for the edited text.
The same thing at the provider level, against ghcr.io/chroma-core/chroma:0.5.20 (the image in docker-compose):
vector.create(texts=[doc], embeddings=[embedding])
vector.text_exists(str(uuid.uuid4())) # True: a random id "exists"
vector.delete_by_ids([doc_id])
vector.text_exists(doc_id) # still True after the delete
✔️ Expected Behavior
text_exists returns False for an id that is not in the collection, and the edited chunk is indexed again and found by search.
❌ Actual Behavior
ChromaVector.text_exists returns len(collection.get(ids=[id])) > 0. Chroma's get() returns a dict with all result fields (ids, documents, metadatas, ...) also when nothing matches, so the length is never 0 and text_exists is always True.
Updating a chunk (services/knowledge/segments/indexing.py) deletes its old node and then calls vector.add_texts(..., duplicate_check=True), which drops every document whose id "exists". With Chroma the edited chunk is therefore never added back: after the edit the collection no longer contains it, and it can't be retrieved. Adding or editing child chunks in parent-child mode goes through the same add_texts(..., duplicate_check=True) call, so those are never indexed either.
The unit test models the miss as an empty dict {}, which Chroma does not return, so it passes with the bug.
I have a fix with tests (unit test plus the Chroma e2e test, which fails on main) and will open a PR.
- Lingua principale
- Python
- Stelle
- 162k
- Fork
- 25.6k
- Merge medio
- 15h 9m
- PR unite (30g)
- 606
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di langgenius/dify
-
OpenSearch: text_exists() queries OpenSearch _id instead of metadata.doc_id, so it always returns False for indexed chunksForse già presa @SanemIzci l’ha presa 1 giorno fa. Aperta🐞 bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
langgenius/dify#47109 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Log only execution identifiers when a workflow worker starts a runForse già presa @kinglegendzzh l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
langgenius/dify#47094 · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Node.js SDK declares a response body for 204 conversation deletionForse già presa @Wang-Zephyr l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
langgenius/dify#46883 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Provider IDs with a trailing newline are silently accepted and propagatedForse già presa @Batianxieshen1 l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
langgenius/dify#46875 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Agent Python SDK polling rejects function-tool results that SSE acceptsForse già presa @EndlessRoad-max l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
langgenius/dify#46868 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di langgenius/dify
Issue simili
-
app: scripts status: backlog type: housekeeping
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
netbox-community/netbox-scripts#239 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
LmeSzinc/AzurLaneAutoScript#6194 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
micronaut-projects/micronaut-core#14585 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
langgenius/graphon#443 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno