]> source.dussan.org Git - archiva.git/commitdiff
if searching with SearchFields with unknown repo ids do not revert to a search on...
authorOlivier Lamy <olamy@apache.org>
Fri, 14 Oct 2011 17:49:30 +0000 (17:49 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 14 Oct 2011 17:49:30 +0000 (17:49 +0000)
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

archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java

index cd0b7fd306500796fbb2e8a259f2c78fcb5d5785..f705048e4661400cb3766ecb4aa4903b3029562b 100644 (file)
@@ -141,9 +141,9 @@ public class NexusRepositorySearch
 
         List<String> 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();
         }
index e6aec78fdecb2c0f425e206aae948d3f0b485d21..cc7b60690d8deec41090304bff06746fe72b727d 100644 (file)
@@ -105,6 +105,7 @@ public class DefaultSearchService
         searchField.setGroupId( groupId );
         searchField.setArtifactId( artifactId );
         searchField.setPackaging( StringUtils.isBlank( packaging ) ? "jar" : packaging );
+        searchField.setRepositories( getObservableRepos() );
 
         try
         {