notion-sdk-py: Search does not return root page, when root is not a workpace parent level page
This is weird. I think this is a problem with Notion API and not this library. But opening this issue, so that it can be closed when this is solved.
Problem
Suppose I create a page “my page name”, and add my integration to this page, then
notion.search(query="my page name")
will not give this page.
If I query for any subpage/database in this page/page within a database on this page, I will get it successfully.
Steps to reproduce
Create a new integration named “Issue32Inti”.
Duplicate this page https://www.notion.so/aahnik/notion-sdk-py-540f8e2b79914654ba103c5d8a03e10e and [update]* put it inside a parent level page .share this with your integration.
Note: the page should be a subpage. Not a parent-level page. ie, it should be inside a parent page.
Now, Initialize your client object notion
.
Root page
obj = notion.search(query="notion-sdk-py") # root page
Result ❌
{ 'object': 'list',
'results': [],
'next_cursor': None,
'has_more': False,
}
Database
obj = notion.search(query="People") # database
Result ✅
{ 'object': 'list',
'results': [{'object': 'database',
'id': '99572135-4646-49bd-95a1-4ff08f79c7a5',
'created_time': '2021-05-19T04:50:21.634Z',
'last_edited_time': '2021-05-19T04:57:00.000Z',
'title': [{'type': 'text',
'text': {'content': 'People', 'link': None},
'annotations': {'bold': False,
'italic': False,
'strikethrough': False,
'underline': False,
'code': False,
'color': 'default'},
'plain_text': 'People',
'href': None}],
'properties': {'Tags': {'id': 'EcDa',
'type': 'multi_select',
'multi_select': {'options': [{'id': '2cd67f95-2f58-4223-bc0a-de03bf87c1e2',
'name': 'python',
'color': 'default'},
{'id': 'f2ae0eef-5611-4da8-97e0-9208ecec44c1',
'name': 'expert',
'color': 'blue'},
{'id': '573d40b5-42bd-4035-815d-73fc4aa7d208',
'name': 'learner',
'color': 'purple'}]}},
'Website': {'id': 'Z{nX', 'type': 'url', 'url': {}},
'GitHub': {'id': '`<Mi', 'type': 'rich_text', 'rich_text': {}},
'Name': {'id': 'title', 'type': 'title', 'title': {}}}}],
'next_cursor': None,
'has_more': False}
Subpage
obj = notion.search(query="Subpage 1") # subpage
Result ✅
{ 'object': 'list',
'results': [{'object': 'page',
'id': '4e8705d7-e6a5-4b23-853f-3b2fcc9f18fe',
'created_time': '2021-05-19T04:45:47.349Z',
'last_edited_time': '2021-05-19T04:49:00.000Z',
'parent': {'type': 'page_id',
'page_id': '540f8e2b-7991-4654-ba10-3c5d8a03e10e'},
'archived': False,
'properties': {'title': {'id': 'title',
'type': 'title',
'title': [{'type': 'text',
'text': {'content': 'Subpage 1', 'link': None},
'annotations': {'bold': False,
'italic': False,
'strikethrough': False,
'underline': False,
'code': False,
'color': 'default'},
'plain_text': 'Subpage 1',
'href': None}]}}}],
'next_cursor': None,
'has_more': False}
[update] means that portion was later edited.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (8 by maintainers)
Now when i moved “notion-sdk-py” page into not shared one I also getting empty results now. May be we should issue Notion support with this.