Measurements are from my documents and hardware on 1-2 December 2026.
Finding a specific PDF on a home NAS is strangely annoying. I live in Germany, so my UGREEN DXP4800 Plus holds a few years of bilingual paperwork: tax assessments, utility statements, payslips, contracts, receipts, and markdown notes. Half of them are in English, a third are in German, some are scans with no text layer, and filenames rarely match what I remember when I need a document.
This isn't my first attempt at the problem. I previously built DocFlare, a document Q&A app that ran on Cloudflare's edge. It worked well for chatting with PDFs while keeping everything inside my own Cloudflare account, but for my full archive of personal paperwork sitting on my NAS, I wanted something completely local and instant to search. I do have an RTX 3060 homelab box, but I don't leave it powered on all day, so the search service had to run on the NAS itself: an Intel Pentium Gold 8505 CPU, 8 GB of RAM (with Immich already using 3.1 GB), and no discrete GPU.
I wanted local search over that entire folder: semantic queries ("how much did I pay for health insurance"), cross-lingual queries (English query against a German scan), and exact lookups (a 10-digit tracking number). The two hard constraints stayed the same throughout: no document leaves my network, and queries run on the NAS, 24/7, with no GPU.
The short version:
- My files were much smaller than the architecture debate. After measuring what was actually on disk, the whole index came out to 5,362 text chunks and 338 images (~42 MB). Checking my query against every single chunk in memory with NumPy takes about 1 ms, so I skipped vector databases entirely.
- I index on my MacBook Air M4 and query on the NAS. Google's EmbeddingGemma 2 lets you load a 440M text+vision model for indexing and a 270M text-only slice for querying from the same model weights. I verified that both produce virtually identical text vectors and return the exact same top result 100% of the time.
- Multimodal indexes have a hidden text bias. Putting text chunks and page images in one combined list favours text scores over image scores (+0.033 higher on average), which buries scanned pages. Keeping them in separate lists and combining them by rank instead of raw score fixed it.
- My worst bugs were in the data and the plumbing. A one-line chunker bug inflated the index 10×, an alphabetical tie-breaker dropped hit@1 by 30 points, and a cross-encoder reranker I spent two days on turned out to be chasing a mistake in my own ground-truth labels.
Final numbers on my 23-query eval: 78% hit@1, 100% hit@3, 100% recall@10, MRR 0.891, median (p50) latency 146 ms, running in 1.7 GB of RAM inside a single Docker container on the NAS. (I'll explain what those metrics mean in a moment.)
In this post, I'll walk you through how I measured what was actually on disk, how the indexing and query split works, the bugs I hit along the way, and what the eval numbers actually looked like. The full code is open source on GitHub at harshil1712/docsearch.
Measure your files before debating the architecture
Before touching any code, I spent way too long comparing runtimes: llama.cpp vs ONNX vs OpenVINO, Qdrant vs sqlite-vec, Intel iGPU vs CPU. Then I actually counted the files on the NAS.
My documents folder looked huge at first glance (23 GB), until I noticed 22 GB of it was a Projects directory full of binaries with almost no searchable text. Excluding that, here is what I actually had to index:
| Metric | Value |
|---|---|
| Total files | 874 (0.92 GB) |
| PDFs | 484 (2,628 pages) |
| PDFs with a text layer | 443 |
| Scanned PDFs (no text layer) | 41 (8.5%) |
| Encrypted PDFs | 4 (skipped) |
| Standalone images (JPG/PNG) | 254 |
| Markdown notes | 79 |
| Languages (443 text PDFs) | English (311), German (164), plus a handful of files in non-Latin scripts like Gujarati |
| Estimated tokens | ~668,000 |
That single measurement settled half the architectural debate:
- No vector database. Qdrant's local mode uses ~2.9 GB of RAM for 100k vectors on a machine with ~4.5 GB free. With ~5,000 vectors, all of them fit in ~16 MB of RAM. Comparing a query against every single one with NumPy (
tv @ qv) takes about 1 ms, so a vector database would just waste memory. - No iGPU inference on the NAS. The Pentium 8505's built-in Intel graphics chip is too weak for AI inference (
llama.cpp's own docs warn against anything under 80 execution units, and this one has 48), and it shares the same 8 GB of system RAM anyway. - No English-only models. Over a third of the PDFs are in German, plus a handful of files in non-Latin scripts. Models like
bge-base-en-v1.5were out immediately.
Out of curiosity, I also checked what indexing these files in the cloud would cost. On Cloudflare Workers AI, @cf/google/embeddinggemma-2 is priced at $0.0017 per million input tokens. For my ~668k tokens, indexing everything would cost $0.001 (a tenth of a cent), well inside the daily free tier. Even with zero data retention enabled, saving a tenth of a cent is a pretty weak reason to send German tax assessments and payslips off your own network.
Splitting the work: index on a Mac, query on the NAS
The model that made this setup practical is EmbeddingGemma 2 (google/embeddinggemma-2, released October 2026 under Apache 2.0). It's an embedding model, meaning it turns text or images into vectors (lists of numbers) where similar content ends up close together. It produces 768-dimensional vectors across an 8,192-token context window, supports 100+ languages, and can load only the encoders you need from the same model weights:
| Setup | config_kwargs | Parameters |
|---|---|---|
| Text only | {"vision_config": None, "audio_config": None} | 270M |
| Text + image | {"audio_config": None} | 440M |
| Text + audio | {"vision_config": None} | 570M |
| Full | {} | 740M |
Google's model card states that a query embedded with the 270M text-only configuration can be matched directly against documents embedded with the full model. That is the key claim for a split architecture: if it holds, my MacBook Air M4 can do the heavier indexing (text and images) in bfloat16, and the NAS only ever needs the smaller 270M text-only part in float32 to embed a single short search query.
Note: EmbeddingGemma 2 breaks on float16 precision. It has to run in bfloat16 or float32.
I tested this on 60 real chunks from 29 documents across all four variants, comparing document vectors pairwise and checking retrieval agreement:
| Comparison | Mean cosine | Top-1 agreement vs 270M |
|---|---|---|
| Full 740M bf16 vs text-only 270M fp32 | 1.0003 | 100.0% |
| Text+vision 440M bf16 vs text-only 270M fp32 | 1.0003 | 100.0% |
| Text-only 270M bf16 vs text-only 270M fp32 | 1.0003 | 100.0% |
(The 1.0003 is just floating-point rounding noise, so the vectors are effectively identical.) The text part uses the exact same weights whether or not the vision encoder is loaded, and bf16 vs fp32 made no practical difference.
That gave me a clean split between batch indexing and live querying:
INDEXING (batch, ~25 min, MacBook Air M4 / MPS) text PDFs + notes ──pdftotext──► chunks ─┐ scanned PDFs ──pdftoppm───► pages ─┼──► EG2 440M text+vision (bf16) standalone images ─────────────► imgs ─┘ │ ▼ text_vecs.npy + img_vecs.npy + fts.db (~42 MB, shipped to NAS) QUERY (every search, NAS CPU only, no GPU, no internet) query ──► EG2 270M text-only (fp32) ──► 768-d vector │ ┌─────────┼──────────┐ ▼ ▼ ▼ text vecs image vecs BM25 (SQLite FTS5, path-weighted) └─────────┼──────────┘ ▼ hybrid fusion (rank + score) ──► confidence gate ──► hits (~150 ms) One runtime gotcha along the way: I initially planned to run ONNX int8 on the NAS to save RAM, since fastembed/ONNX is faster on CPU than PyTorch. Installing sentence-transformers[onnx] silently downgraded sentence-transformers from 6.3.0 to 5.7.0 and pulled an older transformers that did not recognise the embedding_gemma2 architecture. I dropped ONNX and ran plain CPU PyTorch in fp32 inside the container. Because the query workload is one short string at a time, fp32 takes ~150 ms and 1.7 GB of RAM, leaving ~2.8 GB of headroom alongside Immich with no risk of losing accuracy from compressing the model weights.
Visual retrieval for scans, and the text bias nobody mentions
41 of my PDFs had no text layer at all. The usual move is to run OCR (optical character recognition) on them and index the extracted text, which works until a crooked scan or low-contrast German form turns into garbled words. With EmbeddingGemma 2's vision encoder, I could render the first three pages of each scanned PDF with pdftoppm and embed the page images directly into the same vector space as the text.
I tested this before building the pipeline: page 1 of 5 scanned PDFs plus 30 regular text chunks mixed in, all in one index, queried in natural language with ground truth established by opening the PDFs myself.
In that mixed index, it only got 3 out of 5. Both failures lost to text chunks, with the right scanned page buried at rank 5 and rank 17.
To figure out whether image resolution or language was to blame, I reran the queries against the 5 page images alone at three different render sizes:
| Query | Rank @1100 px | @1600 px | @2400 px |
|---|---|---|---|
| "how much income tax did I owe" (EN) | 1 | 1 | 1 |
| "Einkommensteuerbescheid Finanzamt" (DE) | 1 | 1 | 1 |
| "Nebenkostenabrechnung Heizkosten Wohnung" (DE) | 1 | 1 | 1 |
| "utility costs and heating statement" (EN) | 1 | 1 | 1 |
4 out of 4 at rank 1, and resolution did not matter. The cosine scores were identical to three decimal places from 1100 px to 2400 px. Cross-lingual visual retrieval worked too: asking in English pulled up the exact German tax assessment and heating statement with no OCR involved.
So the image embeddings were fine. The problem was putting text and image vectors into one list sorted by raw cosine similarity (the score that says how close two vectors are). I scored the same 10 text queries against image documents and text documents separately:
| Target index | Mean max cosine similarity |
|---|---|
| Text query → image docs | 0.641 |
| Text query → text docs | 0.674 |
Across the 10 queries, text chunks sat +0.033 higher on average (ranging from −0.058 to +0.089). When you sort a single combined index by raw cosine, text wins 60% of close calls just because it's text, like the query.
This was the most transferable finding of the whole project: a multimodal index isn't plug-and-play. Keeping text vectors (text_vecs.npy) and image vectors (img_vecs.npy) in separate files and fusing their top-50 lists by rank removes that text bias completely. Once deployed, scanned pages started ranking right alongside text hits for the same queries.
The messy PDFs: glyph soup, a 10× chunker bug, and OCR as a backup
Real personal documents find creative ways to break extraction pipelines. Three things bit me during indexing.
Glyph soup: a text layer that isn't text
Ten PDFs, including some of my most frequently needed files, passed the "has a text layer" check because pdftotext returned plenty of characters. When I actually looked at the chunks, they looked something like this (a made-up example of what raw glyph-index output looks like):
GHH H G H IG H G F H G HH H I G GH H I F H H I GG H I J HH G H H G I H GG H G J G F G G H I GG I F J G H I F G GH I G J J G These PDFs embed custom fonts without a ToUnicode CMap (the lookup table that maps glyph IDs back to real characters), so pdftotext dumps raw glyph indices instead of readable letters. 61 chunks of that were sitting in my index, unsearchable and polluting the keyword index.
Real English and German text runs around 38-45% vowels; glyph soup runs under 15% and is packed with 1- and 2-character tokens. I added a detector in extract.py with one important guard for non-Latin scripts, so legitimate Gujarati text would not get flagged for having no Latin vowels:
VOWELS = set("aeiouyäöüàáâãåæéèêëíìîïóòôõøúùûüýÿ") def is_glyph_soup(text): toks = text.split() if len(toks) < 40: return False short = sum(1 for t in toks if len(t) <= 2) / len(toks) alpha = [c for c in text if c.isalpha()] if not alpha: return True latin = [c for c in alpha if ord(c) < 0x250] if len(latin) < 0.6 * len(alpha): return short > 0.55 vowels = sum(1 for c in latin if c.lower() in VOWELS) return short > 0.50 or (vowels / len(latin)) < 0.20 Any PDF whose extracted text triggers is_glyph_soup() gets routed to the scanned-PDF path and embedded as page images instead; partially affected files keep their clean chunks and drop the bad ones. That moved 7 PDFs to image embedding, dropped 104 garbage chunks, and made those files retrievable for the first time.
The chunker that inflated the index 10×
My first chunker advanced through each document with i += max(1, len(piece) - OVERLAP). That looks safe, but it has a nasty edge case. Whenever a document or tail piece was shorter than the 200-character overlap, the loop stepped forward one character at a time, emitting a near-duplicate chunk at every position.
That turned ~5,200 real chunks into 55,780 chunks (50,124 of them under 200 characters, median length 155). Fixing the loop to break whenever step <= 0 or the end of the text is reached dropped it back to 5,240 chunks (median 1,373 characters).
Adding OCR back as a second index
Visual embeddings handled semantic queries over scanned pages well, even across languages. Where they fell short was exact strings inside a scan, like a 10-digit tracking number printed on a scanned shipping receipt. The vision model knew the page was a shipping receipt, so it could find the document, but it could not match an arbitrary 10-digit number.
So I ran Tesseract (deu+eng) over the 338 rendered pages and standalone images and appended the 237 usable text chunks into the text and SQLite FTS5 (full-text search) index (171 files were cleanly skipped, mostly photos with no text).
(Quick metric primer, since the tables use them throughout: hit@1 and hit@3 measure whether a correct document appears in the top 1 or top 3 results; recall@10 measures whether it appears anywhere in the top 10; MRR (Mean Reciprocal Rank) averages 1/rank of the first correct hit across queries, so it rewards ranking the right answer near the top.)
The difference on my 23-query eval was immediate:
| Metric | Without OCR | With OCR (secondary) |
|---|---|---|
| hit@1 | 65% | 78% |
| hit@3 | 87% | 96% |
| MRR | 0.772 | 0.870 |
| Exact-identifier queries | 3/4 | 4/4 |
OCR runs alongside the image vectors as a backup index rather than replacing them. If Tesseract mangles a degraded scan, the page image vector still retrieves the document; when Tesseract succeeds, BM25 gets exact strings like invoice numbers and IBANs.
Hybrid fusion, tie-breaking, and a 30-point bug
Each query runs three retrievers on the NAS and pulls the top 50 candidates from each:
- Text vector search (
text_vecs @ qv, NumPy): embedding similarity over text chunks - Image vector search (
img_vecs @ qv, NumPy): embedding similarity over rendered pages and standalone images - BM25 over SQLite FTS5: classic keyword ranking (BM25 scores how often query terms appear in a document, weighted by how rare they are; FTS5 is SQLite's built-in full-text search engine), configured with
tokenize='unicode61 remove_diacritics 2'and the file path column weighted 2× over the body text because folder and file names carry strong signal.
Getting the fusion right uncovered three subtle issues.
1. Row IDs quietly falling out of sync
After filtering out bad chunks, I rewrote docs_text.jsonl compactly (rows 0..N-1) without rebuilding the FTS5 table's rowids. SQLite kept returning the old rowids, which then indexed into the wrong entries in docs_text.jsonl. Nothing crashed and no error was logged. BM25 just quietly returned unrelated files. I only caught it when a tracking-number query returned a payslip PDF even though querying FTS directly found the shipping receipt.
2. Global BM25 weights vs identifier queries
To merge three ranked lists into one, I used Reciprocal Rank Fusion (RRF), a standard technique that gives each candidate a score of w / (K + rank + 1) based on where it appeared in each list. With pure RRF, scores depend only on rank. If W_TEXT = 1.0 and W_BM25 = 0.8, a perfect BM25 rank-1 match (0.8 / 61 = 0.0131) can never beat a vector-search rank-1 match (1.0 / 61 = 0.0164). Exact identifiers can never win, no matter how exact the match is.
My first instinct was to raise W_BM25 globally. Sweeping it from 0.8 to 2.5 was a disaster:
W_BM25 | hit@1 | hit@3 | MRR |
|---|---|---|---|
| 0.8 | 78% | 96% | 0.870 |
| 1.2 | 57% | 65% | 0.623 |
| 1.6 | 57% | 65% | 0.623 |
| 2.0 | 57% | 65% | 0.623 |
| 2.5 | 57% | 65% | 0.623 |
The moment BM25 outweighs vector search globally, keyword overlap on common words ("how much did I pay for health insurance") drowns out semantic hits.
The fix had to be conditional: keep W_BM25 = 0.8 for normal queries, and detect identifier-shaped queries (any token with 6+ digits, or a quoted phrase) to flip the weights to (0.4, 0.3, 3.0). I also switched from pure rank-only fusion to a 50/50 blend (FUSION=hybrid, α=0.5) of rank and normalised score, so a standout match in one list can actually carry weight.
3. A 30-point swing from one line of sorting code
Qdrant's hybrid-search docs mention that roughly 12.5% of RRF top-10 results share an identical fused score with their neighbour. To make ordering deterministic, I broke ties by sorting on the tuple (list_name, idx).
In alphabetical order, "bm25" comes before "img", which comes before "text". That single line silently promoted BM25 on every tie:
| Tie-break rule | hit@1 | MRR |
|---|---|---|
| Implicit insertion order | 78% | 0.891 |
| Alphabetical by list name | 48% | 0.739 |
Explicit list priority (text → img → bm25) | 78% | 0.891 |
A 30-point drop in hit@1 from a tie-breaker. Breaking ties by explicit priority ({"text": 0, "img": 1, "bm25": 2}) brought it straight back:
prio = {"text": 0, "img": 1, "bm25": 2} cand = sorted( fused.items(), key=lambda x: (-x[1], prio.get(x[0][0], 9), x[0][1]), )[:k] The reranker that made things worse
At this point, 22 of my 23 eval queries were hitting in the top 3. The one remaining miss was "how much did I pay for health insurance". It looked like a textbook job for a second-stage cross-encoder reranker: a model that takes the query and each candidate chunk together and rescores them more carefully than vector similarity can.
I benchmarked two multilingual cross-encoders on the NAS CPU (4 threads):
| Model | Params | 8 candidates | 20 candidates |
|---|---|---|---|
cross-encoder/mmarco-mMiniLMv2-L12-H384-v1 | 118M | 178 ms | 409 ms |
BAAI/bge-reranker-base | 278M | 617 ms | 1,477 ms |
mmarco-mMiniLMv2 was 3.6× faster, and on a synthetic test of the failing query it put the health-insurance certificate straight at rank 1. I wired it in behind RERANK_N=16 and ran the full eval against the live container.
It made everything worse:
| Metric | Without reranker | With reranker |
|---|---|---|
| hit@1 | 78% | 65% |
| hit@3 | 96% | 83% |
| Median latency | 150 ms | 4,151 ms |
27× slower and 13 points worse on hit@1 and hit@3. Three separate things went wrong:
- A reranker can't find a document that wasn't in its input. Tracing the query showed my expected policy certificate was sitting at vector rank 86. Reranking the top 16 candidates could never reach it.
- A model trained on web search didn't handle German paperwork well. The cross-encoder was trained on MS MARCO web search passages, and on my files it collapsed one query down to a single surviving hit and ranked three payslips above a notes file whose filename literally matched the query.
- My latency benchmark lied. The 20 ms/pair number came from 100-character synthetic strings. Production feeds 1,500-character chunks into a transformer cross-encoder, which took ~250 ms/pair, hence 4.1 seconds.
I turned the reranker off by default (RERANK_N=0, still in search.py if I want to retest later with a larger candidate pool and stronger model).
One useful thing did come out of that detour: unanswerable queries. Asking for "sourdough bread recipe" returned an unrelated recipe, and "quantum chromodynamics" returned an old notes file, with no indication that the service was guessing. Checking the max vector similarity that was already computed for every query showed a clean split:
| Query type | Max vector similarity |
|---|---|
| Answerable (12 queries) | 0.717 – 0.817 |
| Unanswerable (6 queries) | 0.590 – 0.699 |
Setting MIN_SIM = 0.70 costs one float comparison, zero extra RAM, and zero latency. When best_sim < 0.70 (with a bypass for identifier queries, since bare numbers embed to noise and are answered by BM25), the API returns confident: false and the client tells me there is no confident match.
The miss was in my labels
After turning off the reranker, I still wanted to fix that one remaining miss ("how much did I pay for health insurance"). I traced it through every stage, rewrote the fusion formula, tested prepending filename headers to chunks (title: <filename> | text: ..., which only moved cosine from 0.647 to 0.658), and spent two days tuning.
Then I finally checked what the system was actually returning at ranks 2-5: my monthly payslips. I opened one.
91 payslip chunks already contain an actual health-insurance contribution line.
The question "how much did I pay for health insurance" is directly answered by a payslip. My hand-written ground truth had only listed the policy certificates. That's a valid answer, just not the only one or even the best one. The "miss" I built a reranker and a fusion rewrite to chase was a mistake in my own eval labels.
Updating the ground truth to accept payslips brought the eval to:
| Metric | Value |
|---|---|
| hit@1 | 78% (18/23) |
| hit@3 | 100% (23/23) |
| hit@5 | 100% (23/23) |
| recall@10 | 100% (23/23) |
| MRR | 0.891 |
| Latency | median (p50) 146 ms, p95 185 ms |
| Container RAM | 1.73 GiB (3 GiB limit) |
Every category hit 100% at top-3: German semantic 7/7, English semantic 6/6, exact identifiers 4/4, scanned pages 3/3, and entities 3/3.
Making it usable: Tinycast, /file, and hardening
My first build shipped a dark-mode HTML page on port 8081. That technically solved "search my documents", but it missed the actual job, which is "open that PDF right now without switching to a browser tab."
I use Tinycast (a native macOS launcher that runs prebuilt Raycast bundles in SwiftUI), so I wrote a 20 KB CommonJS extension (extension/search-documents.js) with no build step and no node_modules. Typing in the palette queries /api/search on the NAS, shows whether the hit came from a text chunk or a scanned page, displays a "No confident match" banner when confident: false, and opens the document on Enter.
One snag: my NAS SMB share rejects guest auth, so the share isn't always mounted on my Mac. To make Enter work either way, I added a GET /file?path=... endpoint to search.py. If the SMB mount is present, the extension opens the local path directly; otherwise it downloads the file into a 0700 per-session temp directory (0600 file mode) and opens it.
Because the Docker volume mounts my entire NAS home directory (:ro), exposing /file needed real guardrails:
- Indexed-path allowlist:
/fileonly serves paths that actually exist indocs_text.jsonlordocs_img.jsonl(normalised so German umlauts match regardless of how macOS or Linux encodes them). Dotfiles like.ssh/,.bash_history, and.envare never indexed and always return404. - Path traversal protection: Uses
realpathto resolve symlinks and verify the target stays under the document root directory. Traversal attempts (../../etc/passwd,/etc/passwd, URL-encoded..%2f) all return404instead of403, so the endpoint does not confirm file existence. - Safe file types only: Only document/image MIME types are served inline; everything else is forced to
attachmentwithContent-Security-Policy: default-src 'none'; sandbox. On the Mac side, the extension only passes known safe document extensions (.pdf,.png,.jpg,.md, etc.) to macOSopen; anything executable like.commandor.terminalis revealed in Finder instead. - Container hardening: Bound to
127.0.0.1by default, read-only root filesystem,cap_drop: [ALL](dropping all Linux capabilities so the container can't bypass file permissions to read private files in the mounted home folder),no-new-privileges:true, optional bearer token (DOCSEARCH_TOKEN), andHostheader allowlist against DNS rebinding.
Two other operational gotchas worth saving someone else from:
-
docker compose up -ddoes not rebuild the image. Sincesearch.pyis baked into the container, editing it without runningdocker compose buildsilently runs the old code. That cost me two tuning sweeps before I noticed. - Keep staging files outside the documents folder. Writing rendered pages into a
pages/folder inside the documents directory got them indexed as standalone images, and after I deleted them from the index, the OCR pass quietly re-added them from staging.
What I'd tell anyone building local search
- Count your files first. Measuring 874 files and ~5k chunks immediately eliminated a vector database, an iGPU setup, and most of the infrastructure debate.
- Test whether two model setups really share the same vectors. One 60-chunk script proved the Mac-index / NAS-query split works at 1.0003 cosine, saving me from trying to run a 440M vision encoder on a Pentium CPU.
- Don't mix text and image vectors in one raw-cosine list. The +0.033 text bias silently buries scanned pages. Keep text and image indexes separate and fuse on rank.
- Use OCR as a secondary index. Visual embeddings handle messy scans and cross-lingual queries; OCR feeds exact numbers into BM25. Neither has to be a single point of failure.
- Audit your ground truth before building infrastructure for a failing query. Five minutes of checking whether payslips contained health-insurance amounts would have saved a reranker, a fusion rewrite, and two days.
- Benchmark with production-shaped inputs. A 100-character synthetic latency test hid a 12× slowdown on real 1,500-character chunks.
- Make fusion tie-breakers explicit. A large share of top-10 RRF results tie; letting alphabetical sorting decide cost 30 points of hit@1.
What's next?
The weakest part of the setup right now is the 23-query eval set. Because it's saturated at 100% recall@10, it can no longer tell a good change from a bad one. Five different fusion settings all scored identically on it.
Before changing anything else, I want to collect 150+ real queries from daily use in Tinycast and expand the test set. Once that exists, a few things are worth testing:
- Chunk size and overlap. I currently use 1,400-character chunks with 200-character overlap. Published retrieval benchmarks suggest smaller chunks with zero overlap can improve precision, and a full re-embed takes ~25 minutes per variant.
- Metadata filters. Adding
year:andpath:filters is cheap since the metadata is already in the index, and it's probably more useful day to day than any ranking tweak. - Thin confidence margin.
MIN_SIM = 0.70was calibrated on only 18 queries (0.699 vs 0.717 is a narrow gap), so it needs revisiting on a larger set. - Incremental indexing. Right now re-indexing is a full ~25-minute batch run on the Mac, which is fine at 5k chunks, though content-hash skipping would make updates faster as the folder grows.
The full indexing pipeline, search service, Docker setup, and Tinycast extension are all in harshil1712/docsearch. If you're running local search on a NAS or experimenting with EmbeddingGemma 2, I'd love to hear how your setup compares. Feel free to reach out to me on X/Twitter.
Further reading: