Source:
public SearchResults search(SearchRequest searchRequest) throws IOException, ParseException { SearchResults searchResults = new SearchResults(); final String repositoryId = searchRequest.getRepositoryId(); final Collection<Storage> storages = getConfiguration().getStorages().values(); if (repositoryId != null && !repositoryId.isEmpty()) { logger.debug("Repository: {}", repositoryId); final String storageId = searchRequest.getStorageId(); if (storageId == null) { for (Storage storage : storages) { if (storage.containsRepository(repositoryId)) { final String contextId = storage.getId() + ":" + repositoryId + ":local"; final Set<SearchResult> sr = repositoryIndexManager.getRepositoryIndexer(contextId) .search(searchRequest.getQuery()); if (sr != null && !sr.isEmpty()) { searchResults.getResults().addAll(sr); } } } logger.debug("Results: {}", searchResults.getResults().size()); return searchResults; } else { String contextId = searchRequest.getStorageId() + ":" + searchRequest.getRepositoryId() + ":local"; final Set<SearchResult> sr = repositoryIndexManager.getRepositoryIndexer(contextId) .search(searchRequest.getQuery()); if (!sr.isEmpty()) { searchResults.getResults().addAll(sr); } logger.debug("Results: {}", searchResults.getResults().size()); return searchResults; } } else { for (Storage storage : storages) { for (Repository r : storage.getRepositories().values()) { logger.debug("Repository: {}", r.getId()); String contextId = storage.getId() + ":" + r.getId() + ":local"; final RepositoryIndexer repositoryIndexer = repositoryIndexManager.getRepositoryIndexer(contextId); if (repositoryIndexer != null) { final Set<SearchResult> sr = repositoryIndexer.search(searchRequest.getQuery()); if (sr != null && !sr.isEmpty()) { searchResults.getResults().addAll(sr); } } } } logger.debug("Results: {}", searchResults.getResults().size()); return searchResults; } }

Target:
public SearchResults search(SearchRequest searchRequest) throws IOException, ParseException { SearchResults searchResults = new SearchResults(); final String repositoryId = searchRequest.getRepositoryId(); final Collection<Storage> storages = getConfiguration().getStorages().values(); if (repositoryId != null && !repositoryId.isEmpty()) { logger.debug("Repository: {}", repositoryId); final String storageId = searchRequest.getStorageId(); if (storageId == null) { for (Storage storage : storages) { if (storage.containsRepository(repositoryId)) { final String contextId = storage.getId() + ":" + repositoryId + ":" + IndexTypeEnum.LOCAL.getType(); final Set<SearchResult> sr = repositoryIndexManager.getRepositoryIndexer(contextId) .search(searchRequest.getQuery()); if (sr != null && !sr.isEmpty()) { searchResults.getResults().addAll(sr); } } } logger.debug("Results: {}", searchResults.getResults().size()); return searchResults; } else { String contextId = searchRequest.getStorageId() + ":" + searchRequest.getRepositoryId() + ":" + IndexTypeEnum.LOCAL.getType(); final Set<SearchResult> sr = repositoryIndexManager.getRepositoryIndexer(contextId) .search(searchRequest.getQuery()); if (!sr.isEmpty()) { searchResults.getResults().addAll(sr); } logger.debug("Results: {}", searchResults.getResults().size()); return searchResults; } } else { for (Storage storage : storages) { for (Repository r : storage.getRepositories().values()) { logger.debug("Repository: {}", r.getId()); String contextId = storage.getId() + ":" + r.getId() + ":" + IndexTypeEnum.LOCAL.getType(); final RepositoryIndexer repositoryIndexer = repositoryIndexManager.getRepositoryIndexer(contextId); if (repositoryIndexer != null) { final Set<SearchResult> sr = repositoryIndexer.search(searchRequest.getQuery()); if (sr != null && !sr.isEmpty()) { searchResults.getResults().addAll(sr); } } } } logger.debug("Results: {}", searchResults.getResults().size()); return searchResults; } }