Skip to content
Permalink
Browse files
[FIXED JENKINS-21969] Performance issue with search box when doing ca…
…se insensitive searching.

(cherry picked from commit 84e8d01)
  • Loading branch information
christ66 authored and olivergondza committed Apr 13, 2014
1 parent 18e5415 commit 592dca5a88ac27f455f977cc760d7101fa577d96
@@ -378,7 +378,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 592dca5

Please sign in to comment.