diff --git a/core/src/main/java/hudson/search/Search.java b/core/src/main/java/hudson/search/Search.java index a3c76a7fc9d5..853c8ea85177 100644 --- a/core/src/main/java/hudson/search/Search.java +++ b/core/src/main/java/hudson/search/Search.java @@ -160,14 +160,19 @@ public void doSuggestOpenSearch(StaplerRequest2 req, StaplerResponse2 rsp, @Quer public void doSuggest(StaplerRequest2 req, StaplerResponse2 rsp, @QueryParameter String query) throws IOException, ServletException { Result r = new Result(); for (SuggestedItem item : getSuggestions(req, query)) { - String symbolName = item.item.getSearchIcon(); - - if (symbolName == null || !symbolName.startsWith("symbol-")) { - symbolName = "symbol-search"; + String icon = item.item.getSearchIcon(); + String iconXml = null; + + if (icon == null) { + iconXml = Symbol.get(new SymbolRequest.Builder().withRaw("symbol-search").build()); + } else if (icon.startsWith("symbol-")) { + icon = null; + iconXml = Symbol.get(new SymbolRequest.Builder().withRaw(icon).build()); + } else { + icon = item.item.getSearchIcon(); } - r.suggestions.add(new Item(item.getPath(), item.getUrl(), "", - Symbol.get(new SymbolRequest.Builder().withRaw(symbolName).build()))); + r.suggestions.add(new Item(item.getPath(), item.getUrl(), icon, iconXml)); } rsp.serveExposedBean(req, r, Flavor.JSON); }