v133 · storage

Search Index

A client-side full-text search engine backed by IndexedDB. getAllRecords() bulk-fetches every record in one shot, then a JS filter scores results. A cursor-based fallback does the same scan record-by-record. The timing bars show why bulk fetch matters for search.

Feature detection: checking…
Database not loaded
records:
matches:
method:
Seed the database and type to search.
Timing comparison — last search
No search run yet.
// getAllRecords — bulk fetch, then JS-filter
async function searchAllRecords(query) {
  const tx = db.transaction('articles', 'readonly');
  const store = tx.objectStore('articles');
  const { records } = await store.getAllRecords(); // Chrome 133+
  return records
    .filter(r => matchesQuery(r.value, query))
    .sort(byScore);
}

// Cursor fallback — one record at a time
async function searchCursor(query) {
  return new Promise((resolve) => {
    const results = [];
    const req = store.openCursor();
    req.onsuccess = (e) => {
      const cursor = e.target.result;
      if (!cursor) { resolve(results); return; }
      if (matchesQuery(cursor.value, query)) results.push(cursor.value);
      cursor.continue();
    };
  });
}

see also

references