Skip to main content

Search

Semantic search across your workspace's documents using vector similarity (pgvector + Gemini embeddings).


Endpoint

GET /api/v1/search?q=<query>

Query parameters

NameTypeRequiredDefaultMaxDescription
qstringYesNatural language search query
limitnumberNo520Maximum results to return
thresholdnumberNo0.5Minimum 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

  1. Your query is embedded using Google Gemini (gemini-embedding-001, 768 dimensions)
  2. The embedding is matched against document vectors using the match_documents Postgres RPC function (pgvector cosine similarity)
  3. Results are filtered by workspace and similarity threshold
  4. If embedding generation fails, the API returns a 500 error