*/
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;
{
private ArtifactFactory factory;
- private BooleanQuery bQry;
-
- private BooleanQuery mainQry;
-
- private boolean isRequired = true;
-
/**
* Constructor
*
import java.io.File;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
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
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 )
PomRepositoryIndex createPomRepositoryIndex( String indexPath, ArtifactRepository repository )
throws RepositoryIndexException;
- public PomRepositoryIndexSearcher createPomRepositoryIndexSearcher( PomRepositoryIndex index );
+ PomRepositoryIndexSearcher createPomRepositoryIndexSearcher( PomRepositoryIndex index );
}
public void testIndexerExceptions()
throws Exception
{
- ArtifactRepositoryIndex indexer;
RepositoryIndexingFactory factory = (RepositoryIndexingFactory) lookup( RepositoryIndexingFactory.ROLE );
try
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