Update file_api.py
Browse files- file_api.py +3 -3
file_api.py
CHANGED
|
@@ -316,7 +316,7 @@ def fetch_all_from_api(category: str = "전체", region: str = "전체(지역)",
|
|
| 316 |
break
|
| 317 |
all_items.extend(items)
|
| 318 |
if page_idx == 1 and items:
|
| 319 |
-
total_cnt = items[0].get("totCnt", 0)
|
| 320 |
try:
|
| 321 |
total_cnt = int(total_cnt)
|
| 322 |
except:
|
|
@@ -356,7 +356,7 @@ def fetch_with_cache(category: str = "전체", region: str = "전체(지역)", k
|
|
| 356 |
return fetch_all_from_api(category, region, keyword)
|
| 357 |
|
| 358 |
# 키워드 검색 (벡터 검색)
|
| 359 |
-
if keyword.strip():
|
| 360 |
cache = get_cache()
|
| 361 |
items = cache.search(keyword.strip(), n_results=500)
|
| 362 |
status = f"🔍 캐시에서 '{keyword}' 검색"
|
|
@@ -369,7 +369,7 @@ def fetch_with_cache(category: str = "전체", region: str = "전체(지역)", k
|
|
| 369 |
if category and category != "전체":
|
| 370 |
filtered = [
|
| 371 |
i for i in filtered
|
| 372 |
-
if category.lower() in (i.get("lcategory", "") or i.get("pldirSportRealmLclasCodeNm", "") or "").lower()
|
| 373 |
]
|
| 374 |
filter_info.append(f"분야:{category}")
|
| 375 |
|
|
|
|
| 316 |
break
|
| 317 |
all_items.extend(items)
|
| 318 |
if page_idx == 1 and items:
|
| 319 |
+
total_cnt = items[0].get("totCnt", 0) if isinstance(items[0], dict) else 0
|
| 320 |
try:
|
| 321 |
total_cnt = int(total_cnt)
|
| 322 |
except:
|
|
|
|
| 356 |
return fetch_all_from_api(category, region, keyword)
|
| 357 |
|
| 358 |
# 키워드 검색 (벡터 검색)
|
| 359 |
+
if keyword and keyword.strip():
|
| 360 |
cache = get_cache()
|
| 361 |
items = cache.search(keyword.strip(), n_results=500)
|
| 362 |
status = f"🔍 캐시에서 '{keyword}' 검색"
|
|
|
|
| 369 |
if category and category != "전체":
|
| 370 |
filtered = [
|
| 371 |
i for i in filtered
|
| 372 |
+
if category.lower() in (i.get("lcategory", "") or i.get("pldirSportRealmLclasCodeNm", "") or i.get("category", "") or "").lower()
|
| 373 |
]
|
| 374 |
filter_info.append(f"분야:{category}")
|
| 375 |
|