From 0a94a40f00c7eddcb36e8ca1bb153f001ea50abb Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Thu, 10 Jul 2008 09:02:07 +0000 Subject: [PATCH] [MRM-737] -do not index metadata files git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@675483 13f79535-47bb-0310-9956-ffa450edef68 --- .../consumers/lucene/IndexContentConsumer.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java index 26d0cca6c..77fab6ea4 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java @@ -36,10 +36,13 @@ import org.apache.maven.archiva.repository.ManagedRepositoryContent; import org.apache.maven.archiva.repository.RepositoryContentFactory; import org.apache.maven.archiva.repository.RepositoryException; import org.apache.maven.archiva.repository.layout.LayoutException; +import org.apache.maven.archiva.repository.metadata.MetadataTools; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; import org.codehaus.plexus.registry.Registry; import org.codehaus.plexus.registry.RegistryListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; @@ -60,6 +63,8 @@ public class IndexContentConsumer extends AbstractMonitoredConsumer implements KnownRepositoryContentConsumer, RegistryListener, Initializable { + private Logger log = LoggerFactory.getLogger( IndexContentConsumer.class ); + private static final String READ_CONTENT = "read_content"; private static final String INDEX_ERROR = "indexing_error"; @@ -147,6 +152,12 @@ public class IndexContentConsumer public void processFile( String path ) throws ConsumerException { + if ( path.endsWith( "/" + MetadataTools.MAVEN_METADATA ) ) + { + log.debug( "File is a metadata file. Not indexing." ); + return; + } + FileContentRecord record = new FileContentRecord(); try { -- 2.39.5