From adc8e35509c0a01cafe9d495da013941e5ea81c6 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 15 Jul 2021 22:45:42 -0700 Subject: [PATCH] Use ?_nofacet=1, closes #76 --- datasette_graphql/utils.py | 4 +++- tests/test_graphql.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/datasette_graphql/utils.py b/datasette_graphql/utils.py index 8f2e135..4895f6a 100644 --- a/datasette_graphql/utils.py +++ b/datasette_graphql/utils.py @@ -534,7 +534,9 @@ async def resolve_table( if kwargs.get(pk) is not None: pairs.append([pk, kwargs[pk]]) - qs = {} + qs = { + "_nofacet": 1, + } qs.update(pairs) if after: qs["_next"] = after diff --git a/tests/test_graphql.py b/tests/test_graphql.py index 42c8548..460beb7 100644 --- a/tests/test_graphql.py +++ b/tests/test_graphql.py @@ -546,7 +546,7 @@ async def test_time_limit_ms(db_path): assert len(response_json["errors"]) == 1 assert response_json["errors"][0]["message"].startswith("Time limit exceeded: ") assert response_json["errors"][0]["message"].endswith( - " > 0.1ms - /test/repos.json?_size=10&_search=dogspotter" + " > 0.1ms - /test/repos.json?_nofacet=1&_size=10&_search=dogspotter" ) @@ -591,7 +591,7 @@ async def test_num_queries_limit(db_path): }, "errors": [ { - "message": "Query limit exceeded: 3 > 2 - /test/repos.json?_size=10&owner=2", + "message": "Query limit exceeded: 3 > 2 - /test/repos.json?_nofacet=1&_size=10&owner=2", "locations": [{"line": 7, "column": 17}], "path": ["users", "nodes", 1, "repos_list"], }