RFR: 8236935: Improve UX of the search control
Hannes Wallnoefer
HANNES.WALLNOEFER at ORACLE.COM
Wed Jun 10 21:44:48 UTC 2020
Please review a fix to display a „Loading search index…“ message in javadoc search while the search index files are loading and updating the results when loading is completed.
JBS: https://bugs.openjdk.java.net/browse/JDK-8236935
Webrev: http://cr.openjdk.java.net/~hannesw/8236935/webrev.00/
This introduces an updateSearchResults function in script.js that is empty by default. When a search is performed before the index files have been fully loaded, the updateSearchResults function is replaced with a version that will update the search results when an index file is loaded and evaluated.
An invocation of updateSearchResults() is added at the end of each search index file. Also, as a consequence of this change all search index files are generated regardless of whether it is empty or not (provided the index option is enabled). This means a bit of added overhead for docs without modules or search tags, but the cost should be neglectible for a mostly empty script file.
JDK API docs generated with this patch at the URL below. These docs also feature an extra 5 second delay for loading the search index files to make it easier to test the new feature.
http://cr.openjdk.java.net/~hannesw/8236935/api.00/
One thing you might notice is that sometimes search results are updated multiple times - once for each search index file that is loaded. This is a bit annoying, and it also reminded me that loading each index in a separate file probably adds quite a bit of network and evaluation overhead. As an experiment, I created a version that combines all search indices in one single file. I’m not proposing that for 15 since it’s a bigger change that shouldn’t be rushed, but I’m including it here as a possible next step.
Single search index file (just for evaluation, not proposed for JDK 15):
Webrev: http://cr.openjdk.java.net/~hannesw/8236935/webrev.singleindex.00/
API docs: http://cr.openjdk.java.net/~hannesw/8236935/api.singleindex.00/
Hannes
More information about the javadoc-dev
mailing list