feat(search): add global search across wiki entities

Implement /api/search endpoint for cross-entity querying
Add GlobalSearch component to top navigation bar with categorized results
This commit is contained in:
2026-05-04 14:20:12 +08:00
parent 3dd3998a5c
commit 06e0cbb1c1
8 changed files with 784 additions and 0 deletions

View File

@@ -73,6 +73,7 @@ import {
getPokemon,
getPublicUserProfile,
getRecipe,
globalSearch,
importAdminData,
isConfigType,
listAncientArtifacts,
@@ -219,6 +220,10 @@ app.setErrorHandler(async (error, _request, reply) => {
app.get('/health', async () => ({ ok: true }));
app.get('/api/search', async (request) =>
globalSearch(request.query as Record<string, string | string[] | undefined>, requestLocale(request))
);
function getBearerToken(authorization: string | undefined): string | null {
const [scheme, token] = authorization?.split(' ') ?? [];
return scheme === 'Bearer' && token ? token : null;