DocHub/backend/app/routers/search.py
Tianyang 542361c63a fix: natural-sort file tree, indent nested folders, fix editor layout
Also add a reindex endpoint and button to rebuild the Meilisearch
index from files already on disk, without needing to re-upload them.
2026-08-01 17:32:32 +08:00

18 lines
511 B
Python

from fastapi import APIRouter, Depends
from app.dependencies import get_document_service, get_search_client
from app.document_service import DocumentService
from app.search_client import SearchClient
router = APIRouter()
@router.get("/api/search")
def search(q: str = "", client: SearchClient = Depends(get_search_client)):
return {"results": client.search(q)}
@router.post("/api/search/reindex")
def reindex(service: DocumentService = Depends(get_document_service)):
return service.reindex_all()