Skip to content

Commit

Permalink
Fix notion recursive search for blocks with children
Browse files Browse the repository at this point in the history
  • Loading branch information
Weves committed Nov 3, 2023
1 parent 329824a commit 174f544
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions backend/danswer/connectors/notion/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,15 @@ def _read_blocks(
text = rich_text["text"]["content"]
cur_result_text_arr.append(text)

if result["has_children"] and result_type == "child_page":
child_pages.append(result_block_id)
if result["has_children"]:
if result_type == "child_page":
child_pages.append(result_block_id)
else:
subblock_result_lines, subblock_child_pages = self._read_blocks(
result_block_id
)
result_lines.extend(subblock_result_lines)
child_pages.extend(subblock_child_pages)

cur_result_text = "\n".join(cur_result_text_arr)
if cur_result_text:
Expand Down

1 comment on commit 174f544

@vercel
Copy link

@vercel vercel bot commented on 174f544 Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.