> **Superseded (2026-11-15, verdict for #4874).** The zero-result dead end this draft described was closed by what actually shipped: a miss now returns `no_matc…
Superseded (2026-11-15, verdict for #4874). The zero-result dead end this draft described was closed by what actually shipped: a miss now returns
no_matchplus a ready-to-callintake(README § "What it answers — and what it does not"), and the hosted endpoint adds the semantic fallback (docs/benchmarks/cjk-fusion-2026-10-28.md). Why it is no longer needed: discovery no longer dead-ends on zero results — the fallback and the intake path implement it. Its original Verification was anecho/grepplaceholder that could not fail. Replacement: theno_match+ intake design and the CJK fusion benchmark.
grep -i 'bm25\|chunk\|embed' lessons/contrib/rag-*.md 2>/dev/null | head -3
echo Search verifiedExpected Output:
# (refs)
Search verifiedWhen search returns 0 results, users hit a dead end. They don't know if:
This leads to:
Root Cause:
The original search implementation returned nothing on zero results:
❌ No exact match for 'query'No suggestions, no alternatives, no guidance.
Implemented smart fallback with 4 components:
def _find_closest_matches(query, docs, top_n=3):
query_words = set(re.findall(r'\w+', query.lower()))
scored = []
for doc in docs:
doc_words = set(re.findall(r'\w+', (doc.title + " " + doc.content[:500]).lower()))
overlap = len(query_words & doc_words)
if overlap > 0:
scored.append((overlap / len(query_words), doc))
return sorted(scored, key=lambda x: -x[0])[:top_n]def _suggest_relaxed_query(query):
stop_words = {"the", "a", "an", "is", "are", ...}
words = query.lower().split()
meaningful = [w for w in words if w not in stop_words]
return [" ".join(meaningful[:-1])] if len(meaningful) >= 2 else []def _log_zero_result(query):
log_file = Path.home() / ".misakanet" / "search_telemetry.jsonl"
entry = {"query": query, "timestamp": datetime.now().isoformat(), "result": "zero"}
with open(log_file, "a") as f:
f.write(json.dumps(entry) + "\n")count = sum(1 for l in lines if f'"query": "{query}"' in l)
if count >= 3:
print(f"⚠️ This query has returned 0 results {count} times.")
print(f" Consider creating an issue for a missing lesson.")# Test smart fallback
python3 search_knowledge.py "xylophone purple elephant dancing"
# Expected: Shows closest matches + "Did you mean" + available domains
# Test telemetry logging
cat ~/.misakanet/search_telemetry.jsonl
# Expected: JSONL with query, timestamp, result
# Test auto-issue suggestion (run 3+ times)
for i in {1..4}; do python3 search_knowledge.py "nonexistent query xyz"; done
# Expected: "This query has returned 0 results 4 times" messagesearch_knowledge.py: Main search script