feat(search): / 단축키 검색 모달 및 통합 검색 API 추가

- / 및 헤더 검색 클릭으로 모달을 열고 태그·게시물 검색을 제공.
- 태그 검색 범위를 name/slug로 제한하고 IME 조합 입력 대응을 보강.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-11 16:12:31 +09:00
parent bcf3acd432
commit ff6526c997
11 changed files with 471 additions and 14 deletions

12
server/api/search.get.js Normal file
View File

@@ -0,0 +1,12 @@
import { searchPublicContent } from '../repositories/content-repository'
/**
* 공개 통합 검색 API(태그·게시물)
* @param {import('h3').H3Event} event - 요청 이벤트
* @returns {Promise<{ tags: Array<{ name: string, slug: string }>, posts: Array<{ slug: string, title: string, excerpt: string }> }>} 검색 결과
*/
export default defineEventHandler(async (event) => {
const raw = getQuery(event).q
const q = Array.isArray(raw) ? raw[0] : raw
return searchPublicContent(typeof q === 'string' ? q : '')
})