# Unified Search Architecture

Unified Search is the cross-domain query and answer subsystem of Advisory AI. It lets operators and users who are unfamiliar with Stella Ops terminology find relevant results across every plane of the release control plane — findings, VEX, policy, graph, timeline, scanner, platform knowledge, and operational memory — through a single deterministic ranking and synthesis pipeline.

Audience: engineers building against the unified-search API and operators tuning its ranking and federation behavior. For the parent service see architecture.md; for operator configuration and examples see unified-search-operations.md and knowledge-search.md.

Goals

Four-Layer Architecture

flowchart LR
  Q[Layer 1: Query Understanding]
  R[Layer 2: Federated Retrieval]
  F[Layer 3: Fusion and Entity Cards]
  S[Layer 4: Synthesis]

  Q --> R --> F --> S

Layer 1: Query Understanding

Layer 2: Federated Retrieval

Layer 3: Fusion and Entity Cards

Layer 4: Synthesis

Telemetry and gap surfacing

Data Flow

sequenceDiagram
  participant UI as Web UI / API Client
  participant API as UnifiedSearchEndpoints
  participant PLAN as QueryUnderstanding
  participant IDX as KnowledgeSearchStore
  participant FED as FederatedDispatcher
  participant FUS as WeightedRrfFusion
  participant CARDS as EntityCardAssembler
  participant SYN as SearchSynthesisService
  participant ANA as SearchAnalyticsService

  UI->>API: POST /v1/search/query
  API->>PLAN: Build QueryPlan
  PLAN-->>API: intent + entities + domain weights
  API->>IDX: SearchFtsAsync + LoadVectorCandidatesAsync
  API->>FED: DispatchAsync (optional)
  IDX-->>API: lexical + vector rows
  FED-->>API: federated rows + diagnostics
  API->>FUS: Fuse rankings
  FUS-->>API: ranked rows
  API->>CARDS: Assemble entity cards
  CARDS-->>API: entity cards
  API->>ANA: Record query/click/zero_result
  API-->>UI: UnifiedSearchResponse

  UI->>API: POST /v1/search/synthesize
  API->>SYN: ExecuteAsync
  SYN-->>UI: SSE deterministic-first + optional LLM chunks

Contracts and API Surface

POST /v1/search/query response notes:

POST /v1/search/suggestions/evaluate response notes:

OpenAPI contract presence is validated by integration test:

Determinism Rules

Configuration

Primary section: AdvisoryAI:UnifiedSearch

Detailed operator config and examples: