Content revision ea31a3343577b30cee4337cf2fef2b0864a5741341f27598e9108766c486fb2d ## Find a passage in its original context AI × Self Source ID aipersonalarchive:find-a-passage-in-its-original-context Original https://www.henryw.me/#/aipersonalarchive#find-a-passage-in-its-original-context As the site grew, I added Search so visitors could quickly find relevant material across its pages. Each result shows a matching passage and opens its place on the original page. Search combines lexical and semantic retrieval. Word matching finds names and technical terms, while embeddings find passages with related meaning. A query about translating business requirements into software can therefore surface my work at HSBC without naming the company. How Search finds related material At build time, all-MiniLM-L6-v2 encodes each passage as a 384-dimensional embedding. I quantise these vectors to 8-bit values to keep the download compact. Transformers.js runs the same model in the browser to embed a query, then cosine similarity ranks the passages by meaning. Fuse.js supplies the word-match ranking. Weighted reciprocal-rank fusion combines it with the semantic ranking, giving word matches twice the weight. Using rank positions lets the two methods contribute despite their different scoring scales. Search excludes semantic matches below 0.24 cosine similarity. Adjust the threshold in the comparison to see which passages remain.