Return-Path: Delivered-To: apmail-archiva-commits-archive@www.apache.org Received: (qmail 18794 invoked from network); 3 Feb 2009 06:51:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Feb 2009 06:51:20 -0000 Received: (qmail 69180 invoked by uid 500); 3 Feb 2009 06:51:20 -0000 Delivered-To: apmail-archiva-commits-archive@archiva.apache.org Received: (qmail 69146 invoked by uid 500); 3 Feb 2009 06:51:20 -0000 Mailing-List: contact commits-help@archiva.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@archiva.apache.org Delivered-To: mailing list commits@archiva.apache.org Received: (qmail 69137 invoked by uid 99); 3 Feb 2009 06:51:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Feb 2009 22:51:20 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Feb 2009 06:51:19 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A5D0223889A0; Tue, 3 Feb 2009 06:50:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r740228 - /archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java Date: Tue, 03 Feb 2009 06:50:59 -0000 To: commits@archiva.apache.org From: oching@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090203065059.A5D0223889A0@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: oching Date: Tue Feb 3 06:50:59 2009 New Revision: 740228 URL: http://svn.apache.org/viewvc?rev=740228&view=rev Log: [MRM-749] o cleanup SearchAction Modified: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java Modified: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java URL: http://svn.apache.org/viewvc/archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java?rev=740228&r1=740227&r2=740228&view=diff ============================================================================== --- archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java (original) +++ archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java Tue Feb 3 06:50:59 2009 @@ -28,7 +28,6 @@ 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; import org.apache.maven.archiva.configuration.ArchivaConfiguration; @@ -38,7 +37,6 @@ import org.apache.maven.archiva.database.constraints.ArtifactsByChecksumConstraint; import org.apache.maven.archiva.indexer.RepositoryIndexException; import org.apache.maven.archiva.indexer.RepositoryIndexSearchException; -import org.apache.maven.archiva.indexer.search.CrossRepositorySearch; import org.apache.maven.archiva.indexer.search.SearchResultLimits; import org.apache.maven.archiva.indexer.search.SearchResults; import org.apache.maven.archiva.security.AccessDeniedException; @@ -84,11 +82,6 @@ * The Search Results. */ private SearchResults results; - - /** - * @plexus.requirement role-hint="default" - */ - private CrossRepositorySearch crossRepoSearch; /** * @plexus.requirement @@ -213,10 +206,6 @@ return ERROR; } - //results = - // crossRepoSearch.executeFilteredSearch( getPrincipal(), selectedRepos, groupId, artifactId, version, - // className, limits ); - if ( results.isEmpty() ) { addActionError( "No results found" ); @@ -263,33 +252,23 @@ return GlobalResults.ACCESS_TO_NO_REPOS; } - final boolean isbytecodeSearch = SearchUtil.isBytecodeSearch( q ); - if( isbytecodeSearch ) - { - results = crossRepoSearch.searchForBytecode( getPrincipal(), selectedRepos, SearchUtil.removeBytecodeKeyword( q ), limits ); - } - else + try { - try - { - if( searchResultsOnly && !completeQueryString.equals( "" ) ) - { - //results = crossRepoSearch.searchForTerm( getPrincipal(), selectedRepos, q, limits, parseCompleteQueryString() ); - results = getNexusSearch().search( getPrincipal(), selectedRepos, q, limits, parseCompleteQueryString() ); - } - else - { - completeQueryString = ""; - //results = crossRepoSearch.searchForTerm( getPrincipal(), selectedRepos, q, limits ); - results = getNexusSearch().search( getPrincipal(), selectedRepos, q, limits, null ); - } + if( searchResultsOnly && !completeQueryString.equals( "" ) ) + { + results = getNexusSearch().search( getPrincipal(), selectedRepos, q, limits, parseCompleteQueryString() ); } - catch ( RepositorySearchException e ) + else { - addActionError( e.getMessage() ); - return ERROR; + completeQueryString = ""; + results = getNexusSearch().search( getPrincipal(), selectedRepos, q, limits, null ); } } + catch ( RepositorySearchException e ) + { + addActionError( e.getMessage() ); + return ERROR; + } if ( results.isEmpty() ) { @@ -316,22 +295,19 @@ { buildCompleteQueryString( q ); } - - if (!isbytecodeSearch) + + //Lets get the versions for the artifact we just found and display them + //Yes, this is in the lucene index but its more challenging to get them out when we are searching by project + for (SearchResultHit resultHit : results.getHits()) { - //Lets get the versions for the artifact we just found and display them - //Yes, this is in the lucene index but its more challenging to get them out when we are searching by project - for (SearchResultHit resultHit : results.getHits()) + final List versions = dao.query(new UniqueVersionConstraint(getObservableRepos(), resultHit.getGroupId(), resultHit.getArtifactId())); + if (versions != null && !versions.isEmpty()) { - final List versions = dao.query(new UniqueVersionConstraint(getObservableRepos(), resultHit.getGroupId(), resultHit.getArtifactId())); - if (versions != null && !versions.isEmpty()) - { - resultHit.setVersion(null); - resultHit.setVersions(filterTimestampedSnapshots(versions)); - } + resultHit.setVersion(null); + resultHit.setVersions(filterTimestampedSnapshots(versions)); } } - + return SUCCESS; }