mirror of https://github.com/apache/archiva.git
PR: MRM-99
Submitted by: Maria Odea Ching Applied patch to use RepositoryIndexSearchLayer for searching in packages git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@382635 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
49c31dcdb8
commit
4afdf35958
|
@ -24,9 +24,10 @@ import org.apache.maven.repository.indexing.DefaultRepositoryIndexSearcher;
|
|||
import org.apache.maven.repository.indexing.RepositoryIndexException;
|
||||
import org.apache.maven.repository.indexing.RepositoryIndexSearchException;
|
||||
import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
|
||||
import org.apache.maven.repository.indexing.RepositoryIndex;
|
||||
import org.apache.maven.repository.indexing.RepositoryIndexSearchLayer;
|
||||
import org.apache.maven.repository.indexing.query.SinglePhraseQuery;
|
||||
import org.apache.maven.repository.manager.web.job.Configuration;
|
||||
import org.apache.maven.repository.indexing.RepositoryIndex;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
@ -45,6 +46,8 @@ public class PackageSearchAction
|
|||
|
||||
private String md5;
|
||||
|
||||
private List searchResult;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
|
@ -60,8 +63,6 @@ public class PackageSearchAction
|
|||
*/
|
||||
private Configuration configuration;
|
||||
|
||||
private List artifacts;
|
||||
|
||||
public String execute()
|
||||
throws MalformedURLException, RepositoryIndexException, RepositoryIndexSearchException
|
||||
{
|
||||
|
@ -94,9 +95,9 @@ public class PackageSearchAction
|
|||
|
||||
ArtifactRepositoryIndex index = factory.createArtifactRepositoryIndex( indexPath, repository );
|
||||
|
||||
DefaultRepositoryIndexSearcher searcher = factory.createDefaultRepositoryIndexSearcher( index );
|
||||
RepositoryIndexSearchLayer searchLayer = factory.createRepositoryIndexSearchLayer( index );
|
||||
|
||||
artifacts = searcher.search( new SinglePhraseQuery( key, searchTerm ) );
|
||||
searchResult = searchLayer.searchAdvanced( new SinglePhraseQuery( key, searchTerm ) );
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -111,8 +112,8 @@ public class PackageSearchAction
|
|||
this.md5 = md5;
|
||||
}
|
||||
|
||||
public List getArtifacts()
|
||||
public List getSearchResult()
|
||||
{
|
||||
return artifacts;
|
||||
return searchResult;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,17 +26,23 @@
|
|||
|
||||
<%@ include file="form.jspf" %>
|
||||
|
||||
<table>
|
||||
<table border="1px" cellspacing="0">
|
||||
<tr>
|
||||
<th>Group ID</th>
|
||||
<th>Artifact ID</th>
|
||||
<th>Version</th>
|
||||
</tr>
|
||||
<ww:iterator value="artifacts">
|
||||
<ww:iterator value="searchResult">
|
||||
<tr>
|
||||
<td><ww:property value="groupId"/></td>
|
||||
<td><ww:property value="artifactId"/></td>
|
||||
<td><ww:property value="version"/></td>
|
||||
<td valign="top">
|
||||
<ww:property value="Artifact.getGroupId()"/>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<ww:property value="Artifact.getArtifactId()"/>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<ww:property value="Artifact.getVersion()"/>
|
||||
</td>
|
||||
</tr>
|
||||
</ww:iterator>
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue