From edc5900726ea1f9f9d9d93d0cf9bf2706233b339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Mon, 18 Aug 2025 19:28:57 +0200 Subject: [PATCH] fix map search --- apps/api/src/controllers/v2/map.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/api/src/controllers/v2/map.ts b/apps/api/src/controllers/v2/map.ts index f7e8b8d8b..d5f0956bc 100644 --- a/apps/api/src/controllers/v2/map.ts +++ b/apps/api/src/controllers/v2/map.ts @@ -227,11 +227,19 @@ export async function getMapResults({ } } - mapResults = mapResults.concat(searchResults.flat().map(x => ({ - url: x.url, - title: x.title, - description: x.description, - }))); + if (search) { + mapResults = searchResults.flat().map(x => ({ + url: x.url, + title: x.title, + description: x.description, + }) satisfies MapDocument).concat(mapResults); + } else { + mapResults = mapResults.concat(searchResults.flat().map(x => ({ + url: x.url, + title: x.title, + description: x.description, + }))); + } const minumumCutoff = Math.min(MAX_MAP_LIMIT, limit); if (mapResults.length > minumumCutoff) {