Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
af8c1dd8
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
af8c1dd8
编写于
2月 09, 2017
作者:
B
bpatel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8168965: search items are not listed in any sensible order
Reviewed-by: jjg, ksrini Contributed-by: michel.trudeau@oracle.com
上级
409730b6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
56 addition
and
18 deletion
+56
-18
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js
...javadoc/internal/doclets/formats/html/resources/search.js
+51
-16
langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java
langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java
+5
-2
未找到文件。
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js
浏览文件 @
af8c1dd8
/*
* Copyright (c) 2015, 201
6
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 201
7
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -169,11 +169,42 @@ $(function() {
var
tresult
=
new
Array
();
var
mresult
=
new
Array
();
var
tgresult
=
new
Array
();
var
secondaryresult
=
new
Array
();
var
displayCount
=
0
;
var
exactMatcher
=
new
RegExp
(
"
^
"
+
$
.
ui
.
autocomplete
.
escapeRegex
(
request
.
term
)
+
"
$
"
,
"
i
"
);
camelCaseRegexp
=
(
$
.
ui
.
autocomplete
.
escapeRegex
(
request
.
term
)).
split
(
/
(?=[
A-Z
])
/
).
join
(
"
([a-z0-9_$]*?)
"
);
var
camelCaseMatcher
=
new
RegExp
(
"
^
"
+
camelCaseRegexp
);
secondaryMatcher
=
new
RegExp
(
$
.
ui
.
autocomplete
.
escapeRegex
(
request
.
term
),
"
i
"
);
// Return the nested innermost name from the specified object
function
nestedName
(
e
)
{
return
e
.
l
.
substring
(
e
.
l
.
lastIndexOf
(
"
.
"
)
+
1
);
}
// Sort array items by short name (as opposed to fully qualified name).
// Additionally, sort by the nested type name, when present,
// as opposed to top level short name.
function
sortAndConcatResults
(
a1
,
a2
)
{
var
sortingKey
;
var
sortArray
=
function
(
e1
,
e2
)
{
var
l
=
sortingKey
(
e1
);
var
m
=
sortingKey
(
e2
);
if
(
l
<
m
)
return
-
1
;
if
(
l
>
m
)
return
1
;
return
0
;
};
sortingKey
=
function
(
e
)
{
return
nestedName
(
e
).
toUpperCase
();
};
a1
.
sort
(
sortArray
);
a2
.
sort
(
sortArray
);
a1
=
a1
.
concat
(
a2
);
a2
.
length
=
0
;
return
a1
;
}
if
(
moduleSearchIndex
)
{
var
mdleCount
=
0
;
$
.
each
(
moduleSearchIndex
,
function
(
index
,
item
)
{
...
...
@@ -184,10 +215,11 @@ $(function() {
}
else
if
(
camelCaseMatcher
.
test
(
item
.
l
))
{
result
.
unshift
(
item
);
}
else
if
(
secondaryMatcher
.
test
(
item
.
l
))
{
result
.
push
(
item
);
secondary
result
.
push
(
item
);
}
});
displayCount
=
mdleCount
;
result
=
sortAndConcatResults
(
result
,
secondaryresult
);
}
if
(
packageSearchIndex
)
{
var
pCount
=
0
;
...
...
@@ -197,48 +229,51 @@ $(function() {
pkg
=
(
item
.
m
)
?
(
item
.
m
+
"
/
"
+
item
.
l
)
:
item
.
l
;
if
(
exactMatcher
.
test
(
item
.
l
))
{
var
s
=
nestedName
(
item
);
if
(
exactMatcher
.
test
(
s
))
{
presult
.
unshift
(
item
);
pCount
++
;
}
else
if
(
camelCaseMatcher
.
test
(
pkg
))
{
presult
.
unshift
(
item
);
}
else
if
(
secondaryMatcher
.
test
(
pkg
))
{
p
result
.
push
(
item
);
secondary
result
.
push
(
item
);
}
});
result
=
result
.
concat
(
presult
);
result
=
result
.
concat
(
sortAndConcatResults
(
presult
,
secondaryresult
)
);
displayCount
=
(
pCount
>
displayCount
)
?
pCount
:
displayCount
;
}
if
(
typeSearchIndex
)
{
var
tCount
=
0
;
$
.
each
(
typeSearchIndex
,
function
(
index
,
item
)
{
item
[
category
]
=
catTypes
;
if
(
exactMatcher
.
test
(
item
.
l
))
{
var
s
=
nestedName
(
item
);
if
(
exactMatcher
.
test
(
s
))
{
tresult
.
unshift
(
item
);
tCount
++
;
}
else
if
(
camelCaseMatcher
.
test
(
item
.
l
))
{
}
else
if
(
camelCaseMatcher
.
test
(
s
))
{
tresult
.
unshift
(
item
);
}
else
if
(
secondaryMatcher
.
test
(
item
.
p
+
"
.
"
+
item
.
l
))
{
t
result
.
push
(
item
);
secondary
result
.
push
(
item
);
}
});
result
=
result
.
concat
(
tresult
);
result
=
result
.
concat
(
sortAndConcatResults
(
tresult
,
secondaryresult
)
);
displayCount
=
(
tCount
>
displayCount
)
?
tCount
:
displayCount
;
}
if
(
memberSearchIndex
)
{
var
mCount
=
0
;
$
.
each
(
memberSearchIndex
,
function
(
index
,
item
)
{
item
[
category
]
=
catMembers
;
if
(
exactMatcher
.
test
(
item
.
l
))
{
var
s
=
nestedName
(
item
);
if
(
exactMatcher
.
test
(
s
))
{
mresult
.
unshift
(
item
);
mCount
++
;
}
else
if
(
camelCaseMatcher
.
test
(
item
.
l
))
{
}
else
if
(
camelCaseMatcher
.
test
(
s
))
{
mresult
.
unshift
(
item
);
}
else
if
(
secondaryMatcher
.
test
(
item
.
c
+
"
.
"
+
item
.
l
))
{
m
result
.
push
(
item
);
secondary
result
.
push
(
item
);
}
});
result
=
result
.
concat
(
mresult
);
result
=
result
.
concat
(
sortAndConcatResults
(
mresult
,
secondaryresult
)
);
displayCount
=
(
mCount
>
displayCount
)
?
mCount
:
displayCount
;
}
if
(
tagSearchIndex
)
{
...
...
@@ -249,10 +284,10 @@ $(function() {
tgresult
.
unshift
(
item
);
tgCount
++
;
}
else
if
(
secondaryMatcher
.
test
(
item
.
l
))
{
tg
result
.
push
(
item
);
secondary
result
.
push
(
item
);
}
});
result
=
result
.
concat
(
tgresult
);
result
=
result
.
concat
(
sortAndConcatResults
(
tgresult
,
secondaryresult
)
);
displayCount
=
(
tgCount
>
displayCount
)
?
tgCount
:
displayCount
;
}
displayCount
=
(
displayCount
>
500
)
?
displayCount
:
500
;
...
...
@@ -312,4 +347,4 @@ $(function() {
}
}
});
});
\ No newline at end of file
});
langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java
浏览文件 @
af8c1dd8
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 8141492 8071982 8141636 8147890 8166175
* @bug 8141492 8071982 8141636 8147890 8166175
8168965
* @summary Test the search feature of javadoc.
* @author bpatel
* @library ../lib
...
...
@@ -486,6 +486,9 @@ public class TestSearch extends JavadocTester {
checkOutput
(
"search.js"
,
true
,
"camelCaseRegexp = ($.ui.autocomplete.escapeRegex(request.term)).split(/(?=[A-Z])/).join(\"([a-z0-9_$]*?)\");"
,
"var camelCaseMatcher = new RegExp(\"^\" + camelCaseRegexp);"
,
"camelCaseMatcher.test(item.l)"
);
"camelCaseMatcher.test(item.l)"
,
"var secondaryresult = new Array();"
,
"function nestedName(e) {"
,
"function sortAndConcatResults(a1, a2) {"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录