search within ~10 seconds of page load is very slow
Operation System: (Windows or Linux or MacOS)
Windows
DocFX Version Used:
All of them
Template used: (default or statictoc or contain custom template)
default
Steps to Reproduce:
- browse to https://aka.ms/kusto
- any search within the ~10 seconds of page load will return only after 10 seconds passed from time page loads.
Expected Behavior: wait less than a second. This is very common in documentation websites to load the page and the immediately search. Actual Behavior: wait for more than 10 seconds
Looks like the issue is that lunr.js is building the index on-the-fly on page-load in a search-worker.js. but this is a static website - the index can be persisted and then just loaded instead of building an index every time.
here is documentation on that from lunr.js website on how to use pre-build indexes.
+1
Just to clarify, this slowness doesn't seem to be during the first search per se, but rather during the first ~8 seconds after each page load. So a more exact repro would be: Any searches within ~8 seconds of page load will be incredibly slow, lasting up to ~8 seconds, and any searches after that will be fast.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.
Any update on this issue?
Sorry for the late reply. Looks like prebuild index can help. Although the index could be large that slows down the first lunch, it should improve the following searching.
This issue is also affecting the internal Geneva documentation (https://genevamondocs.azurewebsites.net/), where the search feature can take >30 seconds to start working after any page load
Added a browser cache to speed up page load speed for subsequent visits. The first page view still builds the index in the browser and is slow.