mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-10 13:15:18 +02:00
More notion testing
This commit is contained in:
@@ -245,7 +245,7 @@ class NotionConnector(LoadConnector, PollConnector):
|
|||||||
filtered_pages += [NotionPage(**page)]
|
filtered_pages += [NotionPage(**page)]
|
||||||
return filtered_pages
|
return filtered_pages
|
||||||
|
|
||||||
def _recursive_load(self):
|
def _recursive_load(self) -> Generator[list[Document], None, None]:
|
||||||
if self.root_page_id is None or not self.recursive_index_enabled:
|
if self.root_page_id is None or not self.recursive_index_enabled:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Recursive page lookup is not enabled, but we are trying to "
|
"Recursive page lookup is not enabled, but we are trying to "
|
||||||
@@ -275,7 +275,6 @@ class NotionConnector(LoadConnector, PollConnector):
|
|||||||
# TODO: remove once Notion search issue is discovered
|
# TODO: remove once Notion search issue is discovered
|
||||||
if self.recursive_index_enabled and self.root_page_id:
|
if self.recursive_index_enabled and self.root_page_id:
|
||||||
yield from self._recursive_load()
|
yield from self._recursive_load()
|
||||||
return
|
|
||||||
|
|
||||||
query_dict = {
|
query_dict = {
|
||||||
"filter": {"property": "object", "value": "page"},
|
"filter": {"property": "object", "value": "page"},
|
||||||
@@ -302,7 +301,6 @@ class NotionConnector(LoadConnector, PollConnector):
|
|||||||
# TODO: remove once Notion search issue is discovered
|
# TODO: remove once Notion search issue is discovered
|
||||||
if self.recursive_index_enabled and self.root_page_id:
|
if self.recursive_index_enabled and self.root_page_id:
|
||||||
yield from self._recursive_load()
|
yield from self._recursive_load()
|
||||||
return
|
|
||||||
|
|
||||||
query_dict = {
|
query_dict = {
|
||||||
"page_size": self.batch_size,
|
"page_size": self.batch_size,
|
||||||
@@ -331,6 +329,6 @@ if __name__ == "__main__":
|
|||||||
{"notion_integration_token": os.environ.get("NOTION_INTEGRATION_TOKEN")}
|
{"notion_integration_token": os.environ.get("NOTION_INTEGRATION_TOKEN")}
|
||||||
)
|
)
|
||||||
document_batches = connector.load_from_state()
|
document_batches = connector.load_from_state()
|
||||||
batch = next(document_batches)
|
for doc_batch in document_batches:
|
||||||
for doc in batch:
|
for doc in doc_batch:
|
||||||
print(doc)
|
print(doc)
|
||||||
|
Reference in New Issue
Block a user