From a537a0b8bca737e44c2d314807301d1ad49cc625 Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Tue, 3 Feb 2009 05:29:17 +0000 Subject: [PATCH] [MRM-749] 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/indexer/search/SearchFields.java | 16 ++++++++++++++ .../archiva/web/action/SearchAction.java | 21 ++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchFields.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchFields.java index a34da6aee..af8813213 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchFields.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchFields.java @@ -54,6 +54,22 @@ public class SearchFields */ private List repositories = new ArrayList(); + public SearchFields() + { + + } + + public SearchFields( String groupId, String artifactId, String version, String packaging, String className, + List repositories ) + { + this.groupId = groupId; + this.artifactId = artifactId; + this.version = version; + this.packaging = packaging; + this.className = className; + this.repositories = repositories; + } + public String getGroupId() { return groupId; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java index 607524fc6..bbe308ac4 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java @@ -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() ) { -- 2.39.5