A documentation search engine needs to handle both exact error codes and descriptions of symptoms. In this example, E1042 and “workers cannot borrow a session because every slot is busy” should lead to the same page about an exhausted connection pool. The code is easy to match; the symptom uses different words from the page.
You can run both searches locally, without sending document text to a hosted embedding API. This walkthrough uses Manticore Search, a small local embedding model, and ten short documentation snippets. In one of the test cases, combining the lexical and vector rankings puts the wrong page first.
Download the complete example . It includes the fixtures, Docker Compose configuration, Python runner, captured results, and a network-isolation check. Python uses only its standard library; you do not need an ML environment or an API key.
What We Tested #
These are authored teaching fixtures, not production documentation or actual Manticore error codes. The ten snippets cover connection pools, connection refusal, TLS certificates, storage, access tokens, permissions, replication, and query deadlines. Each is one short troubleshooting section, with an ID, title, body, and exact code attribute.
For example, document 1 is:
E1042: Connection pool exhausted
All database connections are checked out. A request waits until the acquisition deadline expires. Close leaked sessions, shorten transactions, or reduce concurrent workers before increasing the pool size.
Document 2 describes connection refusal and contains the word “session.” That overlap turns out to matter.
The example was run on Linux/amd64 on October 29, 2026, with the container limited to two CPUs and 3 GiB of memory. The official image listing
identified 29.9.0 as the stable release. The download pins that tag to this image digest:
sha256:461b419739a2bbbffb4be0b32db26c41d7b435bf7fd1fce95b414ca5ccbb3775
Actual SELECT VERSION() output:
29.9.0 58e88d5ab@26091108 (columnar 14.2.1 cb282a2@26090615) (secondary 14.2.1 cb282a2@26090615) (knn 14.2.1 cb282a2@26090615) (embeddings 1.1.1 cb282a2@26090615)
The container also reported Buddy 4.4.3+26083121-976df147. The test used the stable image. These results describe retrieval on the teaching fixtures; they do not measure throughput or relevance on a real documentation corpus.
Starting the Example #
You need Docker with Compose v2, Python 3, curl, and unzip. Allow internet access for the initial image and model downloads. Use a fresh demo instance: the creates a table named docs and intentionally fails if that table already exists.
curl -fLO https://manticoresearch.com/blog/local-documentation-hybrid-search/local-documentation-hybrid-search.zip
unzip local-documentation-hybrid-search.zip
cd local-documentation-hybrid-search
docker compose up -d
until curl -fsS http://127.0.0.1:19318/sql?mode=raw \
-d 'SELECT 1' >/dev/null; do sleep 1; done
python3 demo.py --load | tee results.txt
Compose names the project and container manticore-article01. It binds HTTP port 19318 and MySQL port 19316 to loopback only. A named volume keeps the database and downloaded model cache across restarts. The Docker manual
describes the image and standard ports.
To repeat the queries without again:
python3 demo.py
The script prints every SQL statement and its database response, followed by the three result lists as IDs. It checks the fixture count and exact-code lookups. It does not assert that hybrid search must win.
Keeping Embedding Inference Local #
The runner creates this table:
CREATE TABLE docs (
title TEXT,
body TEXT,
code STRING,
vec FLOAT_VECTOR KNN_TYPE='hnsw' HNSW_SIMILARITY='cosine'
MODEL_NAME='Xenova/all-MiniLM-L6-v2'
FROM='title,body'
);
title and body are searchable text. code is a separate string attribute for an exact filter. The model embeds the title and body on insertion; the same model embeds text passed to KNN(). The KNN manual
documents auto-embeddings and the MODEL_NAME/ FROM options.
The Xenova model provides ONNX weights. Manticore runs inference inside the container, so the embeddings are self-hosted: there is no hosted embedding or LLM call in this example. For background on the feature and its implementation, see auto-embeddings and the ONNX backend article .
“Local” does not mean “nothing is downloaded.” In this run the model cache resolved to Hugging Face revision 751bff37182d3f1213fa05d7196b954e230abad9. The package records the downloaded file hashes. The SQL model name itself does not pin that revision, so future fresh downloads may differ. A second run on November 9, 2026, with a fresh download and the same image digest, produced the same four cache file hashes and identical query output. Preserve the warmed volume and cache anyway when you need this exact run.
Architecture diagram of this example, not measured output. Initial model downloads happen before the isolated runtime check.
Lexical, Vector, and Hybrid Queries #
You can run SQL through the container’s bundled MySQL client:
docker exec -it manticore-article01 mysql -h127.0.0.1 -P9306
First, the lexical query asks which documents contain the code:
SELECT id, title, weight() AS score
FROM docs WHERE MATCH('E1042')
ORDER BY score DESC, id ASC LIMIT 3;
Captured row:
id title score
1 E1042: Connection pool exhausted 1718
Next, vector search asks which snippets resemble the symptom:
SELECT id, title, knn_dist() AS distance
FROM docs
WHERE KNN(vec,10,'workers cannot borrow a session because every slot is busy')
LIMIT 3;
Captured rows, with lower cosine distance ranked first:
id title distance
1 E1042: Connection pool exhausted 0.67388809
5 E3010: Disk quota exceeded 0.7005797
6 E3011: Read-only filesystem 0.8074981
Finally, hybrid search combines the code lookup with the symptom search:
SELECT id, title, hybrid_score() AS score
FROM docs
WHERE MATCH('E1042')
AND KNN(vec,10,'workers cannot borrow a session because every slot is busy')
LIMIT 3
OPTION fusion_method='rrf', window_size=10;
Captured rows:
id title score
1 E1042: Connection pool exhausted 0.03278688
5 E3010: Disk quota exceeded 0.01612903
6 E3011: Read-only filesystem 0.01587302
The correct page was already first in both individual searches. Hybrid did not improve its rank. It did retain the vector branch’s other suggestions, even though they do not contain E1042.
With fusion_method='rrf', the MATCH and KNN clauses supply separate ranked lists for fusion. Their AND is not a requirement that each returned document match both signals. Without that option, the same statement runs as a KNN search filtered by the text match. In a test on this table, MATCH('borrow | session | busy') AND KNN(vec,3,...) without fusion_method returned only document 2, one row, with no fusion. See the hybrid search manual
for its semantics.
Where Fusion Helped and Where It Hurt #
The runner uses explicit lexical expressions rather than a hidden query parser. For symptom-only cases, I selected a few content words and joined them with | (OR); the vector branch receives the full sentence. For mixed cases, the lexical branch receives the code. These choices are part of the teaching example, not a universal query-processing recipe.
Here are all seven cases from the fresh run. Lists show the first three IDs, or fewer when lexical search has fewer matches. Titles are in fixtures.json.
| Case: lexical expression / vector text | Lexical | Vector | Hybrid |
|---|---|---|---|
E1042 /E1042 |
1 | 1, 10, 7 | 1, 10, 7 |
borrow | session | busy / workers cannot borrow a session because every slot is busy |
2 | 1, 5, 6 | 2, 1, 5 |
E1042 / workers cannot borrow a session because every slot is busy |
1 | 1, 5, 6 | 1, 5, 6 |
secure | identity | wrong / the secure endpoint presents an identity for a different domain |
none | 4, 3, 8 | 4, 3, 8 |
E1042 / renew an expired TLS certificate |
1 | 4, 3, 7 | 1, 4, 3 |
E9999 /E9999 |
none | 1, 2, 7 | 1, 2, 7 |
sourdough | starter / how to feed a sourdough starter |
none | 2, 5, 9 | 2, 5, 9 |
The pool paraphrase is the clearest regression. Vector search found document 1 first. Lexical search found document 2 because it says “session.” Document 1 says “sessions,” and this table has no stemming or morphology, so MATCH('session') returns only document 2 and MATCH('sessions') only document 1. Hybrid then promoted document 2 above document 1.
Reciprocal Rank Fusion (RRF)
adds up one contribution per list a document appears in, based on its position in that list. With the default constant of 60 and the default weight, a rank contributes 1 / (60 + rank). Document 2 is first in the lexical list, which gives 1/61 = 0.01639. It is also sixth in the vector list (distance 0.826), which adds 1/66 = 0.01515. The total, 0.03154, beats document 1, which appears only in the vector list at rank 1 and scores 0.01639. The three displayed vector rows are not the whole list: with KNN(vec,10,...) on this ten-document table, the vector search returns all ten documents.
On this table neither k nor window_size shortened the vector list. With KNN(vec,3,...) instead of 10, or with window_size=1 or window_size=3, the hybrid query still returned document 2 with 0.03154, which includes the vector-rank-6 contribution. The manual covers the first case: k does not apply to RAM chunks
, and all ten documents are in the RAM chunk. The second case does not match the manual, which says window_size sets how many results each sub-query retrieves: here it changed nothing on 29.9.0 or on the development build 29.11.3. What capped the lists was max_matches. With max_matches=3, document 2 fell to 0.01639 and lost its vector contribution, even with window_size=10. With max_matches=6, it returned to 0.03154. The test covered only this ten-document table in the RAM chunk, and these queries are not in the download, so check the window size on your own tables.
I also tested a lower lexical weight. With the query below, text weighted 0.5, document 2 still scored 0.02335 against 0.01639 for document 1, so the order did not change.
SELECT id, hybrid_score()
FROM docs
WHERE MATCH('borrow | session | busy') AS text
AND KNN(vec,10,'workers cannot borrow a session because every slot is busy') AS dense
LIMIT 10
OPTION fusion_method='rrf', window_size=10, fusion_weights=(text=0.5);
The certificate paraphrase also failed to distinguish the intended hostname mismatch (3) from expiration (4). With no lexical matches, hybrid reproduced the vector ordering. For the conflicting query, fusion put the code’s document first, but that does not resolve the contradiction in the user’s report.
The last two cases are useful checks for a search UI. An unknown code and an unrelated cooking question still returned documents. The first hybrid score for the cooking question was 0.01639344, the same rank contribution as any vector-only first-place result. An RRF score is not a confidence probability. This example provides no validated threshold for deciding whether an answer exists.
Exact Codes Need an Explicit Policy #
When a reader supplies a recognized code, you may want a direct lookup before showing related pages:
SELECT id, title FROM docs WHERE code='E1042';
That returned only document 1. The corresponding lookup for E9999 returned no rows. If a code must constrain a hybrid search, add AND code='E1042' as an attribute filter; this also returned only document 1 in the conflicting-symptom test.
Keep the distinction visible in your interface: “Exact code match” and “Related troubleshooting” serve different needs. Do not silently treat a semantic neighbor as documentation for an unknown code.
The python3 edge-cases.py checks produced these results:
MATCH('E-1042')found nothing in this schema; punctuation is not a free spelling correction forE1042.- A malformed
MATCH('(')returned HTTP 500 with a full-text parser error. KNN(vec,3,'')returned documents 10, 8, and 5. An empty query still produced results. Reject blank input in an application.
The runner’s SQL quoting is for these fixed fixtures. A public search box also needs full-text query escaping and a deliberate policy for operators; SQL string escaping alone does not provide that.
Testing the Network Boundary #
After the model, I attached the container only to an internal Docker bridge, removed its external network, and restarted it. Both a Hugging Face request and a direct-IP request failed. All seven search cases still executed, and a newly inserted document received an embedding and ranked first for “newly embedded document.” The test then deleted that extra row.
To repeat this on the warmed example:
bash offline-check.sh | tee offline-results.txt
The script temporarily removes host-port access, runs SQL through docker exec, and restores the Compose network on exit. It checks that the test network is internal and prints the attached networks. Captured evidence includes:
Connecting to 1.1.1.1:80... failed: Network is unreachable.
The fresh insert’s captured search row was:
id title knn_dist()
11 Offline insertion 0.37552971
This demonstrates cached-model inference after a restart without external access in this Docker setup. It does not demonstrate a first installation on an air-gapped machine. Keep the model cache as well as the database; this experiment did not test recovery after removing either.
Restarting the stock image with no network interface at all failed with FATAL: port 0 is out of range. The working isolation test uses an internal bridge, which provides an address without an external route.
Applying This to Your Documentation #
Start with short sections that retain their title, code, product version, and source link. This fixture set embeds one section per row; it does not establish a strategy for long manuals. Check model input limits before treating a whole page as one embedding.
Replace the fixtures with your own troubleshooting sections and keep a small review set: exact identifiers, paraphrases, similar failures, contradictory inputs, and questions your documentation cannot answer. Compare the three result lists before changing fusion weights or candidate windows. In particular, the pool paraphrase shows how a document that vector search ranks sixth can still finish first after one lexical hit.
Local inference removes the hosted embedding API from this retrieval path, but local semantic search still costs CPU, memory, model storage, and relevance-review work. For documentation like these fixtures, offer exact-code matches separately from related pages so readers can tell which kind of result they are seeing. Compare hybrid rankings with each individual search: here, fusion moved the wrong page above the right one for the pool paraphrase.
When you are finished, docker compose down stops this example and keeps its volume. Use docker compose down -v only when you want to delete this demo’s data and cached model. Neither command requires a global Docker cleanup.