From d33893087638984f4c9081bc8985198ebced94fd Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 14 Oct 2011 17:49:30 +0000 Subject: [PATCH] if searching with SearchFields with unknown repo ids do not revert to a search on all index. small changes on previous commit: only if SearchFields has repos set to not break previous behaviour. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1183443 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/archiva/indexer/search/NexusRepositorySearch.java | 4 ++-- .../apache/archiva/rest/services/DefaultSearchService.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java index cd0b7fd30..f705048e4 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java @@ -141,9 +141,9 @@ public class NexusRepositorySearch List indexingContextIds = addIndexingContexts(searchFields.getRepositories()); - // if no index found in the specified one return an empty search result instead of doing a search on all index + // if no index found in the specified ones return an empty search result instead of doing a search on all index // olamy: IMHO doesn't make sense - if (indexingContextIds == null || indexingContextIds.isEmpty() ) + if ( !searchFields.getRepositories().isEmpty() && (indexingContextIds == null || indexingContextIds.isEmpty()) ) { return new SearchResults(); } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java index e6aec78fd..cc7b60690 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java @@ -105,6 +105,7 @@ public class DefaultSearchService searchField.setGroupId( groupId ); searchField.setArtifactId( artifactId ); searchField.setPackaging( StringUtils.isBlank( packaging ) ? "jar" : packaging ); + searchField.setRepositories( getObservableRepos() ); try { -- 2.39.5