infiniflow / infiniflow/ragflow
Retrieval with an empty metadata_condition.conditions list returns zero chunks (Pyt[Bug]:
- Dominant language
- Go
- Stars
- 91k
- Forks
- 10.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 705
Description
### Self Checks
- [x] I have searched for existing issues [search for existing issues](https://github.com/infiniflow/ragflow/issues), including closed ones.
- [x] I confirm that I am using English to submit this report ([Language Policy](https://github.com/infiniflow/ragflow/issues/5910)).
- [x] Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) ([Language Policy](https://github.com/infiniflow/ragflow/issues/5910)).
- [x] Please do not modify this template :) and fill in all the required fields.
### RAGFlow workspace code commit ID
6de46a2
### RAGFlow image version
nightly
### Other environment information
```Markdown
```
### Actual behavior
Zero chunks come back whenever metadata_condition is present with an empty conditions list, and an explicit document_ids list is intersected away. Verified by driving the real retrieval_test handler with stubbed services: the retriever received doc_ids=["-999"] (or [] dropping the caller's ids) instead of None / the caller's ids.
### Expected behavior
An empty conditions list means no metadata filtering: the search runs unfiltered (doc_ids=None), and explicit document_ids are passed through - matching the Go search service.
### Steps to reproduce
```Markdown
1. POST /api/v1/retrieval with dataset_ids, a question, and metadata_condition {"conditions": [], "logic": "and"} (an empty conditions list is what a programmatic client produces when no filters are configured).
2. The route scopes the search to the nonexistent document "-999" and returns {"total": 0, "chunks": []}.
3. The Go search service (internal/service/metadata_filter.go, manual branch) returns the base doc ids unchanged for an empty manual filter, so the same request against the Go server returns the unfiltered results. The same mismatch applies when document_ids is given: Python intersects them away, Go keeps them.
```
### Additional information
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the real retrieval_test handler and compare its metadata_condition handling with internal/service/metadata_filter.go, especially the empty manual-filter branch. Reproduce the POST /api/v1/retrieval request using an empty conditions list and explicit document_ids. Done means empty conditions leave the search unfiltered and explicit document IDs are preserved, matching the Go search service.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, python
- Domain
- api, backend, search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100