Skip to content

armgit / mwmbl

Public Imported from GitHub
0

An open source, non-profit web search engine

Label Staan's results "eusp" in the API

Daoud Clarke70689c04fed1
diff --git a/mwmbl/api.py b/mwmbl/api.py
index 951bc56..71e6055 100644
--- a/mwmbl/api.py
+++ b/mwmbl/api.py
@@ -12,7 +12,7 @@ Sub-routers (v1):
Sub-routers (v2):
/api/v2/search/ — full-text search with optional API-key auth and quota info
/api/v2/super-search/ — multi-source streaming search (SSE), authenticated
- /api/v2/combined-search/ — Mwmbl + Staan + Wikipedia in one ranked response, authenticated
+ /api/v2/combined-search/ — Mwmbl + EUSP + Wikipedia in one ranked response, authenticated
JWT token endpoints (from NinjaJWTDefaultController) are registered on v1,
typically at /api/v1/platform/token/pair, /api/v1/platform/token/refresh, etc.
diff --git a/mwmbl/format.py b/mwmbl/format.py
index bcc2d8b..ec61be5 100644
--- a/mwmbl/format.py
+++ b/mwmbl/format.py
@@ -18,7 +18,9 @@ DOCUMENT_SOURCES = {
# asserts the map is complete rather than leaving that to a KeyError in a response.
DOCUMENT_PROVIDERS = {
DocumentSource.WIKIPEDIA: "wikipedia",
- DocumentSource.STAAN: "staan",
+ # Staan's results go out as "eusp" (European Search Perspective): the label our
+ # agreement with the provider requires, so it deliberately differs from the enum name.
+ DocumentSource.STAAN: "eusp",
}
diff --git a/mwmbl/tinysearchengine/combined_search.py b/mwmbl/tinysearchengine/combined_search.py
index 00aac26..8e5f756 100644
--- a/mwmbl/tinysearchengine/combined_search.py
+++ b/mwmbl/tinysearchengine/combined_search.py
@@ -44,15 +44,15 @@ router = Router(tags=["Combined Search"])
DESCRIPTION = (
- "Search the Mwmbl index, Staan and Wikipedia in one request and return the ranked "
+ "Search the Mwmbl index, EUSP (European Search Perspective) and Wikipedia in one request and return the ranked "
"union.\n\n"
- "Every candidate - crawled by Mwmbl, returned by Staan, or fetched from Wikipedia - is "
+ "Every candidate - crawled by Mwmbl, returned by EUSP, or fetched from Wikipedia - is "
"scored by one learning-to-rank model trained on the pooled candidate set, then "
"diversified so a single domain cannot take the whole page. The response is the same "
"SearXNG-compatible shape as `/api/v2/search/`.\n\n"
"The `engine` field names the provider a result came from:\n"
"- `mwmbl` - organically crawled by the Mwmbl crawler\n"
- "- `staan` - returned by the Staan web-search API\n"
+ "- `eusp` - returned by the European Search Perspective (EUSP) web-search API\n"
"- `wikipedia` - fetched from Wikipedia\n"
"- `google`, `user` - originally suggested via Google, or submitted by a user\n\n"
"Authentication is required: a search-scoped API key in `X-API-Key`, or a JWT bearer "
@@ -94,7 +94,7 @@ def init_router(ranker) -> None:
# Handled manually in the view so both an API key and a JWT work under an async
# view - the same reason Super Search does it this way.
auth=None,
- summary="Combined Search (Mwmbl + Staan + Wikipedia)",
+ summary="Combined Search (Mwmbl + EUSP + Wikipedia)",
description=DESCRIPTION,
openapi_extra=OPENAPI_EXTRA,
)
diff --git a/test/test_combined_search.py b/test/test_combined_search.py
index 11df5fa..40e6500 100644
--- a/test/test_combined_search.py
+++ b/test/test_combined_search.py
@@ -217,7 +217,7 @@ def test_each_result_names_the_provider_it_came_from(client, api_key, fresh_quot
results = _get(client, api_key).json()["results"]
- assert [result["engine"] for result in results] == ["mwmbl", "staan", "wikipedia"]
+ assert [result["engine"] for result in results] == ["mwmbl", "eusp", "wikipedia"]
@pytest.mark.django_db
diff --git a/test/test_format.py b/test/test_format.py
index 46d9729..9f5ffcf 100644
--- a/test/test_format.py
+++ b/test/test_format.py
@@ -28,9 +28,9 @@ def test_an_external_provider_names_itself():
because it never enters the index."""
result = Document("Tokio", "https://tokio.rs/", "An async runtime.", source=DocumentSource.STAAN)
- assert get_result_source(result) == "staan"
- assert format_result(result, "tokio")["source"] == "staan"
- assert format_result_v2(result, 1, "tokio")["engine"] == "staan"
+ assert get_result_source(result) == "eusp"
+ assert format_result(result, "tokio")["source"] == "eusp"
+ assert format_result_v2(result, 1, "tokio")["engine"] == "eusp"
def test_a_document_with_no_source_still_answers_from_its_state():
diff --git a/test/test_openapi.py b/test/test_openapi.py
index c295418..524aac0 100644
--- a/test/test_openapi.py
+++ b/test/test_openapi.py
@@ -222,5 +222,8 @@ def test_combined_search_is_documented():
assert operation["responses"]["200"]["content"]["application/json"]["schema"] == {
"$ref": "#/components/schemas/SearchResponse"
}
- for expected in ("X-API-Key", "monthly_limit", "staan", "wikipedia"):
+ for expected in ("X-API-Key", "monthly_limit", "eusp", "wikipedia"):
assert expected in operation["description"]
+ # The provider agreement labels its results EUSP; its own name stays out of the public docs.
+ assert "staan" not in operation["description"].lower()
+ assert "staan" not in operation["summary"].lower()