| 337 | }; |
| 338 | |
| 339 | const loadIndex = async () => { |
| 340 | if (indexLoaded || indexLoading) return; |
| 341 | indexLoading = true; |
| 342 | try { |
| 343 | const response = await fetch("/search.json", { cache: "no-store" }); |
| 344 | if (response.ok) { |
| 345 | docsIndex = await response.json(); |
| 346 | indexLoaded = true; |
| 347 | } |
| 348 | } catch (e) { |
| 349 | // eslint-disable-next-line no-console |
| 350 | console.error("Failed to load docs search index", e); |
| 351 | } finally { |
| 352 | indexLoading = false; |
| 353 | } |
| 354 | }; |
| 355 | |
| 356 | const performSearch = async (query) => { |
| 357 | const q = query.trim().toLowerCase(); |