Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix bug in hierarchical_merge function (#4006)

Luo Pan68d46b2a1e3e
diff --git a/rag/nlp/__init__.py b/rag/nlp/__init__.py
index 2aaf98aab0..eb529f68b5 100644
--- a/rag/nlp/__init__.py
+++ b/rag/nlp/__init__.py
@@ -466,7 +466,7 @@ def hierarchical_merge(bull, sections, depth):
jj = binary_search(levels[ii], j)
if jj < 0:
continue
- if jj > cks[-1][-1]:
+ if levels[ii][jj] > cks[-1][-1]:
cks[-1].pop(-1)
cks[-1].append(levels[ii][jj])
for ii in cks[-1]: