Practical · Local Knowledge-Base & FAQ Semantic Search Workbench

Local Knowledge-Base Index, MMR Diversity & Batch Eval

Build an offline semantic index right inside your browser with MongoDB/mdbr-leaf-ir: paste or upload .txt/.md/.json docs (auto-chunked), search with Maximal Marginal Relevance (MMR) diversity, benchmark Recall@1 & MRR on a query suite, and export formula-safe CSV/JSON.

1. Knowledge base & auto-chunking

Initialise MDBR-LEAF-IR above to index the local knowledge base.

2. Real-time Top-K Semantic Search + MMR Diversity

Indexed chunks –
Top-1 cosine –
Top-1 vs #2 margin –
Query latency –

    3. Batch Query Evaluation (Recall@1 · Recall@3 · MRR) & Exports

    Format: Query text | ExpectedDocID (one per line). Evaluates every query against the live embedded index and exports snapshot-aligned, formula-safe RFC 4180 CSV or JSON.

    Recall@1 –
    Recall@3 –
    MRR –
    Avg Pos/Neg margin –
    Batch query evaluation results
    Query Expected Top-1 Retrieved Score Rank Status

    Exact implementation code

    Show the code — Maximal Marginal Relevance (MMR) selection (leaf-core.mjs) Lines 228–276