Function search_handler

Source
pub async fn search_handler(
    __arg0: Query<SearchQuery>,
    __arg1: State<AppState>,
) -> Result<Json<SearchResponse>, StatusCode>
Expand description

HTTP handler for search operations.

Processes search queries and returns matching documents from the search index. Search statistics are stored asynchronously to avoid blocking the response.

§Query Parameters

  • q: Search query string (required)
  • limit: Maximum number of results (optional, default: 10)
  • offset: Number of results to skip for pagination (optional, default: 0)

§Returns

  • 200 OK: JSON response with search results and metadata
  • 500 Internal Server Error: If search operation fails

§Example

GET /search?q=rust+programming&limit=5&offset=0