8176794: javadoc search results sorted incorrectly on packages
authorbpatel
Wed, 15 Mar 2017 14:18:28 -0700
changeset 44296 e9bbaeab6f49
parent 44295 f147ed497558
child 44297 e03f5fb3714b
8176794: javadoc search results sorted incorrectly on packages Reviewed-by: jjg, ksrini
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js
langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Wed Mar 15 13:02:54 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Wed Mar 15 14:18:28 2017 -0700
@@ -229,8 +229,7 @@
                     pkg = (item.m)
                             ? (item.m + "/" + item.l)
                             : item.l;
-                    var s = nestedName(item);
-                    if (exactMatcher.test(s)) {
+                    if (exactMatcher.test(item.l)) {
                         presult.unshift(item);
                         pCount++;
                     } else if (camelCaseMatcher.test(pkg)) {
--- a/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java	Wed Mar 15 13:02:54 2017 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java	Wed Mar 15 14:18:28 2017 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8141492 8071982 8141636 8147890 8166175 8168965
+ * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794
  * @summary Test the search feature of javadoc.
  * @author bpatel
  * @library ../lib
@@ -489,6 +489,8 @@
                 "camelCaseMatcher.test(item.l)",
                 "var secondaryresult = new Array();",
                 "function nestedName(e) {",
-                "function sortAndConcatResults(a1, a2) {");
+                "function sortAndConcatResults(a1, a2) {",
+                "if (exactMatcher.test(item.l)) {\n"
+                + "                        presult.unshift(item);");
     }
 }