Corpus Search API
Vector search across a Pinecone media corpus with AI-powered query expansion, metadata extraction, timezone-aware filtering, proximity re-ranking, and optional LLM semantic re-ranking via Claude.
Only query is required. Everything else is optional — the AI figures out strategy, time, location, and type from natural language.
Quick Start
Three examples to get you going — from fully automatic to fully manual.
Search
Runs the complete search flow in one call: AI extraction → expansion → embed → Pinecone query → post-filter → proximity re-rank → optional LLM re-rank.
query are optional — AI fills in strategy, time, and location if extractMeta is enabled.| Parameter | Type | Default | Description |
|---|---|---|---|
| query required | string | Natural language search text | |
| expand | boolean | true | Claude enriches the query with 5–15 contextual keywords before embedding |
| extractMeta | boolean | true | Claude infers strategy, time preset, location, and media type from the query |
| timezone | string | "UTC" | IANA timezone for time preset resolution. If AI detects a location, that timezone overrides this. |
| strategy | string | AI decides | Search strategy — omit to let AI choose. See strategy table below. |
| timePreset | string | AI decides | Time window: today, tonight, yesterday, this_week, last_week, this_month, last_30d, last_90d, all |
| startMs | number | Explicit time range start (UTC ms). Overrides timePreset. | |
| endMs | number | Explicit time range end (UTC ms). Overrides timePreset. | |
| type | string | Media type filter: image, video, text, audio | |
| lat | number | AI decides | Reference latitude for proximity re-ranking |
| lng | number | AI decides | Reference longitude |
| radiusKm | number | 50 | Proximity boost radius in km |
| weight | number | 0.15 | Proximity boost weight (0–1). Higher = location matters more. |
| country | string | Exact country metadata match (Pinecone pre-filter) | |
| city | string | Exact city metadata match (Pinecone pre-filter) | |
| topK | integer | 100 | Max results. Range: 1–10,000 |
| filterMode | string | "pre" | "pre" = Pinecone-level filter (faster). "post" = server-side filter. |
| rerank | boolean | false | Enable LLM semantic re-ranking via Claude |
| rerankPool | integer | 10 | Candidates to feed into Claude for re-ranking |
| rerankReturn | integer | 5 | Results to return after LLM scoring. Must be ≤ rerankPool. |
| Value | Behavior |
|---|---|
embed | Pure vector similarity — no time or location filtering |
embed_time | Vector + time window filter |
embed_time_meta | Vector + time + city/country string match |
embed_time_coord | Vector + time + coordinate-based proximity re-ranking |
Metadata Extraction
| Parameter | Type | Description |
|---|---|---|
| query required | string | Natural language query |
| timezone | string | IANA timezone for context |
| Parameter | Type | Description |
|---|---|---|
| query required | string | Query to expand |
Embedding & Query
gemini-embedding-001.| Parameter | Type | Description |
|---|---|---|
| text required | string | Text to embed |
| Parameter | Type | Description |
|---|---|---|
| vector required | number[] | 768-dim embedding |
| host required | string | Pinecone host (from /api/resolve-host) |
| topK | integer | Max results (default 100) |
| filter | object | Pinecone metadata filter |
/api/query.Geocoding
| Parameter | Type | Description |
|---|---|---|
| q required | string | Place name to geocode |
Performance
| Step | Duration | Notes |
|---|---|---|
| AI extraction | 1–2s | Claude call. Parallel with expansion. |
| AI expansion | 1–2s | Claude call. Parallel with extraction. |
| Embedding | 200–400ms | Gemini API |
| Pinecone query | 300–800ms | Depends on topK and filter |
| Firestore fetch | 300–600ms | Only if rerank=true |
| LLM rerank | 2–5s | Only if rerank=true |
Total without rerank: ~2–4s. With rerank: ~5–9s. Set expand: false and extractMeta: false for ~1s latency.
Priority Order
When multiple sources provide the same parameter:
| Status | Cause |
|---|---|
400 | Missing required parameter |
405 | Wrong HTTP method |
500 | Internal error (Pinecone, Claude, Gemini, or Firestore) |
AI steps fail gracefully — a failed extraction uses defaults, a failed expansion embeds the raw query, a failed rerank returns null. The search still returns results.
Memories API
Persistent memory endpoints for storing and retrieving contextual information across sessions. These endpoints are planned and not yet available.
Planned User Memories
Store and retrieve per-user memory context — preferences, past queries, behavioral patterns. Enables personalized search results and AI responses that improve over time.
Planned City Memories
Aggregate knowledge about specific cities — trending topics, recurring events, notable locations, local context. Powers location-aware search enrichment and city-specific AI behavior.
Planned Location Memories
Fine-grained coordinate-based memories — what has happened at specific GPS coordinates over time. Enables hyper-local search context and spatial pattern recognition.
Planned Event Memories
Temporal event tracking — significant events detected across the corpus with time, location, and topic clustering. Supports event-aware search and timeline queries.