[{"data":1,"prerenderedAt":565},["ShallowReactive",2],{"en-project-detail-hybrid-photo-search-engine-2026-12-03":3,"en-project-related-posts-hybrid-photo-search-engine-2026-12-03":558,"en-project-ko-counterpart-hybrid-photo-search-engine-2026-12-03":564},{"id":4,"title":5,"alternateNames":6,"body":7,"coverImage":504,"coverImageAlt":505,"date":506,"description":507,"englishRole":508,"englishSummary":509,"extension":510,"featured":511,"gallery":6,"liveLabel":6,"liveUrl":6,"meta":512,"navigation":511,"order":513,"path":514,"period":515,"projectStatus":516,"repoUrl":6,"role":517,"sanitized":511,"seo":518,"seoDescription":6,"seoTitle":6,"specs":519,"status":538,"stem":539,"subtitle":540,"tags":541,"techStack":548,"track":556,"__hash__":557},"enProjects/en/projects/hybrid-photo-search-engine.md","Large-Scale Photo & Plate Hybrid Search & 0ms Lightbox Engine",null,{"type":8,"value":9,"toc":495},"minimark",[10,14,32,57,69,72,77,80,130,132,136,146,156,203,205,209,212,218,248,250,254,261,330,333,335,339,345,351,434,436,440],[11,12,5],"h1",{"id":13},"large-scale-photo-plate-hybrid-search-0ms-lightbox-engine",[15,16,17,18,22,23,31],"p",{},"This project is a hybrid search and progressive media viewer engine built for a ",[19,20,21],"strong",{},"34,050-asset visual archive"," combining field-shot photography with high-resolution scanned plates from photography and optics textbooks. It was designed to retrieve exact optical diagrams and photographic references across both lexical and semantic intent, and to open high-resolution inspection views with ",[19,24,25,26,30],{},"zero perceived latency (",[27,28,29],"code",{},"0ms"," swap)"," the moment a result is clicked.",[15,33,34,35,38,39,42,43,49,50,56],{},"As the archive crossed tens of thousands of items, structural bottlenecks surfaced across two distinct layers. On the backend retrieval layer, single-path dense cosine similarity missed domain-specific equipment terminology and fell prey to ",[19,36,37],{},"hubness dominance",", while inherent ",[19,40,41],{},"missing EXIF metadata"," on scanned textbook plates made full index rebuilds expensive and risky. On the frontend viewer layer, direct streaming of original assets caused severe loading stalls reaching ",[19,44,45,48],{},[27,46,47],{},"7,504.8ms"," (1.47MB) for field-shot photos"," and ",[19,51,52,55],{},[27,53,54],{},"3,953.5ms"," (2.20MB) for high-DPI book plates",".",[15,58,59,60,63,64,56],{},"To resolve both planes simultaneously, the architecture physically separates an immutable vector corpus from a Copy-on-Write EXIF overlay, introduces a Dual-Path reranker combining dense vectors with field-weighted lexical scoring, and couples them to a ",[27,61,62],{},"1600px"," persistent WebP disk cache and predictive lightbox pipeline. For code-level implementation details and benchmarks, see ",[65,66,68],"a",{"href":67},"/en/blog/20261129-hybrid-photo-search-zero-ms-lightbox","Designing Hybrid Search and a 0ms Progressive Lightbox for 34,050 Photos & Book Plates",[70,71],"hr",{},[73,74,76],"h2",{"id":75},"_1-two-structural-challenges-in-a-34050-asset-corpus-hubness-missing-exif","1. Two Structural Challenges in a 34,050-Asset Corpus: Hubness & Missing EXIF",[15,78,79],{},"The 34,050-item corpus blends two heterogeneous asset types: JPEG/RAW-derived photographs captured on digital cameras and high-DPI plates scanned from technical photography and lighting literature. Indexing and querying this dataset with a single dense embedding model exposed two failure modes:",[81,82,83,110],"ol",{},[84,85,86,89,90,93,94,97,98,101,102,105,106,109],"li",{},[19,87,88],{},"Hubness Dominance",": In high-dimensional embedding spaces, a small set of generic documents positioned near semantic centroids (such as ",[27,91,92],{},"\"lighting\"",", ",[27,95,96],{},"\"portrait\"",", or ",[27,99,100],{},"\"camera\"",") repeatedly appear as nearest neighbors (k-NN) across unrelated queries. As a result, precise queries like ",[27,103,104],{},"\"50mm f/1.4 wide-open aperture bokeh\""," or ",[27,107,108],{},"\"Zone System Zone III shadow gradation plate\""," pushed exact plates and reference photos outside the top 10 slots.",[84,111,112,115,116,93,119,93,122,125,126,129],{},[19,113,114],{},"Missing EXIF Metadata & Index Corruption Risk",": Scanned textbook plates inherently lack camera ",[27,117,118],{},"Make",[27,120,121],{},"Model",[27,123,124],{},"FocalLength",", and ",[27,127,128],{},"FNumber"," EXIF tags, while legacy digital photographs frequently contain incomplete or inconsistently formatted model strings. Overwriting or re-indexing the entire 34,050-vector HNSW graph every time curators enriched metadata introduced lock contention and index drift risk.",[70,131],{},[73,133,135],{"id":134},"_2-decoupling-the-immutable-vector-corpus-from-copy-on-write-exif-overlays","2. Decoupling the Immutable Vector Corpus from Copy-on-Write EXIF Overlays",[15,137,138,139,49,142,145],{},"To prevent ongoing metadata curation from destabilizing large-scale vector retrieval, the ",[19,140,141],{},"base vector corpus",[19,143,144],{},"curated EXIF enrichment layer"," were decoupled across a strict Read-Time Merge boundary.",[147,148,153],"pre",{"className":149,"code":151,"language":152},[150],"language-text","┌─────────────────────────────────────────────────────────────────────────┐\n│                   Read-Time CoW Merge Layer (Resolver)                  │\n├────────────────────────────────────┬────────────────────────────────────┤\n│  Immutable Vector Corpus Index     │  Copy-on-Write EXIF Overlay        │\n│  · 34,050-asset frozen snapshot    │  · Backfilled plate optics/f-stop  │\n│  · Fixed sha256 & embedding matrix │  · Normalized camera/lens strings  │\n│  · Zero HNSW re-indexing (lockless)│  · Delta patches & instant rollback│\n└────────────────────────────────────┴────────────────────────────────────┘\n","text",[27,154,151],{"__ignoreMap":155},"",[157,158,159,181,193],"ul",{},[84,160,161,168,169,172,173,176,177,180],{},[19,162,163,164,167],{},"Immutable Corpus Snapshots (",[27,165,166],{},"/srv/app/image-search/index/snapshot_v*",")",": Asset hashes (",[27,170,171],{},"asset_id","), document classes (",[27,174,175],{},"photo"," | ",[27,178,179],{},"book_plate","), raw captions, and high-dimensional embedding vectors are sealed into immutable snapshots at ingest time.",[84,182,183,189,190,192],{},[19,184,185,186,167],{},"Copy-on-Write EXIF Overlay (",[27,187,188],{},"/srv/app/image-search/data/exif_overlay.sqlite",": Whenever a curator backfills optical parameters for a book plate or normalizes a camera body string, only a minimal delta record keyed by ",[27,191,171],{}," is written—leaving the underlying vector index untouched.",[84,194,195,198,199,202],{},[19,196,197],{},"Lock-Free Read Merge & Instant Rollback",": The API merges ",[27,200,201],{},"{ ...base_meta, ...overlay_patch }"," right before emitting search responses, sustaining 100% corpus read availability while supporting millisecond metadata edits and versioned rollbacks.",[70,204],{},[73,206,208],{"id":207},"_3-dual-path-reranking-engine-dense-semantics-field-weighted-lexical-matching","3. Dual-Path Reranking Engine: Dense Semantics + Field-Weighted Lexical Matching",[15,210,211],{},"To overcome single-vector recall gaps, a semantic Dense path and an exact-match Sparse/Lexical path execute in parallel, followed by a hubness-aware reranking stage.",[147,213,216],{"className":214,"code":215,"language":152},[150],"[User Query]\n     ├──> [Path A: Dense Semantic Vectors] ──> Retrieves Top-K conceptual candidates\n     │\n     └──> [Path B: Field-Weighted Lexical] ──> Plate ID (w=3.0) · EXIF (w=2.5) · Tags (w=2.0) · Body (w=1.0)\n                                              │\n                                              ▼\n                       [Dual-Path Reranking + Hubness Centrality Penalty]\n                                              │\n                                              ▼\n                       [Top-N Output Validated on 17-Query Benchmark Suite]\n",[27,217,215],{"__ignoreMap":155},[157,219,220,242],{},[84,221,222,225,226,229,230,233,234,237,238,241],{},[19,223,224],{},"Differential Field Weighting",": Assigning distinct weights to plate numbers and title tokens (",[27,227,228],{},"3.0","), CoW-merged normalized EXIF body/focal-length/aperture fields (",[27,231,232],{},"2.5","), domain optical tags (",[27,235,236],{},"2.0","), and caption/OCR text (",[27,239,240],{},"1.0",") restored precision for exact numerical specs and gear identifiers.",[84,243,244,247],{},[19,245,246],{},"Hubness Centrality Penalty",": Generic vectors that frequently intrude into top ranks without lexical overlap receive a centrality damping penalty. Validation across a 17-query benchmark suite covering four query archetypes (equipment specs, optical plates, lighting mood, and bilingual Korean-English compounds) confirmed that exact plates and studio examples consistently surfaced into top slots.",[70,249],{},[73,251,253],{"id":252},"_4-viewer-bottleneck-audit-75048ms-photos-39535ms-book-plates","4. Viewer Bottleneck Audit: 7,504.8ms Photos & 3,953.5ms Book Plates",[15,255,256,257,260],{},"Once retrieval quality stabilized, frontend telemetry pinpointed severe ",[19,258,259],{},"time-to-first-frame stalls between clicking a grid thumbnail and painting the high-resolution lightbox view",":",[262,263,264,284],"table",{},[265,266,267],"thead",{},[268,269,270,275,278,281],"tr",{},[271,272,274],"th",{"align":273},"left","Asset Class",[271,276,277],{"align":273},"Original Payload",[271,279,280],{"align":273},"Measured Peak Latency",[271,282,283],{"align":273},"Root Bottleneck Causes",[285,286,287,309],"tbody",{},[268,288,289,295,300,306],{},[290,291,292],"td",{"align":273},[19,293,294],{},"Field-Shot Original Photo",[290,296,297],{"align":273},[27,298,299],{},"1.47MB",[290,301,302],{"align":273},[19,303,304],{},[27,305,47],{},[290,307,308],{"align":273},"Cold remote storage reads + unresized full-resolution streaming + main-thread decode",[268,310,311,316,321,327],{},[290,312,313],{"align":273},[19,314,315],{},"High-DPI Textbook Plate",[290,317,318],{"align":273},[27,319,320],{},"2.20MB",[290,322,323],{"align":273},[19,324,325],{},[27,326,54],{},[290,328,329],{"align":273},"Direct streaming of high-DPI scans + absent intermediate disk cache + no preloading",[15,331,332],{},"Because reviewers had to wait 4 to 7.5 seconds staring at empty frames and spinners on each consecutive image, rapid visual inspection felt broken regardless of backend search speed.",[70,334],{},[73,336,338],{"id":337},"_5-1600px-persistent-webp-disk-cache-0ms-progressive-swap-lightbox","5. 1600px Persistent WebP Disk Cache & 0ms Progressive Swap Lightbox",[15,340,341,342,344],{},"To drive perceived lightbox latency down to ",[27,343,29],{},", the media proxy cache, origin error guard, and browser prefetch/swap layer were engineered as a single end-to-end pipeline.",[147,346,349],{"className":347,"code":348,"language":152},[150],"[Grid Card Pointer Dwell (120ms Debounce)]\n         │\n         ▼\n[Media Proxy /api/media/{id}?w=1600]\n         ├── Cache Hit    ──> [1600px WebP Persistent Disk Cache] (instant immutable serve)\n         └── Origin Fault ──> [Origin Guard: 404 Missing / 422 Corrupt + Cache-Control: no-store]\n         │\n         ▼\n[Lightbox Stage Open]\n  · T = 0ms  : Instant paint from in-memory grid thumbnail (zero blank frame, zero CLS)\n  · T = Async: Seamless swap on the exact frame 1600px WebP finishes img.decode()\n  · Background: Adjacent slots (N-1, N+1) preloaded and pre-decoded at 1600px WebP\n",[27,350,348],{"__ignoreMap":155},[81,352,353,370,397,407],{},[84,354,355,358,359,361,362,365,366,369],{},[19,356,357],{},"1600px Persistent WebP Disk Cache",": Assets are transcoded once into an inspection-grade ",[27,360,62],{}," long-edge WebP (",[27,363,364],{},"quality: 84",", EXIF orientation normalized), written to a temporary file, and atomically renamed into ",[27,367,368],{},"/srv/app/image-search/cache/webp1600"," for permanent reuse.",[84,371,372,386,387,389,390,392,393,396],{},[19,373,374,375,378,379,382,383,167],{},"Origin Exception Defense (",[27,376,377],{},"404"," / ",[27,380,381],{},"422"," + ",[27,384,385],{},"no-store",": When an upstream storage file is missing (",[27,388,377],{},") or fails binary decode validation (",[27,391,381],{},"), the proxy never persists empty artifacts to disk; instead, it returns the explicit status code with ",[27,394,395],{},"Cache-Control: no-store",", completely blocking negative cache poisoning.",[84,398,399,402,403,406],{},[19,400,401],{},"120ms Debounced Hover Prefetching",": Only cards where the pointer rests past a ",[27,404,405],{},"120ms"," debounce threshold trigger low-priority background prefetching, keeping the network queue clear during rapid cursor sweeps.",[84,408,409,416,417,419,420,422,423,426,427,49,430,433],{},[19,410,411,412,415],{},"Adjacent Slot (",[27,413,414],{},"N±1",") Preloading & 0ms Thumbnail-to-HD Swap",": On click, the already-resident grid thumbnail paints onto the stage at ",[27,418,29],{}," while the ",[27,421,62],{}," WebP decodes off-thread via ",[27,424,425],{},"img.decode()"," and swaps seamlessly in place. Parallel pre-decoding of ",[27,428,429],{},"N-1",[27,431,432],{},"N+1"," makes sequential keyboard or swipe navigation equally instantaneous.",[70,435],{},[73,437,439],{"id":438},"_6-engineering-verification-architectural-impact","6. Engineering Verification & Architectural Impact",[157,441,442,448,480],{},[84,443,444,447],{},[19,445,446],{},"Reliable Retrieval Across 34,050 Mixed Assets",": Separating the immutable vector corpus from Copy-on-Write EXIF overlays eliminated re-indexing risk during metadata curation, while Dual-Path reranking and hubness damping resolved centroid dominance across all 17 benchmark queries.",[84,449,450,458,459,461,462,464,465,467,468,470,471,473,474,476,477,479],{},[19,451,452,454,455,457],{},[27,453,47],{}," Peak Latency Reduced to Perceived ",[27,456,29],{}," Swaps",": Combining the ",[27,460,62],{}," persistent WebP cache, ",[27,463,405],{}," hover prefetching, ",[27,466,414],{}," pre-decoding, and progressive thumbnail swap removed multi-second inspection stalls on both ",[27,469,299],{}," photos (",[27,472,47],{},") and ",[27,475,320],{}," plates (",[27,478,54],{},").",[84,481,482,485,486,488,489,491,492,494],{},[19,483,484],{},"Fault-Tolerant Media Cache Boundary",": Atomic disk writes paired with ",[27,487,377],{},"/",[27,490,381],{}," ",[27,493,385],{}," guards guarantee long-term cache integrity with zero negative-cache corruption in production.",{"title":155,"searchDepth":496,"depth":496,"links":497},2,[498,499,500,501,502,503],{"id":75,"depth":496,"text":76},{"id":134,"depth":496,"text":135},{"id":207,"depth":496,"text":208},{"id":252,"depth":496,"text":253},{"id":337,"depth":496,"text":338},{"id":438,"depth":496,"text":439},"/images/content-images/projects/hybrid-photo-search-engine/hybrid-photo-search-engine-cover.jpg","Project cover on a matte-black darkroom background diagramming the 34,050-asset immutable corpus, Copy-on-Write EXIF overlay, Dual-Path reranking, 1600px WebP disk cache, and 0ms progressive lightbox pipeline","2026-11-29","Hybrid search and progressive viewer engine for a 34,050-asset photo and optical book-plate archive, eliminating hubness dominance via Dual-Path reranking and turning 7,504.8ms cold-read latency into a perceived 0ms swap with a 1600px WebP disk cache.","Hybrid Search Ranking Architect · Media Cache & Progressive Viewer Engineering","Hybrid vector-lexical search engine for 34,050 photos and optical book plates with Copy-on-Write EXIF overlays and a 0ms progressive WebP lightbox.","md",true,{},7,"/en/projects/hybrid-photo-search-engine","2026.10 — Active R&D","active-rnd","Search Ranking Architect · Media Cache & Viewer Performance Engineering",{"title":5,"description":507},[520,523,526,529,532,535],{"label":521,"value":522},"Corpus Scale","34,050-asset unified archive of field photos & optical book plates",{"label":524,"value":525},"Index Separation","Immutable vector corpus + Copy-on-Write EXIF overlay layer",{"label":527,"value":528},"Search & Reranking","Dense semantic vectors + field-weighted lexical Dual-Path (17-query verified)",{"label":530,"value":531},"Latency Bottlenecks","Raw field photos 7,504.8ms (1.47MB) · Scanned plates 3,953.5ms (2.20MB)",{"label":533,"value":534},"Cache Pipeline","1600px WebP persistent disk cache + 404/422 no-store origin defense",{"label":536,"value":537},"0ms Viewer UX","120ms hover prefetch · N±1 preloading · 0ms thumbnail-to-HD swap","published","en/projects/hybrid-photo-search-engine","Media search and review engine uniting an immutable vector corpus, Copy-on-Write EXIF overlays, Dual-Path reranking, a 1600px persistent WebP cache, and a 0ms progressive lightbox",[542,543,544,545,546,547],"AI-RND","Hybrid-Search","Reranking","EXIF","WebP-Cache","Lightbox",[549,550,551,552,553,554,555],"Python","Vector Search","Dual-Path Reranking","Copy-on-Write EXIF","1600px WebP Cache","TypeScript","Progressive Lightbox","ai-rnd","4vijjJTeKAndBjUltADekSY5ki-ba_61oo4D-XPBTfc",[559],{"path":67,"title":560,"date":506,"status":538,"category":561,"buildLogLabel":562,"noindex":563},"Hybrid Search Across 34,050 Photos & Book Plates with a 0ms Progressive Lightbox","tech","34,050-Asset Dual-Path Reranking · 1600px WebP Cache · 0ms Lightbox",false,"/projects/hybrid-photo-search-engine",1796290674049]