openGauss vector store ignores document_ids_filter, so metadata filtering returns chunks from other documents
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
Research direction
The filter is dropped in the openGauss vector store provider: OpenGauss.search_by_vector and OpenGauss.search_by_full_text accept document_ids_filter but never apply it, while pgvector's provider does. Start by reading the openGauss provider under api/core/rag/datasource/vdb/ alongside its pgvector counterpart, then look at how DatasetRetrieval builds the filter. Reproduce with the two-document example in the report and confirm filtered searches return only matching chunks; note that a fix PR (#46990) is already open.
Written by the indexing model from the issue text.
Description
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=opengauss. - Create a knowledge base with two documents and give them different metadata, for example
category = aandcategory = b. - In a Knowledge Retrieval node, add the metadata filter
category is aand query a phrase that appears in both documents.
The same thing at the provider level, against opengauss/opengauss:7.0.0-RC1 (the image in docker-compose):
vector = OpenGauss(collection_name="test", config=config)
vector.create(texts=[doc_a, doc_b], embeddings=[embedding, embedding]) # different metadata["document_id"]
vector.search_by_vector(embedding, top_k=10, document_ids_filter=[doc_a.metadata["document_id"]])
vector.search_by_full_text("test_text", top_k=10, document_ids_filter=[doc_a.metadata["document_id"]])
✔️ Expected Behavior
Only chunks of the documents that match the filter are returned, as with pgvector.
❌ Actual Behavior
Chunks of the other document are returned too. DatasetRetrieval passes the ids of the matching documents as document_ids_filter, but OpenGauss.search_by_vector and OpenGauss.search_by_full_text never read that argument, so the filter has no effect on openGauss. In a check with 4 documents of 3 chunks each, filtering on 2 documents returned 10 chunks from all 4, and a full-text search filtered on one document returned all 12 matches.
I have a fix with tests and will open a PR.
- Dominant language
- Python
- Stars
- 162k
- Forks
- 25.6k
- Avg merge
- 15h 9m
- Merged PRs (30d)
- 606
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from langgenius/dify
-
OpenSearch: text_exists() queries OpenSearch _id instead of metadata.doc_id, so it always returns False for indexed chunksPossibly taken @SanemIzci claimed this 1 day ago. Open🐞 bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
langgenius/dify#47109 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Log only execution identifiers when a workflow worker starts a runPossibly taken @kinglegendzzh claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langgenius/dify#47094 · 2 reactions ·
Maintainers usually reply within 1 day
-
Node.js SDK declares a response body for 204 conversation deletionPossibly taken @Wang-Zephyr claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
langgenius/dify#46883 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Provider IDs with a trailing newline are silently accepted and propagatedPossibly taken @Batianxieshen1 claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
langgenius/dify#46875 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Agent Python SDK polling rejects function-tool results that SSE acceptsPossibly taken @EndlessRoad-max claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
langgenius/dify#46868 · 1 reaction ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
micronaut-projects/micronaut-core#14585 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
langgenius/graphon#443 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
[BUG]: Management endpoints /v1/memory/stats and /v1/memory/counts bypass API key authenticationOpen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
docling-project/docling-serve#788 ·
Maintainers usually reply within 1 day
-
Mend: dependency security vulnerability untriaged
Difficulty 1/5 Under an hour Newbie friendliness 78/100
opensearch-project/cross-cluster-replication#1805 ·
Maintainers usually reply within 1 day