Function admin_stats_handler

Source
pub async fn admin_stats_handler(
    headers: HeaderMap,
    __arg1: State<AppState>,
) -> Result<Json<StatsResponse>, StatusCode>
Expand description

HTTP handler for retrieving search statistics.

Returns recent search operations and analytics data for monitoring and analysis purposes. This endpoint requires admin authentication via the X-Admin-Key header.

§Headers

  • X-Admin-Key: Required admin API key for authentication

§Returns

  • 200 OK: JSON response with recent search statistics
  • 401 Unauthorized: If admin authentication fails
  • 500 Internal Server Error: If statistics retrieval fails

§Response

Returns up to 50 recent search operations with their metadata including query, result count, search time, and timestamp.

§Example

GET /admin/stats
X-Admin-Key: your-admin-key