An open source, non-profit web search engine
Serve the raw index page endpoint on v1 only
Claude38de05cc0383
diff --git a/mwmbl/api.py b/mwmbl/api.pyindex f9c4ffa..06aacf0 100644--- a/mwmbl/api.py+++ b/mwmbl/api.py@@ -177,7 +177,7 @@ def register_routers(ranker, combined_ranker, tiny_index):# Initialise routers that depend on runtime objectssearch_module.init_router(ranker, tiny_index)- search_module.init_v2_router(ranker, tiny_index)+ search_module.init_v2_router(ranker)super_search_module.init_router()combined_search_module.init_router(combined_ranker)crawler_module.init_router()diff --git a/mwmbl/tinysearchengine/search.py b/mwmbl/tinysearchengine/search.pyindex aeb43b6..da1f56b 100644--- a/mwmbl/tinysearchengine/search.py+++ b/mwmbl/tinysearchengine/search.py@@ -479,8 +479,7 @@ def init_router(ranker: HeuristicRanker, tiny_index: TinyIndex):_register_page_route(router, tiny_index)-def init_v2_router(ranker: HeuristicRanker, tiny_index: TinyIndex):+def init_v2_router(ranker: HeuristicRanker):"""Initialise the v2 module-level router (called from urls.py)."""_register_search_v2(v2_router, ranker)_register_common_routes(v2_router, ranker)- _register_page_route(v2_router, tiny_index)diff --git a/test/test_index_page_api.py b/test/test_index_page_api.pyindex 0f78be2..bca703c 100644--- a/test/test_index_page_api.py+++ b/test/test_index_page_api.py@@ -1,4 +1,4 @@-"""GET /api/v{1,2}/search/page/{n}: the raw, decompressed contents of one index page."""+"""GET /api/v1/search/page/{n}: the raw, decompressed contents of one index page."""import pytestfrom django.test import Client@@ -23,9 +23,8 @@ def stored_page():writer.store_in_page(page_index, original)[email protected]("version", ["v1", "v2"])-def test_page_returns_stored_tuples(stored_page, version):- response = Client().get(f"/api/{version}/search/page/{stored_page}")+def test_page_returns_stored_tuples(stored_page):+ response = Client().get(f"/api/v1/search/page/{stored_page}")assert response.status_code == 200expected_tuples = [list(document.as_tuple()) for document in PAGE_DOCUMENTS]diff --git a/test/test_openapi.py b/test/test_openapi.pyindex 5c51f75..524aac0 100644--- a/test/test_openapi.py+++ b/test/test_openapi.py@@ -206,7 +206,6 @@ def test_v2_openapi_spec_generation():"/api/v2/search/","/api/v2/search/complete","/api/v2/search/raw",- "/api/v2/search/page/{n}","/api/v2/super-search/","/api/v2/combined-search/",}