fix: Meilisearch 검색 유사도 필터링 추가

- 유사도 0.5 미만인 검색 결과 필터링
- showRankingScore 활성화하여 점수 기반 필터링 적용
This commit is contained in:
caadiq 2026-01-10 19:06:49 +09:00
parent 622839b0e8
commit a3960489d4

View file

@ -121,6 +121,7 @@ export async function searchSchedules(query, options = {}) {
limit: options.limit || 1000, // 기본 1000개 (Meilisearch 최대) limit: options.limit || 1000, // 기본 1000개 (Meilisearch 최대)
offset: options.offset || 0, // 페이징용 offset offset: options.offset || 0, // 페이징용 offset
attributesToRetrieve: ["*"], attributesToRetrieve: ["*"],
showRankingScore: true, // 유사도 점수 포함
}; };
// 카테고리 필터 // 카테고리 필터
@ -135,10 +136,13 @@ export async function searchSchedules(query, options = {}) {
const results = await index.search(query, searchOptions); const results = await index.search(query, searchOptions);
// 유사도 0.5 미만인 결과 필터링
const filteredHits = results.hits.filter((hit) => hit._rankingScore >= 0.5);
// 페이징 정보 포함 반환 // 페이징 정보 포함 반환
return { return {
hits: results.hits, hits: filteredHits,
total: results.estimatedTotalHits, // 전체 결과 수 total: filteredHits.length, // 필터링 후 결과 수
offset: searchOptions.offset, offset: searchOptions.offset,
limit: searchOptions.limit, limit: searchOptions.limit,
}; };