RFR: 8236935: Improve UX of the search control

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu Jun 11 01:14:16 UTC 2020


Hannes,

Code looks good and seems to work OK.

It would be nice to see a version without the 5 second delay, but I 
guess we will see soon enough.  The 5 second delay makes clear that the 
index files are loaded for every page. I hope that once the files have 
been cached, we don't get any flashing from a message popping up to say 
that files are being loaded.

I agree with deferring the discussion on using a single index file. The 
original intent was to make it faster to load types, for which the 
perception was that these are probably the most common search items.

-- Jon

Separate/bonus discussion: triggered by thinking of the 5 second delay 
... would it work to have a "debug mode" such that the generated docs 
may contain an extra page which can be used to set cookies for the API 
presentation, which can be used to "configure" search?

On 6/10/20 2:44 PM, Hannes Wallnoefer wrote:
> 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