Search
Semantic search across your workspace's documents using vector similarity (pgvector + Gemini embeddings).
Endpoint
GET /api/v1/search?q=<query>
Query parameters
| Name | Type | Required | Default | Max | Description |
|---|---|---|---|---|---|
q | string | Yes | — | — | Natural language search query |
limit | number | No | 5 | 20 | Maximum results to return |
threshold | number | No | 0.5 | — | Minimum similarity score (0–1) |
Example
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://lorehq.co/api/v1/search?q=how+do+we+deploy+to+production&limit=5"
Response
{
"results": [
{
"id": "abc123",
"title": "Production Deployment Runbook",
"content": "## Steps\n1. Run migrations...",
"similarity": 0.94
}
]
}
Results are ordered by similarity score (highest first). Only results above the threshold are returned.
How it works
- Your query is embedded using Google Gemini (
gemini-embedding-001, 768 dimensions) - The embedding is matched against document vectors using the
match_documentsPostgres RPC function (pgvector cosine similarity) - Results are filtered by workspace and similarity threshold
- If embedding generation fails, the API returns a
500error