On Fri, 20 Nov 2020 15:00:56 GMT, Hannes Wallnöfer <hann...@openjdk.org> wrote:
> This PR softens the case-sensitivity rules in Javadoc searches by including > results of case-insensitive search if a case-sensitive yields no or very few > results. > > Changes also include some restructuring of the search.js code along with > minor changes that improve compliance with the specification (Segments > separated by `_` are ranked the same way as segments of CamelCase > identifiers, and matches on such segments are ranked lower than matches for > whole identifiers, which wasn't always the case previously) > > The `TestSearchScript.java` test, which has been disabled with the removal of > Nashorn, has been updated to run without failure. In the process, I noticed > that the recent IndexBuilder|Writer|Item refactoring, comparators have been > unified to the point that the same item order is used in HTML index pages and > the search index JSON files. However, there used to be slight differences in > the sorting between the two. This change restores the original order by > adding two simple search index comparators to `IndexBuilder.java`. > > API documentation generated with this PR applied can be viewed and tested > here: > http://cr.openjdk.java.net/~hannesw/8244535/api.01/ There is a certain amount of "two steps forward, one step back" here. Yes, this is a good fix to the regression, so approved, and maybe it was an embarrassing convenience that the search test was disabled for the IndexBuilder work, but it is retrograde in that we're going back to a world with different sort orders for the static index pages, and interactive search. FWIW, I like the conciseness of the change, which also helps highlight when comparators would be different ... i.e. for type elements with the same simple name. With that in mind, I came up with the "test case" for when the comparators are different: the `ToolProvider` class, which is in both `java.util.spi` and `java.tools`, and these two instances sort differently in the two presentations. Bottom line: this is a good fix, and a step in the right direction, but we should follow up with another fix to have the static index pages sort the same as the index pages. I'm guessing that may mean reverting part of this change and improving `mainComparator`. ------------- Marked as reviewed by jjg (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/1354