提交 a4c4ed5f 编写于 作者: S Steven Christou

Merge pull request #1143 from christ66/JENKINS-21969

[FIXED JENKINS-21969] Performance issue with search box
......@@ -378,7 +378,10 @@ public class User extends AbstractModelObject implements AccessControlled, Descr
Authentication a = Jenkins.getAuthentication();
if(a instanceof AnonymousAuthenticationToken)
return null;
return get(a.getName());
// Since we already know this is a name, we can just call getOrCreate with the name directly.
String id = a.getName();
return getOrCreate(id, id, true);
}
private static volatile long lastScanned;
......
......@@ -52,13 +52,14 @@ public abstract class CollectionSearchIndex<SMT extends SearchableModelObject> i
public void suggest(String token, List<SearchItem> result) {
Collection<SMT> items = all();
if(UserSearchProperty.isCaseInsensitive()){
boolean isCaseSensitive = UserSearchProperty.isCaseInsensitive();
if(isCaseSensitive){
token = token.toLowerCase();
}
if(items==null) return;
for (SMT o : items) {
String name = getName(o);
if(UserSearchProperty.isCaseInsensitive())
if(isCaseSensitive)
name=name.toLowerCase();
if(o!=null && name.contains(token))
result.add(o);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册