Repository navigation
notion: a search from 2025-09-03 on lists each database's data source, as real does - #788
Conversation
Co-authored-by: Mangesh Raut <mangeshraut712@users.noreply.github.com>
nuriyoo
left a comment
There was a problem hiding this comment.
Thank you for this; the unfiltered search now lists each database's data source from 2025-09-03 on, and the data source it lists is the one GET /v1/data_sources/{id} answers. I measured the searches again on 2026-10-17 (api.notion.com, an integration's workspace of three databases and ten pages) and every search this branch changes lists the objects real lists. The suggestions are a comment that also records a query and the shape, and the new test as rows of the table above it.
Two neighbours the body can name rather than call unmeasured. Under 2025-09-03 and 2026-03-11 real refuses a database filter with a 400 validation_error (body.filter.value should be `"page"` or `"data_source"`, instead was `"database"`.), which is #375. And every search from 2025-09-03 on ends with "type":"page_or_data_source", which is #374.
On the suggestion tree the whole suite passes (10326, 2 skipped: Docker and the HubSpot reader), and 12 of the 15 mutations generated from the diff fail a test. The three left: swapping the two operands of render_data_source, which gives the same value; dropping want in (None, "data_source"), which only changes the database filter under 2025-09-03, a request real refuses; and query.strip(), on a line this PR does not touch.
…s own GET The comment on `search` records that the `data_source` filter, an unfiltered search and a `query` list each database as a database before 2025-09-03 and as its data source from it, in the shape the object's own `GET` answers less `request_id`, with the 2026-10-17 measurement. The new test's rows join the table above it, with a `query` row, and every row's object is compared with its own `GET`; the four-row filter test they replace goes.
nuriyoo
left a comment
There was a problem hiding this comment.
Thank you, @mangeshraut712. The unfiltered search now lists each database's data source from 2025-09-03 on, and the object it lists is the one GET /v1/data_sources/{id} answers.
I finished it with a maintainer commit (b8a0a2f) from the review: the comment on search records the query case and the shape with the 2026-10-17 measurement, and the search rows are one table that checks every listed object against its own GET. The Notion tests pass on the branch updated with main, and CI is green.
What changed
An unfiltered
POST /v1/searchfromNotion-Version2025-09-03 on lists each database as its data source, the objectGET /v1/data_sources/{id}already returns, and lists nodatabaseobject.2022-06-28still lists databases. Adatabaseobject filter is unchanged, because that filter under the newer versions is not in the measurement. Closes #722.Why this is what the real API does
Measured against api.notion.com on 2026-10-14, recorded in #722:
POST /v1/searchwith{}returnspageanddatabaseunder2022-06-28, andpageanddata_sourceunder2025-09-03and2026-03-11. Each data source is that database's own, in the shapeGET /v1/data_sources/{id}answers less itsrequest_id. A{"filter":{"property":"object","value":"data_source"}}search already listed data sources; an unfiltered search on those versions now uses that same object.Verification
Tests —
uv sync --all-extras --locked, thenuv pip install --no-deps "llama-index-readers-hubspot<0.6", thenuv run --no-sync pytest -rs:10326 passed, 1 skipped, 5 warnings in 113.88s. The skip istests/test_mcp.py:154: Docker not available.test_notion_unfiltered_search_lists_a_database_in_the_versions_shapefailed on2025-09-03and2026-03-11before this change and passes after it;2022-06-28passed before and after.Optional surfaces that ran rather than skipped — official SDK, llama-index, MCP (except the Docker case), mirage, and fsspec extras are installed, and those tests ran.
Lint —
ruff check .printedAll checks passed!.ruff format --check .printed159 files already formatted.ruff check --preview --select PLW1514 .printedAll checks passed!.python scripts/prose_check.py upstream/mainexited 0.backlot diff --source notionprinted56 divergence(s) · 56 acknowledged · 0 new, so the Notion baseline is unchanged.A test fails without this change
A new endpoint serving corpus content is ACL-scoped, proved for both an admin and a scoped token — no new endpoint; search still returns only documents the caller can see
Comments state what was measured, not the history of the fix