RFR: 8236935: Improve UX of the search control

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu Jun 18 20:25:36 UTC 2020


Hannes,

I played with the posted APIs again. It seems to be the case that the 
"loading" message only appeared briefly, for only as long as no search 
results are found. Once some results are found, even if not all have 
been found, the message goes away.   After the message goes away, the 
search results may still get updated when other files have been 
loaded.   It is reasonable to continue updates, but I think it would be 
nicer if the 'loading' message persisted until all the files have been 
loaded.

The behavior I observe seems to be confirmed by this extract from the code:

311 if (result.length === 0) {
312 result.push(loading);
313 }

Does it work to just remove the `if (expr)` ? It is already the case 
that this code is protected inside `if (!indexFilesLoaded()) ...`

-- Jon

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/javadoc-dev/attachments/20200618/fbb542a6/attachment-0001.htm>


More information about the javadoc-dev mailing list