Repository navigation
ADR 001 Typesense for DFL Search
Superseded 2026-07-31 by Azure AI Search. See Search-and-Retrieval.
DEMI needed full-text and faceted search over DFL documents against a 10-second response target.
eagle-api already ran Typesense 30.1, deployed by docker-compose and Helm, with five collections
(documents, projects, activities, notifications, document_chunks), a real-time MongoDB
change-stream sync, PDF extraction and page-based chunking, a proxy that injected an
allowed_roles filter, zero-downtime re-index by alias swap, and a frontend adapter in
eagle-public. Reusing it meant no second service to deploy or operate.
DFL search used Typesense as its only search backend.
- The existing
document_chunkscollection took DFL metadata fields and facets:documentType,topics,orcsCode,visibility,holdState. - The existing
allowed_rolesmodel carried DFL visibility. - Change-stream sync indexed DFL documents as MongoDB created them.
- Typesense's built-in
ts/e5-smallembeddings on thecontentfield supplied semantic search with no external API and no per-query cost, queried alongside keywords in one hybrid request.
Typesense could not hold this corpus. Its indexed fields are RAM-only with no on-disk mode, clustering is replication rather than sharding, and its own sizing rule put the corpus at 17-26 GB of RAM against the 8 GiB ceiling of Container Apps Consumption. A larger container was not a lever.
The ts/e5-small embeddings that most of this decision rested on were never enabled, so the
semantic half was never exercised. Typesense code and infrastructure were removed, and retrieval
moved to lexical BM25 on Azure AI Search — see Search-and-Retrieval.
- Environment Reality & Gotchas
- Architecture
- Seeding — filling Cosmos from Track and Eagle
- Frontend — React shell: screens, routes, sign-in gate
- Sources and Status — every source, one state
- Search & Retrieval — overview
- Search Index Reference
- Search Query Construction
- Deep Search Queries — passages, chunk filters, degraded modes
- Native List Reads — native list endpoints and mirror list reads
- Chunk Parent Fields — parent fields copied onto chunks
- Chunk Parent-Field Backfill — roll the fields out, repair
- Search Measurements
- Extraction Pipeline
- Extraction Quality — coverage, word-joining, tiling
- Identity Model — which id means what
- Attribute-Level Access — field-visibility levels, catalog
- Sync Architecture — how records get in
- Eagle Mirror Reference — mirrored kinds, refusals, drift classes
- ENGAGE Rows Reference — ENGAGE-owned comment periods, reconcile
- Public-Read Backfill — filling and repairing the mirror containers
-
Short Links —
/s/{code}redirect and/api/links -
Recent Uploads —
/api/documents/recent-uploads, eagle-public homepage panel - Reports — comment export and BCGW CSV reads
-
User Data — saved map areas, preferences,
/meroutes -
Bulk Download —
/api/bulk-downloads, zip jobs - Bulk Download: Operations — enable, poison-queue runbook
- Document Intake — upload link, malware scan, release
- Connecting an Application to DEMI
- Azure Environments
- API Gateway — APIM, Front Door edge secret, caller IP
- Document Backup — archive copy of originals, run and check
- Document Backup: Revert and Drill — put documents back from the archive
- PDF Titles — public name written into stored PDFs, run, restore
- Secret Sync — Key Vault, secret-sync Function app, required names
-
Operating DEMI in Azure — deploy, verify
- Operating the DEMI Data Plane — devbox access, probes, audit and cost reads
- Edge ban detector — hourly timer, modes, kill switch, soak and promote
-
CI Workflows — every GitHub Actions workflow, trigger, identity, roles
- CI Deploy Workflows — eagle-demi staging and production deploys
- CI Admin Frontend Workflows — eagle-demi-admin checks and deploys
- Release Process — cutting, tagging, shipping and rolling back a version
- Runbook: Search Outage — index/app schema drift, diagnose, fix, roll back
- BC Gov Landing Zone
- Business Rules
- EPIC.search Business Rules — where DEMI differs from EPIC.search
- 001: Typesense for DFL Search — superseded
- 002: Async Processing (MongoDB Queue) — superseded
- 003: Rule-Based Classification
- 004: Read ACL Authorization Model
- 005: Cosmos Full-Text Search Ruled Out — rejected
- 006: AI Summarization over BM25
- 007: Service-to-Service Credentials
- 008: Audit and Usage Analytics Store
- 009: Track Feed
- 010: Attribute-Level Access Control
- 011: Public Read Surface
- 012: Public Config Surface
- 013: Stored Project Summaries — proposed
- 014: Sync-out to Eagle
- 015: Malware scanning on intake
- Developer Brief: Digital File Library
- Developer Brief: AI Classifier Tool
- Developer Brief: EPIC System Integration
- Managing Government Information Policy 2022
- Guidelines on Documenting Government Decisions 2019
- AICT Guidelines
- Per-Document Data Format
- Per-Document Generator
- Document Types Draft
- DFL Reference Metadata
- Act and Legislation Full Text
- ORCS Filing Reference Sheet