Search API
Semantic Search
Search for markets using natural language and semantic understanding
GET
Advanced Semantic Search
This endpoint provides powerful semantic search capabilities that go beyond simple keyword matching. It uses machine learning-based vector embeddings to find markets that are conceptually related to your search query, even if they don’t contain the exact words.
How It Works
The search uses Cloudflare Vectorize to find markets semantically related to your query:
- Your search query is converted to a vector embedding
- This embedding is compared to pre-computed embeddings of all markets
- Markets with the most similar embeddings are returned
- If vector search fails, it falls back to a sophisticated text search algorithm
Query Parameters
- q (required): The search query text
- limit (optional): Maximum number of results to return (default: 10)
- include_context (optional): Whether to include relevance scores and match context (default: false)
Response Format
Search Capabilities
This endpoint can handle various types of search queries:
- Conceptual Searches: “economic impact of election”
- Question-Based Searches: “Will Trump win in 2024?”
- Topic Searches: “climate change predictions”
- Event Searches: “world cup outcomes”
Text Search Fallback
If vector search is unavailable or returns insufficient results, the search will automatically fall back to text search, which:
- Breaks your query into keywords
- Searches for these keywords across questions, descriptions, and rules
- Ranks results by relevance and recency
Use Cases
- Natural Language Search: Allow users to search using everyday language
- Discovery Interfaces: Help users find markets related to concepts they’re interested in
- Research Tools: Find markets related to specific topics for analysis
- Recommendation Systems: Suggest markets based on user interests
Example Queries
Authorizations
Enter your API key as the bearer token
Query Parameters
Search query text
Number of results to return
Include context and relevance info