Search

Semantic Search

Search by meaning, not just keywords. ContextStream understands what you're looking for and returns relevant results even when the exact words don't match.

Search Types

Semantic

Understands meaning and context. "database choices" finds results about "PostgreSQL decisions".

Keyword

Traditional text matching. Fast and precise when you know the exact terms.

Hybrid

Combines semantic and keyword search for best results. Recommended for most use cases.

Pattern

Regex and pattern matching for code search. Find specific syntax patterns.

Basic Search

Perform a semantic search across your workspace:

curl -X POST https://api.contextstream.io/api/v1/search/semantic \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "how do we handle user authentication?",
    "search_type": "semantic",
    "workspace_id": "your-workspace-id",
    "limit": 10
  }'

Hybrid Search

Combine semantic understanding with keyword matching for better precision:

curl -X POST https://api.contextstream.io/api/v1/search/hybrid \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "query": "JWT token refresh logic",
    "workspace_id": "your-workspace-id",
    "filters": {
      "tags": ["authentication", "security"]
    }
  }'

Filtering Results

Narrow down results with filters:

{
  "query": "database migrations",
  "search_type": "semantic",
  "filters": {
    "tags": ["database", "backend"],
    "file_types": [".sql", ".rs"],
    "languages": ["sql", "rust"],
    "modified_after": "2024-01-01T00:00:00Z",
    "min_score": 0.7
  }
}

tags - Filter by memory event tags

file_types - Filter by file extension

languages - Filter by programming language

modified_after - Only recent content

min_score - Minimum relevance threshold

Understanding Results

Search results include relevance scores and highlights:

{
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "content": "We implemented JWT authentication with refresh tokens...",
      "score": 0.92,
      "highlights": [
        {
          "field": "content",
          "snippet": "...implemented <em>JWT authentication</em> with refresh..."
        }
      ],
      "metadata": {
        "event_type": "decision",
        "tags": ["authentication", "jwt"]
      }
    }
  ],
  "total": 15,
  "query_time_ms": 45
}

Next Steps