mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### Related Issue: https://github.com/infiniflow/ragflow/issues/6741 ### Environment: Using nightly version Commit version: [[6051abb](6051abb4a3)] ### Bug Description: The retrieval function in rag/nlp/search.py returns the original total chunks number even after chunks are filtered by similarity_threshold. This creates inconsistency between the actual returned chunks and the reported total. ### Changes Made: Added code to count how many search results actually meet or exceed the configured similarity threshold Positioned the calculation after the doc_ids conditional logic to ensure special cases are handled correctly Updated the ranks["total"] value to store this filtered count instead of using the raw search result count Using NumPy leverages optimized C-level batch operations to optimize speed