]> source.dussan.org Git - archiva.git/commitdiff
[MRM-749]
authorMaria Odea B. Ching <oching@apache.org>
Tue, 3 Feb 2009 05:29:17 +0000 (05:29 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Tue, 3 Feb 2009 05:29:17 +0000 (05:29 +0000)
o integrate advanced search impl of nexus search in web app

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-nexus-indexer@740220 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchFields.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java

index a34da6aee24b23080e1661635a5d7939fd5a3e26..af881321354d5f251414a7924e87fdeb7bb6a74c 100644 (file)
@@ -54,6 +54,22 @@ public class SearchFields
      */
     private List<String> repositories = new ArrayList<String>();
     
+    public SearchFields()
+    {
+        
+    }
+    
+    public SearchFields( String groupId, String artifactId, String version, String packaging, String className,
+                         List<String> repositories )
+    {
+        this.groupId = groupId;
+        this.artifactId = artifactId;
+        this.version = version;
+        this.packaging = packaging;
+        this.className = className;
+        this.repositories = repositories;
+    }
+    
     public String getGroupId()
     {
         return groupId;
index 607524fc6b41088e0de2cb6786913df96c6ee737..bbe308ac4423ae67171ac3bc66e96b2790be69d2 100644 (file)
@@ -27,6 +27,7 @@ import java.util.Map;
 
 import org.apache.archiva.indexer.search.RepositorySearch;
 import org.apache.archiva.indexer.search.RepositorySearchException;
+import org.apache.archiva.indexer.search.SearchFields;
 import org.apache.archiva.indexer.util.SearchUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
@@ -198,9 +199,23 @@ public class SearchAction
             return GlobalResults.ACCESS_TO_NO_REPOS;
         }
 
-        results =
-            crossRepoSearch.executeFilteredSearch( getPrincipal(), selectedRepos, groupId, artifactId, version,
-                                                   className, limits );
+        SearchFields searchFields = new SearchFields( groupId, artifactId, version, null, className, selectedRepos );
+        
+        
+        // TODO: add packaging in the list of fields for advanced search (UI)
+        try
+        {
+            results = getNexusSearch().search( getPrincipal(), searchFields, limits );
+        }
+        catch ( RepositorySearchException e )
+        {
+            addActionError( e.getMessage() );
+            return ERROR;
+        }
+        
+        //results =
+        //    crossRepoSearch.executeFilteredSearch( getPrincipal(), selectedRepos, groupId, artifactId, version,
+        //                                           className, limits );
 
         if ( results.isEmpty() )
         {