GET /api/search
Search through cached Kaggle competitions using a hybrid search strategy that combines:- Exact slug matching for precise lookups
- Full-text search (FTS) using PostgreSQL’s
tsvectorfor natural language queries - Fuzzy matching with trigram similarity (
pg_trgm) for typo-tolerant searches
status = 'completed' are included in search results.
Endpoint
Query Parameters
Search query string. Can be:
- Exact slug:
titanic - Partial title:
house prices - Keywords:
regression,nlp,computer vision - Fuzzy match:
titanik(will match “titanic”)
Response
Array of matching competition objects, ordered by relevance score (highest first)
Search Strategy
The search uses a multi-strategy approach with three parallel queries:1. Exact Match (Score: 10.0)
Matches the exact competition slug:2. Full-Text Search (FTS)
Uses PostgreSQL’s built-in FTS withts_rank for relevance scoring:
- Competition title
- Description
- Metadata fields
3. Fuzzy Trigram Matching
Handles typos and partial matches usingpg_trgm:
titanik→ matchestitanicregresion→ matchesregressionhouse pric→ matcheshouse prices
Result Ranking
Results are deduplicated and sorted by the highest score from any matching strategy:- Exact slug matches appear first (score: 10.0)
- Followed by FTS matches (ranked by relevance)
- Then fuzzy matches (ranked by similarity)
Examples
Request: Exact Slug
Response: Exact Match
Request: Keyword Search
Response: Multiple Matches
Request: Fuzzy Search (Typo)
Response: Fuzzy Match
Request: Empty Results
Response: No Matches
Error Responses
429 Too Many Requests
Rate limit exceeded (20 requests per minute).500 Internal Server Error
Search query failed due to database or internal error.Notes
- Only cached competitions with
status = 'completed'are searchable - Empty query returns an empty results array
- Results are limited to 20 competitions per query
- Trigram similarity threshold is 0.1 (10% similarity)
- Requires PostgreSQL extensions:
pg_trgmandtsvector - Search is case-insensitive
- Duplicate results are automatically deduplicated by slug