some cleanup

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@367162 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2006-01-09 02:22:14 +00:00
parent dfe1b9b09f
commit 5dc3b36312
4 changed files with 7 additions and 38 deletions

View File

@ -17,7 +17,6 @@
*/
import org.apache.lucene.document.Document;
import org.apache.lucene.search.BooleanQuery;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
@ -34,12 +33,6 @@ public class ArtifactRepositoryIndexSearcher
{
private ArtifactFactory factory;
private BooleanQuery bQry;
private BooleanQuery mainQry;
private boolean isRequired = true;
/**
* Constructor
*

View File

@ -35,6 +35,7 @@
import java.io.File;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@ -75,6 +76,9 @@ public class PomRepositoryIndex
private ArtifactFactory artifactFactory;
private static final List KEYWORD_FIELDS = Arrays.asList(
new String[]{FLD_LICENSE_URLS, FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL} );
public PomRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester,
ArtifactFactory artifactFactory )
throws RepositoryIndexException
@ -172,34 +176,7 @@ public void indexPom( Model pom )
public boolean isKeywordField( String field )
{
boolean keyword;
if ( field.equals( PomRepositoryIndex.FLD_LICENSE_URLS ) )
{
keyword = true;
}
else if ( field.equals( PomRepositoryIndex.FLD_DEPENDENCIES ) )
{
keyword = true;
}
else if ( field.equals( PomRepositoryIndex.FLD_PLUGINS_BUILD ) )
{
keyword = true;
}
else if ( field.equals( PomRepositoryIndex.FLD_PLUGINS_REPORT ) )
{
keyword = true;
}
else if ( field.equals( PomRepositoryIndex.FLD_PLUGINS_ALL ) )
{
keyword = true;
}
else
{
keyword = false;
}
return keyword;
return KEYWORD_FIELDS.contains( field );
}
private void indexLicenseUrls( Document doc, Model pom )

View File

@ -35,5 +35,5 @@ ArtifactRepositoryIndex createArtifactRepositoryIndex( String indexPath, Artifac
PomRepositoryIndex createPomRepositoryIndex( String indexPath, ArtifactRepository repository )
throws RepositoryIndexException;
public PomRepositoryIndexSearcher createPomRepositoryIndexSearcher( PomRepositoryIndex index );
PomRepositoryIndexSearcher createPomRepositoryIndexSearcher( PomRepositoryIndex index );
}

View File

@ -84,7 +84,6 @@ protected void setUp()
public void testIndexerExceptions()
throws Exception
{
ArtifactRepositoryIndex indexer;
RepositoryIndexingFactory factory = (RepositoryIndexingFactory) lookup( RepositoryIndexingFactory.ROLE );
try
@ -112,7 +111,7 @@ public void testIndexerExceptions()
Artifact artifact = getArtifact( "test", "test-artifactId", "1.0" );
artifact.setFile( new File( repository.getBasedir(), repository.pathOf( artifact ) ) );
indexer = factory.createArtifactRepositoryIndex( indexPath, repository );
ArtifactRepositoryIndex indexer = factory.createArtifactRepositoryIndex( indexPath, repository );
indexer.close();
try