{
  "id": 9867154,
  "title": "Why Vector Search Breaks Production: Building a 2-Hop Relational Context Engine in Sanity",
  "url": "https://urgent.news/2026/09/26/why-vector-search-breaks-production-building-a-2-hop-relational",
  "topic": "ai",
  "section": "AI",
  "published": "2026-09-26T00:09:19.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/rajan_mishra_a9f78ad216b4/why-vector-search-breaks-production-building-a-2-hop-relational-context-engine-in-sanity-134c"
  },
  "original_language": "en",
  "account": "The AI community has been developing Retrieval-Augmented Generation (RAG) using vector similarity search techniques like Pinecone, Chroma, and pgvector for prose and chat applications. However, when applied to engineering infrastructure, vector search can lead to outages due to the loss of relational constraints, authority hierarchies, and multi-hop transitivity during the compression of text into high-dimensional vectors. To address these issues, the Sanity team built a 2-hop relational context engine on top of Sanity Content Lake, which models organizational knowledge as a structured graph of microservices, version constraints, policies, and semantic relationships. This engine executes deterministic GROQ graph traversals to surface hidden dependency chains and resolve documentation contradictions with mathematical precision.\n\nThe Sanity team used Sanity to create 18 interconnected documents across three core schema types: Schema Graph, versionConstraint, and knowledgeEntry. The core GROQ query used by the context engine traverses three hops to resolve 2-hop dependency chains in a single database round-trip. The engine first identifies the target component, then the relational version constraint, and finally the active cluster state of the required dependency. Authority resolution is handled by sorting conflicting specs by authorityLevel so the newest specification always wins.\n\nIn a live benchmark, the Sanity Context Engine was compared to a standard vector similarity search. The engine correctly detected a P0 outage caused by a version constraint mismatch between payment service and its SDK dependency, while the vector search failed to identify the issue. The Sanity Context Engine also supports in-memory graph mutation, allowing engineers to simulate fixes and immediately see the impact on constraints and overall document reliability. This approach eliminates false positives and provides a more accurate, structured, and explainable context for AI coding assistants.",
  "summary": "This is a submission for the Sanity Challenge, Path Two: Build a Knowledge Base or Context Engine . What I Built The AI community has spent the last three years building Retrieval-Augmented Generation (RAG) on top of vector similarity search (Pinecone, Chroma, pgvector). For prose and chat applications, cosine similarity on text chunks works well. For engineering infrastructure, vector search is…",
  "key_points": [
    "Sanity team developed 2-hop relational context engine for vector search issues",
    "Engine models knowledge as structured graph of microservices and relationships",
    "Live benchmark showed engine correctly detected P0 outage, while vector search failed"
  ],
  "editors_take": "Building a relational context engine that preserves organisational knowledge and authority hierarchies offers a more accurate and explainable approach to AI coding assistance than vector similarity search techniques.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}