GET /api/search
Search across multiple collections including services, events, resources, news, photos, jobs, and documentation.Query Parameters
Search query string (minimum 2 characters)
Comma-separated list of collections to search.Default:
services,events,resources,news,photos,jobs,docsAvailable collections:serviceseventsresourcesnewsphotosjobsdocs
Maximum number of results per collectionDefault:
10Response Format
Status of the API response (“success” or “error”)
The original search query
Total number of results across all collections
Search results organized by collectionEach collection key (e.g., “services”, “events”) contains an array of result objects:
Unique identifier/slug for the item
Item title or name
Item description
Item category
Collection name
Relative URL to the item
URL to item image or logo
Whether the item is featured
Whether the results were served from cache
Age of cached results in milliseconds (only present if
cached: true)Caching
Search results are cached for 5 minutes to improve performance. Cache headers are included in responses:X-Cache: “HIT” (cached) or “MISS” (fresh query)Cache-Control:public, max-age=300(5 minutes)
Error Responses
“error”
Error message description
Detailed error information
200- Success400- Bad request (query too short or invalid)429- Rate limit exceeded (60 requests per minute)500- Internal server error
Rate Limiting
All API endpoints are rate-limited to 60 requests per minute per IP address. Rate limit headers are included in responses:X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Remaining requests in current windowX-RateLimit-Reset: Timestamp when the rate limit resetsRetry-After: Seconds to wait before retrying (only on 429 responses)
Example Request
Search all collections:Example Response
Example Cached Response
Implementation Details
The Search API implementation includes:- Query Parsing: Searches across common fields (title, name, description, category, tags) -
src/pages/api/search.ts:154 - Result Caching: 5-minute TTL with max 100 cached queries -
src/pages/api/search.ts:14 - Cache Key Generation: Based on query + collections + limit -
src/pages/api/search.ts:24 - Automatic Cleanup: Expired cache entries removed every 10 minutes -
src/pages/api/search.ts:81
src/pages/api/search.ts:92