mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Do not assume results key present in notion content when indexing
This commit is contained in:
parent
4977b55106
commit
d5de59d411
1 changed files with 3 additions and 3 deletions
|
@ -100,7 +100,7 @@ class NotionToEntries(TextToEntries):
|
||||||
|
|
||||||
for response in responses:
|
for response in responses:
|
||||||
with timer("Processing response", logger=logger):
|
with timer("Processing response", logger=logger):
|
||||||
pages_or_databases = response["results"] if response.get("results") else []
|
pages_or_databases = response.get("results", [])
|
||||||
|
|
||||||
# Get all pages content
|
# Get all pages content
|
||||||
for p_or_d in pages_or_databases:
|
for p_or_d in pages_or_databases:
|
||||||
|
@ -125,7 +125,7 @@ class NotionToEntries(TextToEntries):
|
||||||
|
|
||||||
current_entries = []
|
current_entries = []
|
||||||
curr_heading = ""
|
curr_heading = ""
|
||||||
for block in content["results"]:
|
for block in content.get("results", []):
|
||||||
block_type = block.get("type")
|
block_type = block.get("type")
|
||||||
|
|
||||||
if block_type == None:
|
if block_type == None:
|
||||||
|
@ -178,7 +178,7 @@ class NotionToEntries(TextToEntries):
|
||||||
return f"\n<b>{heading}</b>\n"
|
return f"\n<b>{heading}</b>\n"
|
||||||
|
|
||||||
def process_nested_children(self, children, raw_content, block_type=None):
|
def process_nested_children(self, children, raw_content, block_type=None):
|
||||||
results = children["results"] if children.get("results") else []
|
results = children.get("results", [])
|
||||||
for child in results:
|
for child in results:
|
||||||
child_type = child.get("type")
|
child_type = child.get("type")
|
||||||
if child_type == None:
|
if child_type == None:
|
||||||
|
|
Loading…
Add table
Reference in a new issue