Local Semantic Media Search — Search Flow

System Architecture & Data Flow

This diagram illustrates how media files are processed, indexed into a vector database, and subsequently retrieved via natural language queries.

graph TD
    subgraph "Indexing Phase (Offline)"
        A[vault/ Media Store] --> B[Indexer Script]
        B --> C{Frame Extraction}
        C --> D[Qwen3-VL-Embedding-2B]
        D --> E[2048-dim Vector]
        E --> F[(ChromaDB)]
        F --- G[Metadata: Paths, Thumbnails, mtime]
    end

    subgraph "Search Phase (Online)"
        H[User Text Query] --> I[API Server]
        I --> J[Qwen3-VL-Embedding-2B]
        J --> K[Query Vector]
        K --> L{Vector Search}
        L --> F
        F --> M[Cosine Similarity Ranking]
        M --> N{Filter Threshold}
        N -->|Pass| O[Search Results]
        N -->|Fail| P[Filtered Out]
    end

Reading This Diagram

  • Indexing Phase: The indexer scans the local vault/ directory, extracts representative frames from videos, and generates high-dimensional embeddings using the vision-language model. These are stored in ChromaDB along with relevant metadata for fast retrieval and file serving.
  • Search Phase: When a user enters a natural language query, it is converted into a vector using the same model. The system then performs a cosine similarity search against the indexed media, filtering out results that do not meet the quality threshold.

Query Sequence

The following sequence diagram tracks the lifecycle of a search request from the user’s perspective.

sequenceDiagram
    participant User
    participant API as API Server
    participant Model as Qwen3-VL-Embedding-2B
    participant DB as ChromaDB

    User->>API: Natural Language Query
    API->>Model: Vectorize Query
    Model-->>API: 2048-dim Embedding
    API->>DB: Query Nearest Neighbors
    DB-->>API: Top results + Similarity Scores
    API->>API: Filter results < Threshold
    API-->>User: Search Results (Images/Videos)

Reading This Diagram

This sequence illustrates the low-latency interaction between the API server, the local embedding model, and the vector database. By running everything locally, the system ensures zero data leakage and consistent performance.



Last Updated: 2026-06-17
Version: 1.0
Status: Complete