diff --git a/readthedocs/proxito/tests/test_hosting.py b/readthedocs/proxito/tests/test_hosting.py index cbfaf346da4..fb3569d18e2 100644 --- a/readthedocs/proxito/tests/test_hosting.py +++ b/readthedocs/proxito/tests/test_hosting.py @@ -119,6 +119,16 @@ def test_get_config(self): "filepath": "/docs/index.rst", }, }, + "search": { + "api_endpoint": "/_/api/v3/search/", + "default_filter": "subprojects:project/latest", + "filters": [ + ["Search only in this project", "project:project/latest"], + ["Search subprojects", "subprojects:project/latest"], + ], + "project": "project", + "version": "latest", + }, }, } assert r.json() == expected diff --git a/readthedocs/proxito/views/hosting.py b/readthedocs/proxito/views/hosting.py index f6cbd4c673b..2ed7ef4fb88 100644 --- a/readthedocs/proxito/views/hosting.py +++ b/readthedocs/proxito/views/hosting.py @@ -115,6 +115,23 @@ def get(self, request): "filepath": "/docs/index.rst", }, }, + "search": { + "project": project.slug, + "version": version.slug, + "api_endpoint": "/_/api/v3/search/", + # TODO: figure it out where this data comes from + "filters": [ + [ + "Search only in this project", + f"project:{project.slug}/{version.slug}", + ], + [ + "Search subprojects", + f"subprojects:{project.slug}/{version.slug}", + ], + ], + "default_filter": f"subprojects:{project.slug}/{version.slug}", + }, }, }