# receipts evidence 007 # kind: note # represents: The browser script used for the store comparison in evidence 008: same questions to both stores, prints counts, ranks and score differences only # name: compare-script # at: 2026-11-14T01:34:25Z # --- // Run in the browser on DriveIQ (logged in through Cloudflare Access), 2026-11-13. // Sends each question to DriveIQ's POST /api/search twice, once per store // (`backend: "qdrant"` / `"vectorize"`), limit 8 — what Aiana is given. // Prints counts, ranks and score differences only: no document names, no text. const labeled = [ // question -> Owner's Manual pages whose text answers it ['How much oil does the engine take?', [465]], ['What oil viscosity should I use?', [465]], ['How do I turn on the windshield defroster?', [283, 284, 287, 289, 290, 294]], ['What should my tire pressure be?', [423, 472]], ['How big is the fuel tank?', [14, 464, 528]], ['How do I reset the maintenance required light?', [6, 345, 428, 461, 462, 519, 522, 525]], ['How do I shift into 4WD low?', [239, 240, 241, 243, 250, 251]], ['How do I jump start the car?', [453]], ['What coolant does it use?', [350, 359, 468]], ['What is the towing capacity?', [175, 178, 179, 180, 181, 182, 183, 189, 190, 462]], ['How do I install a child seat with LATCH?', [38, 53, 57, 59, 60, 61, 64, 66, 67, 68, 518, 521]], ['How do I replace the wiper blades?', [284, 291, 348]], ['What does the slip indicator light mean?', [77, 79, 244, 246, 251, 253, 264, 271, 418, 526]], ]; const unlabeled = ['how do i turn on my defrost', 'how often should i replace my shocks and struts?', 'What oil does it take, and how much?', 'when is my next oil change due?', 'is there an open recall?']; const search = async (q, backend) => { const r = await fetch('/api/search', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ query: q, limit: 8, backend }) }); return { status: r.status, hits: r.ok ? await r.json() : [] }; }; const key = (h) => `${h.document_name}#${h.chunk_index}`; const lines = []; let same = 0, identicalTop8 = 0, diffSum = 0, diffN = 0, rankMatch = 0; for (const [q, pages] of [...labeled, ...unlabeled.map((q) => [q, null])]) { const [a, b] = await Promise.all([search(q, 'qdrant'), search(q, 'vectorize')]); const bScore = new Map(b.hits.map((h) => [key(h), h.score])); const overlap = a.hits.filter((h) => bScore.has(key(h))).length; a.hits.forEach((h) => { if (bScore.has(key(h))) { diffSum += Math.abs(bScore.get(key(h)) - h.score); diffN++; } }); const sameOrder = a.hits.length === b.hits.length && a.hits.every((h, i) => key(h) === key(b.hits[i])); if (overlap === Math.max(a.hits.length, b.hits.length)) identicalTop8++; if (sameOrder) same++; let ranks = ''; if (pages) { const rank = (hits) => { const i = hits.filter((h) => h.document_name === "Owner's Manual").findIndex((h) => pages.includes(h.page_number)); return i < 0 ? '-' : i + 1; }; const rq = rank(a.hits), rv = rank(b.hits); if (rq === rv) rankMatch++; ranks = ` first answering manual page: qdrant ${rq}, vectorize ${rv}`; } lines.push(`${q}\n status ${a.status}/${b.status} same results in top 8: ${overlap}/${Math.max(a.hits.length, b.hits.length)} same order: ${sameOrder}${ranks}`); } lines.push('', `questions: ${labeled.length + unlabeled.length}`, `identical top-8 sets: ${identicalTop8}`, `identical top-8 order: ${same}`, `labeled questions with the same first-answering-page rank: ${rankMatch}/${labeled.length}`, `mean |score difference| for shared results: ${(diffSum / diffN).toFixed(4)} over ${diffN} results`); lines.join('\n');