8244535: JavaDoc search is overly strict with letter case
Reviewed-by: jjg
This commit is contained in:
parent
78fdb65dcf
commit
53d14442c9
@ -32,16 +32,22 @@ var catMembers = "Members";
|
||||
var catSearchTags = "SearchTags";
|
||||
var highlight = "<span class=\"result-highlight\">$&</span>";
|
||||
var searchPattern = "";
|
||||
var fallbackPattern = "";
|
||||
var RANKING_THRESHOLD = 2;
|
||||
var NO_MATCH = 0xffff;
|
||||
var MAX_RESULTS_PER_CATEGORY = 500;
|
||||
var MIN_RESULTS = 3;
|
||||
var MAX_RESULTS = 500;
|
||||
var UNNAMED = "<Unnamed>";
|
||||
function escapeHtml(str) {
|
||||
return str.replace(/</g, "<").replace(/>/g, ">");
|
||||
}
|
||||
function getHighlightedText(item, matcher) {
|
||||
function getHighlightedText(item, matcher, fallbackMatcher) {
|
||||
var escapedItem = escapeHtml(item);
|
||||
return escapedItem.replace(matcher, highlight);
|
||||
var highlighted = escapedItem.replace(matcher, highlight);
|
||||
if (highlighted === escapedItem) {
|
||||
highlighted = escapedItem.replace(fallbackMatcher, highlight)
|
||||
}
|
||||
return highlighted;
|
||||
}
|
||||
function getURLPrefix(ui) {
|
||||
var urlPrefix="";
|
||||
@ -60,11 +66,10 @@ function getURLPrefix(ui) {
|
||||
}
|
||||
});
|
||||
}
|
||||
return urlPrefix;
|
||||
}
|
||||
return urlPrefix;
|
||||
}
|
||||
function makeCamelCaseRegex(term) {
|
||||
function createSearchPattern(term) {
|
||||
var pattern = "";
|
||||
var isWordToken = false;
|
||||
term.replace(/,\s*/g, ", ").trim().split(/\s+/).forEach(function(w, index) {
|
||||
@ -93,26 +98,26 @@ function createMatcher(pattern, flags) {
|
||||
}
|
||||
var watermark = 'Search';
|
||||
$(function() {
|
||||
$("#search").val('');
|
||||
$("#search").prop("disabled", false);
|
||||
$("#reset").prop("disabled", false);
|
||||
$("#search").val(watermark).addClass('watermark');
|
||||
$("#search").blur(function() {
|
||||
if ($(this).val().length == 0) {
|
||||
var search = $("#search");
|
||||
var reset = $("#reset");
|
||||
search.val('');
|
||||
search.prop("disabled", false);
|
||||
reset.prop("disabled", false);
|
||||
search.val(watermark).addClass('watermark');
|
||||
search.blur(function() {
|
||||
if ($(this).val().length === 0) {
|
||||
$(this).val(watermark).addClass('watermark');
|
||||
}
|
||||
});
|
||||
$("#search").on('click keydown paste', function() {
|
||||
if ($(this).val() == watermark) {
|
||||
search.on('click keydown paste', function() {
|
||||
if ($(this).val() === watermark) {
|
||||
$(this).val('').removeClass('watermark');
|
||||
}
|
||||
});
|
||||
$("#reset").click(function() {
|
||||
$("#search").val('');
|
||||
$("#search").focus();
|
||||
reset.click(function() {
|
||||
search.val('').focus();
|
||||
});
|
||||
$("#search").focus();
|
||||
$("#search")[0].setSelectionRange(0, 0);
|
||||
search.focus()[0].setSelectionRange(0, 0);
|
||||
});
|
||||
$.widget("custom.catcomplete", $.ui.autocomplete, {
|
||||
_create: function() {
|
||||
@ -142,20 +147,21 @@ $.widget("custom.catcomplete", $.ui.autocomplete, {
|
||||
_renderItem: function(ul, item) {
|
||||
var label = "";
|
||||
var matcher = createMatcher(escapeHtml(searchPattern), "g");
|
||||
var fallbackMatcher = new RegExp(fallbackPattern, "gi")
|
||||
if (item.category === catModules) {
|
||||
label = getHighlightedText(item.l, matcher);
|
||||
label = getHighlightedText(item.l, matcher, fallbackMatcher);
|
||||
} else if (item.category === catPackages) {
|
||||
label = getHighlightedText(item.l, matcher);
|
||||
label = getHighlightedText(item.l, matcher, fallbackMatcher);
|
||||
} else if (item.category === catTypes) {
|
||||
label = (item.p && item.p !== UNNAMED)
|
||||
? getHighlightedText(item.p + "." + item.l, matcher)
|
||||
: getHighlightedText(item.l, matcher);
|
||||
? getHighlightedText(item.p + "." + item.l, matcher, fallbackMatcher)
|
||||
: getHighlightedText(item.l, matcher, fallbackMatcher);
|
||||
} else if (item.category === catMembers) {
|
||||
label = (item.p && item.p !== UNNAMED)
|
||||
? getHighlightedText(item.p + "." + item.c + "." + item.l, matcher)
|
||||
: getHighlightedText(item.c + "." + item.l, matcher);
|
||||
? getHighlightedText(item.p + "." + item.c + "." + item.l, matcher, fallbackMatcher)
|
||||
: getHighlightedText(item.c + "." + item.l, matcher, fallbackMatcher);
|
||||
} else if (item.category === catSearchTags) {
|
||||
label = getHighlightedText(item.l, matcher);
|
||||
label = getHighlightedText(item.l, matcher, fallbackMatcher);
|
||||
} else {
|
||||
label = item.l;
|
||||
}
|
||||
@ -186,18 +192,17 @@ function rankMatch(match, category) {
|
||||
var input = match.input;
|
||||
var leftBoundaryMatch = 2;
|
||||
var periferalMatch = 0;
|
||||
var delta = 0;
|
||||
// make sure match is anchored on a left word boundary
|
||||
if (index === 0 || /\W/.test(input[index - 1]) || "_" === input[index - 1] || "_" === input[index]) {
|
||||
if (index === 0 || /\W/.test(input[index - 1]) || "_" === input[index]) {
|
||||
leftBoundaryMatch = 0;
|
||||
} else if (input[index] === input[index].toUpperCase() && !/^[A-Z0-9_$]+$/.test(input)) {
|
||||
} else if ("_" === input[index - 1] || (input[index] === input[index].toUpperCase() && !/^[A-Z0-9_$]+$/.test(input))) {
|
||||
leftBoundaryMatch = 1;
|
||||
}
|
||||
var matchEnd = index + match[0].length;
|
||||
var leftParen = input.indexOf("(");
|
||||
var endOfName = leftParen > -1 ? leftParen : input.length;
|
||||
// exclude peripheral matches
|
||||
if (category !== catModules && category !== catSearchTags) {
|
||||
var endOfName = leftParen > -1 ? leftParen : input.length;
|
||||
var delim = category === catPackages ? "/" : ".";
|
||||
if (leftParen > -1 && leftParen < index) {
|
||||
periferalMatch += 2;
|
||||
@ -205,6 +210,7 @@ function rankMatch(match, category) {
|
||||
periferalMatch += 2;
|
||||
}
|
||||
}
|
||||
var delta = match[0].length === endOfName ? 0 : 1; // rank full match higher than partial match
|
||||
for (var i = 1; i < match.length; i++) {
|
||||
// lower ranking if parts of the name are missing
|
||||
if (match[i])
|
||||
@ -222,88 +228,58 @@ function rankMatch(match, category) {
|
||||
}
|
||||
function doSearch(request, response) {
|
||||
var result = [];
|
||||
var newResults = [];
|
||||
|
||||
searchPattern = makeCamelCaseRegex(request.term);
|
||||
searchPattern = createSearchPattern(request.term);
|
||||
fallbackPattern = createSearchPattern(request.term.toLowerCase());
|
||||
if (searchPattern === "") {
|
||||
return this.close();
|
||||
}
|
||||
var camelCaseMatcher = createMatcher(searchPattern, "");
|
||||
var boundaryMatcher = createMatcher("\\b" + searchPattern, "");
|
||||
var fallbackMatcher = new RegExp(fallbackPattern, "i");
|
||||
|
||||
function concatResults(a1, a2) {
|
||||
a2.sort(function(e1, e2) {
|
||||
return e1.ranking - e2.ranking;
|
||||
});
|
||||
a1 = a1.concat(a2.map(function(e) { return e.item; }));
|
||||
a2.length = 0;
|
||||
return a1;
|
||||
function searchIndexWithMatcher(indexArray, matcher, category, nameFunc) {
|
||||
if (indexArray) {
|
||||
var newResults = [];
|
||||
$.each(indexArray, function (i, item) {
|
||||
item.category = category;
|
||||
var ranking = rankMatch(matcher.exec(nameFunc(item)), category);
|
||||
if (ranking < RANKING_THRESHOLD) {
|
||||
newResults.push({ranking: ranking, item: item});
|
||||
}
|
||||
return newResults.length <= MAX_RESULTS;
|
||||
});
|
||||
return newResults.sort(function(e1, e2) {
|
||||
return e1.ranking - e2.ranking;
|
||||
}).map(function(e) {
|
||||
return e.item;
|
||||
});
|
||||
}
|
||||
return [];
|
||||
}
|
||||
function searchIndex(indexArray, category, nameFunc) {
|
||||
var primaryResults = searchIndexWithMatcher(indexArray, camelCaseMatcher, category, nameFunc);
|
||||
result = result.concat(primaryResults);
|
||||
if (primaryResults.length <= MIN_RESULTS && camelCaseMatcher.flags.indexOf("i") === -1) {
|
||||
var secondaryResults = searchIndexWithMatcher(indexArray, fallbackMatcher, category, nameFunc);
|
||||
result = result.concat(secondaryResults.filter(function (item) {
|
||||
return primaryResults.indexOf(item) === -1;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
if (moduleSearchIndex) {
|
||||
$.each(moduleSearchIndex, function(index, item) {
|
||||
item.category = catModules;
|
||||
var ranking = rankMatch(boundaryMatcher.exec(item.l), catModules);
|
||||
if (ranking < RANKING_THRESHOLD) {
|
||||
newResults.push({ ranking: ranking, item: item });
|
||||
}
|
||||
return newResults.length < MAX_RESULTS_PER_CATEGORY;
|
||||
});
|
||||
result = concatResults(result, newResults);
|
||||
}
|
||||
if (packageSearchIndex) {
|
||||
$.each(packageSearchIndex, function(index, item) {
|
||||
item.category = catPackages;
|
||||
var name = (item.m && request.term.indexOf("/") > -1)
|
||||
? (item.m + "/" + item.l)
|
||||
: item.l;
|
||||
var ranking = rankMatch(boundaryMatcher.exec(name), catPackages);
|
||||
if (ranking < RANKING_THRESHOLD) {
|
||||
newResults.push({ ranking: ranking, item: item });
|
||||
}
|
||||
return newResults.length < MAX_RESULTS_PER_CATEGORY;
|
||||
});
|
||||
result = concatResults(result, newResults);
|
||||
}
|
||||
if (typeSearchIndex) {
|
||||
$.each(typeSearchIndex, function(index, item) {
|
||||
item.category = catTypes;
|
||||
var name = request.term.indexOf(".") > -1
|
||||
? item.p + "." + item.l
|
||||
: item.l;
|
||||
var ranking = rankMatch(camelCaseMatcher.exec(name), catTypes);
|
||||
if (ranking < RANKING_THRESHOLD) {
|
||||
newResults.push({ ranking: ranking, item: item });
|
||||
}
|
||||
return newResults.length < MAX_RESULTS_PER_CATEGORY;
|
||||
});
|
||||
result = concatResults(result, newResults);
|
||||
}
|
||||
if (memberSearchIndex) {
|
||||
$.each(memberSearchIndex, function(index, item) {
|
||||
item.category = catMembers;
|
||||
var name = request.term.indexOf(".") > -1
|
||||
? item.p + "." + item.c + "." + item.l
|
||||
: item.l;
|
||||
var ranking = rankMatch(camelCaseMatcher.exec(name), catMembers);
|
||||
if (ranking < RANKING_THRESHOLD) {
|
||||
newResults.push({ ranking: ranking, item: item });
|
||||
}
|
||||
return newResults.length < MAX_RESULTS_PER_CATEGORY;
|
||||
});
|
||||
result = concatResults(result, newResults);
|
||||
}
|
||||
if (tagSearchIndex) {
|
||||
$.each(tagSearchIndex, function(index, item) {
|
||||
item.category = catSearchTags;
|
||||
var ranking = rankMatch(boundaryMatcher.exec(item.l), catSearchTags);
|
||||
if (ranking < RANKING_THRESHOLD) {
|
||||
newResults.push({ ranking: ranking, item: item });
|
||||
}
|
||||
return newResults.length < MAX_RESULTS_PER_CATEGORY;
|
||||
});
|
||||
result = concatResults(result, newResults);
|
||||
}
|
||||
searchIndex(moduleSearchIndex, catModules, function(item) { return item.l; });
|
||||
searchIndex(packageSearchIndex, catPackages, function(item) {
|
||||
return (item.m && request.term.indexOf("/") > -1)
|
||||
? (item.m + "/" + item.l) : item.l;
|
||||
});
|
||||
searchIndex(typeSearchIndex, catTypes, function(item) {
|
||||
return request.term.indexOf(".") > -1 ? item.p + "." + item.l : item.l;
|
||||
});
|
||||
searchIndex(memberSearchIndex, catMembers, function(item) {
|
||||
return request.term.indexOf(".") > -1
|
||||
? item.p + "." + item.c + "." + item.l : item.l;
|
||||
});
|
||||
searchIndex(tagSearchIndex, catSearchTags, function(item) { return item.l; });
|
||||
|
||||
if (!indexFilesLoaded()) {
|
||||
updateSearchResults = function() {
|
||||
doSearch(request, response);
|
||||
|
@ -172,7 +172,9 @@ public class IndexBuilder {
|
||||
}
|
||||
|
||||
itemsByCategory.computeIfAbsent(item.getCategory(),
|
||||
c -> new TreeSet<>(mainComparator))
|
||||
c -> new TreeSet<>(c == IndexItem.Category.TYPES
|
||||
? makeTypeSearchIndexComparator()
|
||||
: makeGenericSearchIndexComparator()))
|
||||
.add(item);
|
||||
}
|
||||
|
||||
@ -344,4 +346,28 @@ public class IndexBuilder {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Comparator for IndexItems in the types category of the search index.
|
||||
* Items are compared by short name, falling back to the main comparator if names are equal.
|
||||
*
|
||||
* @return a Comparator
|
||||
*/
|
||||
public Comparator<IndexItem> makeTypeSearchIndexComparator() {
|
||||
Comparator<IndexItem> simpleNameComparator =
|
||||
(ii1, ii2) -> utils.compareStrings(ii1.getSimpleName(), ii2.getSimpleName());
|
||||
return simpleNameComparator.thenComparing(mainComparator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Comparator for IndexItems in the modules, packages, members, and search tags
|
||||
* categories of the search index.
|
||||
* Items are compared by label, falling back to the main comparator if names are equal.
|
||||
*
|
||||
* @return a Comparator
|
||||
*/
|
||||
public Comparator<IndexItem> makeGenericSearchIndexComparator() {
|
||||
Comparator<IndexItem> labelComparator =
|
||||
(ii1, ii2) -> utils.compareStrings(ii1.getLabel(), ii2.getLabel());
|
||||
return labelComparator.thenComparing(mainComparator);
|
||||
}
|
||||
}
|
||||
|
@ -712,10 +712,10 @@ public class TestSearch extends JavadocTester {
|
||||
|
||||
void checkSearchJS() {
|
||||
checkOutput("search.js", true,
|
||||
"function concatResults(a1, a2) {",
|
||||
"function searchIndexWithMatcher(indexArray, matcher, category, nameFunc) {",
|
||||
"""
|
||||
$("#search").on('click keydown paste', function() {
|
||||
if ($(this).val() == watermark) {
|
||||
search.on('click keydown paste', function() {
|
||||
if ($(this).val() === watermark) {
|
||||
$(this).val('').removeClass('watermark');
|
||||
}
|
||||
});""",
|
||||
@ -737,7 +737,6 @@ public class TestSearch extends JavadocTester {
|
||||
}
|
||||
});
|
||||
}
|
||||
return urlPrefix;
|
||||
}
|
||||
return urlPrefix;
|
||||
}""",
|
||||
|
@ -92,27 +92,28 @@ public class TestSearchScript extends JavadocTester {
|
||||
// exact match, case sensitivity
|
||||
checkSearch(inv, "mapmodule", List.of("mapmodule"));
|
||||
checkSearch(inv, "mappkg", List.of("mapmodule/mappkg", "mapmodule/mappkg.impl", "mappkg.system.property"));
|
||||
checkSearch(inv, "Mapmodule", List.of());
|
||||
checkSearch(inv, "Mappkg", List.of());
|
||||
checkSearch(inv, "Mapmodule", List.of("mapmodule"));
|
||||
checkSearch(inv, "Mappkg", List.of("mapmodule/mappkg", "mapmodule/mappkg.impl", "mappkg.system.property"));
|
||||
checkSearch(inv, "mymap", List.of("mappkg.impl.MyMap", "mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "MyMap", List.of("mappkg.impl.MyMap", "mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "mymap(", List.of("mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "MyMap(", List.of("mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "mymap()", List.of("mappkg.impl.MyMap.MyMap()"));
|
||||
checkSearch(inv, "MyMap()", List.of("mappkg.impl.MyMap.MyMap()"));
|
||||
checkSearch(inv, "Mymap", List.of());
|
||||
checkSearch(inv, "Mymap()", List.of());
|
||||
checkSearch(inv, "Mymap", List.of("mappkg.impl.MyMap", "mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "Mymap()", List.of("mappkg.impl.MyMap.MyMap()"));
|
||||
|
||||
// left boundaries, ranking
|
||||
checkSearch(inv, "map", List.of("mapmodule", "mapmodule/mappkg", "mapmodule/mappkg.impl", "mappkg.Map", "mappkg.impl.MyMap",
|
||||
"mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)", "mappkg.system.property"));
|
||||
checkSearch(inv, "Map", List.of("mappkg.Map", "mappkg.impl.MyMap", "mappkg.impl.MyMap.MyMap()",
|
||||
"mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "MAP", List.of());
|
||||
checkSearch(inv, "Map", List.of("mapmodule", "mapmodule/mappkg", "mapmodule/mappkg.impl", "mappkg.Map", "mappkg.impl.MyMap",
|
||||
"mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)", "mappkg.system.property"));
|
||||
checkSearch(inv, "MAP", List.of("mapmodule", "mapmodule/mappkg", "mapmodule/mappkg.impl", "mappkg.Map", "mappkg.impl.MyMap",
|
||||
"mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)", "mappkg.system.property"));
|
||||
checkSearch(inv, "value", List.of("mappkg.impl.MyMap.OTHER_VALUE", "mappkg.impl.MyMap.some_value"));
|
||||
checkSearch(inv, "VALUE", List.of("mappkg.impl.MyMap.OTHER_VALUE"));
|
||||
checkSearch(inv, "VALUE", List.of("mappkg.impl.MyMap.OTHER_VALUE", "mappkg.impl.MyMap.some_value"));
|
||||
checkSearch(inv, "map.other", List.of("mappkg.impl.MyMap.OTHER_VALUE"));
|
||||
checkSearch(inv, "Map.some_", List.of("mappkg.impl.MyMap.some_value"));
|
||||
checkSearch(inv, "Map.Some_", List.of("mappkg.impl.MyMap.some_value"));
|
||||
|
||||
checkSearch(inv, "Mm", List.of());
|
||||
checkSearch(inv, "mym", List.of("mappkg.impl.MyMap", "mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)"));
|
||||
@ -122,12 +123,12 @@ public class TestSearchScript extends JavadocTester {
|
||||
// camel case
|
||||
checkSearch(inv, "MM", List.of("mappkg.impl.MyMap", "mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "MyM", List.of("mappkg.impl.MyMap", "mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "Mym", List.of());
|
||||
checkSearch(inv, "Mym", List.of("mappkg.impl.MyMap", "mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "i.MyM.MyM(", List.of("mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "i.MMa.MMa(", List.of("mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "i.MyM.MyM(Ma", List.of("mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "i.MMa.MMa(M", List.of("mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "i.Mym.MyM(", List.of());
|
||||
checkSearch(inv, "i.Mym.MyM(", List.of("mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)"));
|
||||
checkSearch(inv, "i.Mym.Ma(", List.of());
|
||||
|
||||
checkSearch(inv, "mapm", List.of("mapmodule"));
|
||||
@ -141,13 +142,14 @@ public class TestSearchScript extends JavadocTester {
|
||||
checkSearch(inv, "mapmod.", List.of());
|
||||
checkSearch(inv, "mappkg.", List.of("mapmodule/mappkg.impl", "mappkg.Map", "mappkg.system.property"));
|
||||
checkSearch(inv, "mappkg.", List.of("mapmodule/mappkg.impl", "mappkg.Map", "mappkg.system.property"));
|
||||
checkSearch(inv, "Map.", List.of("mappkg.Map.contains(Object)", "mappkg.Map.get(Object)", "mappkg.Map.iterate()",
|
||||
"mappkg.Map.put(Object, Object)", "mappkg.Map.remove(Object)",
|
||||
"mappkg.impl.MyMap.contains(Object)", "mappkg.impl.MyMap.get(Object)",
|
||||
"mappkg.impl.MyMap.iterate()", "mappkg.impl.MyMap.MyMap()",
|
||||
"mappkg.impl.MyMap.MyMap(Map)", "mappkg.impl.MyMap.OTHER_VALUE",
|
||||
"mappkg.impl.MyMap.put(Object, Object)", "mappkg.impl.MyMap.remove(Object)",
|
||||
"mappkg.impl.MyMap.some_value"));
|
||||
checkSearch(inv, "Map.", List.of("mapmodule/mappkg.impl", "mappkg.Map", "mappkg.Map.contains(Object)",
|
||||
"mappkg.Map.get(Object)", "mappkg.Map.iterate()", "mappkg.Map.put(Object, Object)",
|
||||
"mappkg.Map.remove(Object)", "mappkg.impl.MyMap.contains(Object)",
|
||||
"mappkg.impl.MyMap.get(Object)", "mappkg.impl.MyMap.iterate()",
|
||||
"mappkg.impl.MyMap.MyMap()", "mappkg.impl.MyMap.MyMap(Map)",
|
||||
"mappkg.impl.MyMap.OTHER_VALUE", "mappkg.impl.MyMap.put(Object, Object)",
|
||||
"mappkg.impl.MyMap.remove(Object)", "mappkg.impl.MyMap.some_value",
|
||||
"mappkg.system.property"));
|
||||
checkSearch(inv, "mym.", List.of("mappkg.impl.MyMap.contains(Object)", "mappkg.impl.MyMap.get(Object)",
|
||||
"mappkg.impl.MyMap.iterate()", "mappkg.impl.MyMap.MyMap()",
|
||||
"mappkg.impl.MyMap.MyMap(Map)", "mappkg.impl.MyMap.OTHER_VALUE",
|
||||
@ -164,8 +166,8 @@ public class TestSearchScript extends JavadocTester {
|
||||
checkSearch(inv, "operty", List.of());
|
||||
|
||||
// search tag
|
||||
checkSearch(inv, "search tag", List.of("multiline search tag", "search tag"));
|
||||
checkSearch(inv, "search tag", List.of("multiline search tag", "search tag"));
|
||||
checkSearch(inv, "search tag", List.of("search tag", "multiline search tag"));
|
||||
checkSearch(inv, "search tag", List.of("search tag", "multiline search tag"));
|
||||
checkSearch(inv, "search ", List.of("multiline search tag", "search tag"));
|
||||
checkSearch(inv, "tag", List.of("multiline search tag", "search tag"));
|
||||
checkSearch(inv, "sea", List.of("multiline search tag", "search tag"));
|
||||
@ -191,12 +193,11 @@ public class TestSearchScript extends JavadocTester {
|
||||
"listpkg.MyListFactory.createList(ListProvider, MyListFactory)",
|
||||
"listpkg.ListProvider.makeNewList()",
|
||||
"listpkg.MyList.MyList()", "listpkg.MyListFactory.MyListFactory()"));
|
||||
checkSearch(inv, "List", List.of("listpkg.List", "listpkg.ListProvider", "listpkg.MyList",
|
||||
checkSearch(inv, "List", List.of("listpkg", "listpkg.List", "listpkg.ListProvider", "listpkg.MyList",
|
||||
"listpkg.MyListFactory", "listpkg.ListProvider.ListProvider()",
|
||||
"listpkg.MyListFactory.createList(ListProvider, MyListFactory)",
|
||||
"listpkg.ListProvider.makeNewList()",
|
||||
"listpkg.MyList.MyList()", "listpkg.MyListFactory.MyListFactory()"));
|
||||
|
||||
// partial match
|
||||
checkSearch(inv, "fact", List.of("listpkg.MyListFactory", "listpkg.MyListFactory.MyListFactory()"));
|
||||
checkSearch(inv, "pro", List.of("listpkg.ListProvider", "listpkg.ListProvider.ListProvider()"));
|
||||
@ -224,7 +225,9 @@ public class TestSearchScript extends JavadocTester {
|
||||
List.of("listpkg.List.of()", "listpkg.List.of(E)", "listpkg.List.of(E, E)",
|
||||
"listpkg.List.of(E, E, E)", "listpkg.List.of(E, E, E, E)",
|
||||
"listpkg.List.of(E, E, E, E, E)", "listpkg.List.of(E...)"));
|
||||
checkSearch(inv, "L.l.o", List.of());
|
||||
checkSearch(inv, "L.l.o", List.of("listpkg.List.of()", "listpkg.List.of(E)", "listpkg.List.of(E, E)",
|
||||
"listpkg.List.of(E, E, E)", "listpkg.List.of(E, E, E, E)", "listpkg.List.of(E, E, E, E, E)",
|
||||
"listpkg.List.of(E...)"));
|
||||
|
||||
// whitespace
|
||||
checkSearch(inv, "(e,e,e",
|
||||
@ -275,10 +278,10 @@ public class TestSearchScript extends JavadocTester {
|
||||
// _ word boundaries and case sensitivity
|
||||
checkSearch(inv, "some", List.of("listpkg.Nolist.SOME_INT_CONSTANT"));
|
||||
checkSearch(inv, "SOME", List.of("listpkg.Nolist.SOME_INT_CONSTANT"));
|
||||
checkSearch(inv, "Some", List.of());
|
||||
checkSearch(inv, "Some", List.of("listpkg.Nolist.SOME_INT_CONSTANT"));
|
||||
checkSearch(inv, "int", List.of("listpkg.Nolist.SOME_INT_CONSTANT"));
|
||||
checkSearch(inv, "INT", List.of("listpkg.Nolist.SOME_INT_CONSTANT"));
|
||||
checkSearch(inv, "Int", List.of());
|
||||
checkSearch(inv, "Int", List.of("listpkg.Nolist.SOME_INT_CONSTANT"));
|
||||
checkSearch(inv, "int_con", List.of("listpkg.Nolist.SOME_INT_CONSTANT"));
|
||||
checkSearch(inv, "INT_CON", List.of("listpkg.Nolist.SOME_INT_CONSTANT"));
|
||||
checkSearch(inv, "NT", List.of());
|
||||
@ -289,7 +292,7 @@ public class TestSearchScript extends JavadocTester {
|
||||
// Test for all packages, all classes links
|
||||
checkSearch(inv, "all", List.of("All Packages", "All Classes"));
|
||||
checkSearch(inv, "All", List.of("All Packages", "All Classes"));
|
||||
checkSearch(inv, "ALL", List.of());
|
||||
checkSearch(inv, "ALL", List.of("All Packages", "All Classes"));
|
||||
|
||||
// test for generic types, var-arg and array args
|
||||
checkSearch(inv, "(map<string, ? ext collection>)",
|
||||
|
@ -47,6 +47,16 @@ function tryLoad(docsPath, file) {
|
||||
}
|
||||
}
|
||||
|
||||
var updateSearchResults = function() {};
|
||||
|
||||
function indexFilesLoaded() {
|
||||
return moduleSearchIndex
|
||||
&& packageSearchIndex
|
||||
&& typeSearchIndex
|
||||
&& memberSearchIndex
|
||||
&& tagSearchIndex;
|
||||
}
|
||||
|
||||
var $ = function(f) {
|
||||
if (typeof f === "function") {
|
||||
f();
|
||||
|
Loading…
x
Reference in New Issue
Block a user