Skip to content
Permalink
Browse files
[FIXED JENKINS-21969] Performance issue with search box when doing ca…
…se insensitive searching.
  • Loading branch information
christ66 committed Feb 27, 2014
1 parent e88de95 commit 84e8d011805194578d3b3ccfca060ce5cffbf7eb
@@ -374,7 +374,10 @@ private static User getOrCreate(String id, String fullName, boolean create) {
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 void find(String token, List<SearchItem> result) {

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);

0 comments on commit 84e8d01

Please sign in to comment.