Moar fixes

This commit is contained in:
2025-09-07 13:00:30 +02:00
parent 8c84e27a0a
commit 5c68154775
4 changed files with 57 additions and 20 deletions

View File

@@ -68,11 +68,24 @@ doSearch();
"""
def meili_search(qstr, limit=30):
if not qstr.strip(): return []
r = requests.post(f"{MEILI_URL}/indexes/library/search",
headers={"Authorization": f"Bearer {MEILI_KEY}","Content-Type":"application/json"},
data=json.dumps({"q": qstr, "limit": limit}))
return r.json().get("hits", [])
if not qstr.strip():
return []
try:
r = requests.post(
f"{MEILI_URL}/indexes/library/search",
headers={"Authorization": f"Bearer {MEILI_KEY}", "Content-Type": "application/json"},
data=json.dumps({"q": qstr, "limit": limit}),
timeout=5,
)
if r.status_code != 200:
return []
return r.json().get("hits", [])
except Exception:
return []
@app.get("/health")
def health():
return "ok"
@app.get("/")
def index():