archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r736971 - in /archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base: archiva-configuration/src/main/resources/ archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/ archiva-consumers/arc...
Date Fri, 23 Jan 2009 08:33:36 GMT
Author: oching
Date: Fri Jan 23 00:33:35 2009
New Revision: 736971

URL: http://svn.apache.org/viewvc?rev=736971&view=rev
Log:
[MRM-749]
o add new implementation of search which uses Nexus Indexer for searching the nexus index
o remove IndexingContext in nexus indexer consumer once the scanning is complete

Added:
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-configuration/src/main/resources/spring-context.xml
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearch.java
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearchException.java
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchFields.java
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/resources/
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java
Modified:
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/pom.xml
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResultHit.java
    archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResults.java

Added: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-configuration/src/main/resources/spring-context.xml
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-configuration/src/main/resources/spring-context.xml?rev=736971&view=auto
==============================================================================
--- archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-configuration/src/main/resources/spring-context.xml
(added)
+++ archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-configuration/src/main/resources/spring-context.xml
Fri Jan 23 00:33:35 2009
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+    <bean id="nexusRepositorySearch" class="org.apache.archiva.indexer.search.NexusRepositorySearch">
+        <constructor-arg ref="nexusIndexer"/>
+        <constructor-arg ref="archivaConfiguration"/>
+    </bean>
+</beans>
\ No newline at end of file

Modified: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java?rev=736971&r1=736970&r2=736971&view=diff
==============================================================================
--- archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
(original)
+++ archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
Fri Jan 23 00:33:35 2009
@@ -63,8 +63,6 @@
 
     private final IndexPacker indexPacker;
 
-    private ManagedRepositoryConfiguration repository;
-
     private ManagedDefaultRepositoryContent repositoryContent;
 
     private IndexingContext context;
@@ -100,10 +98,19 @@
 
     public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered )
         throws ConsumerException
-    {   
-        this.repository = repository;
+    {           
         managedRepository = new File( repository.getLocation() );
-        File indexDirectory = new File( managedRepository, ".indexer" );
+        String indexDir = repository.getIndexDir();
+        
+        File indexDirectory = null;
+        if( indexDir != null && !"".equals( indexDir ) )
+        {
+            indexDirectory = new File( managedRepository, repository.getIndexDir() );
+        }
+        else
+        {
+            indexDirectory = new File( managedRepository, ".indexer" );
+        }
 
         repositoryContent = new ManagedDefaultRepositoryContent();
         repositoryContent.setRepository( repository );
@@ -184,7 +191,8 @@
         try
         {
             indexerEngine.endIndexing( context );            
-            indexPacker.packIndex( context, indexLocation );            
+            indexPacker.packIndex( context, indexLocation );
+            indexer.removeIndexingContext( context, false );
             uinfos = null;
         }
         catch ( IOException e )

Modified: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java?rev=736971&r1=736970&r2=736971&view=diff
==============================================================================
--- archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java
(original)
+++ archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java
Fri Jan 23 00:33:35 2009
@@ -36,6 +36,7 @@
 import org.sonatype.nexus.index.FlatSearchRequest;
 import org.sonatype.nexus.index.FlatSearchResponse;
 import org.sonatype.nexus.index.NexusIndexer;
+import org.sonatype.nexus.index.context.IndexingContext;
 import org.sonatype.nexus.index.creator.IndexerEngine;
 import org.sonatype.nexus.index.packer.IndexPacker;
 
@@ -106,6 +107,10 @@
         q.add( nexusIndexer.constructQuery( ArtifactInfo.GROUP_ID, "org.apache.archiva" ),
Occur.SHOULD );
         q.add( nexusIndexer.constructQuery( ArtifactInfo.ARTIFACT_ID, "archiva-index-methods-jar-test"
), Occur.SHOULD );
         
+        IndexingContext context = nexusIndexer.addIndexingContext( repositoryConfig.getId(),
repositoryConfig.getId(), new File( repositoryConfig.getLocation() ),
+                                    new File( repositoryConfig.getLocation(), ".indexer"
), null, null, NexusIndexer.FULL_INDEX );
+        context.setSearchable( true );
+        
         FlatSearchRequest request = new FlatSearchRequest( q );
         FlatSearchResponse response = nexusIndexer.searchFlat( request );
         

Modified: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/pom.xml
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/pom.xml?rev=736971&r1=736970&r2=736971&view=diff
==============================================================================
--- archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/pom.xml
(original)
+++ archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/pom.xml
Fri Jan 23 00:33:35 2009
@@ -65,6 +65,10 @@
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.sonatype.nexus</groupId>
+      <artifactId>nexus-indexer</artifactId>
+    </dependency>
   </dependencies>
   <build>
     <plugins>

Added: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java?rev=736971&view=auto
==============================================================================
--- archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java
(added)
+++ archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java
Fri Jan 23 00:33:35 2009
@@ -0,0 +1,170 @@
+package org.apache.archiva.indexer.search;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.indexer.search.SearchResultHit;
+import org.apache.maven.archiva.indexer.search.SearchResultLimits;
+import org.apache.maven.archiva.indexer.search.SearchResults;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.sonatype.nexus.index.ArtifactInfo;
+import org.sonatype.nexus.index.FlatSearchRequest;
+import org.sonatype.nexus.index.FlatSearchResponse;
+import org.sonatype.nexus.index.NexusIndexer;
+import org.sonatype.nexus.index.context.IndexContextInInconsistentStateException;
+import org.sonatype.nexus.index.context.IndexingContext;
+import org.sonatype.nexus.index.context.UnsupportedExistingLuceneIndexException;
+
+/**
+ * RepositorySearch implementation which uses the Nexus Indexer for searching.
+ */
+public class NexusRepositorySearch
+    implements RepositorySearch
+{
+    private static final Logger log = LoggerFactory.getLogger( NexusRepositorySearch.class
); 
+                                                              
+    private NexusIndexer indexer;
+    
+    private ArchivaConfiguration archivaConfig;
+    
+    public NexusRepositorySearch( NexusIndexer indexer, ArchivaConfiguration archivaConfig
)
+    {
+        this.indexer = indexer;
+        this.archivaConfig = archivaConfig;
+    }
+
+    public SearchResults search( String principal, List<String> selectedRepos, String
term, SearchResultLimits limits )
+        throws RepositorySearchException
+    {   
+        addIndexingContexts( selectedRepos );
+        
+        // TODO: 
+        // 1. construct query for:
+        //    - regular search
+        //    - searching within search results
+        // 2. consider pagination
+        
+        BooleanQuery q = new BooleanQuery();
+        // q.add( nexusIndexer.constructQuery( ArtifactInfo.GROUP_ID, "org.apache.archiva"
), Occur.SHOULD );
+        // q.add( nexusIndexer.constructQuery( ArtifactInfo.ARTIFACT_ID, "archiva-index-methods-jar-test"
), Occur.SHOULD );
+
+        try
+        {
+            FlatSearchRequest request = new FlatSearchRequest( q );
+            FlatSearchResponse response = indexer.searchFlat( request );
+
+            return convertToSearchResults( response );
+        }
+        catch ( IndexContextInInconsistentStateException e )
+        {
+            throw new RepositorySearchException( e );
+        }
+        catch ( IOException e )
+        {
+            throw new RepositorySearchException( e );
+        }
+    }
+    
+    public SearchResults search( String principal, SearchFields searchFields, SearchResultLimits
limits )
+        throws RepositorySearchException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    private void addIndexingContexts( List<String> selectedRepos )
+    {
+        for( String repo : selectedRepos )
+        {
+            try
+            {
+                ManagedRepositoryConfiguration repoConfig = archivaConfig.getConfiguration().findManagedRepositoryById(
repo );
+                String indexDir = repoConfig.getIndexDir();
+                File indexDirectory = null;
+                if( indexDir != null && !"".equals( indexDir ) )
+                {
+                    indexDirectory = new File( repoConfig.getLocation(), repoConfig.getIndexDir()
);
+                }
+                else
+                {
+                    indexDirectory = new File( repoConfig.getLocation(), ".indexer" );
+                }
+                
+                IndexingContext context =
+                    indexer.addIndexingContext( repoConfig.getId(), repoConfig.getId(), new
File( repoConfig.getLocation() ),
+                                                indexDirectory, null, null, NexusIndexer.FULL_INDEX
);
+                context.setSearchable( repoConfig.isScanned() );
+            }
+            catch ( UnsupportedExistingLuceneIndexException e )
+            {
+                // skip repository
+                log.warn( "Error accessing index of repository '" + repo + "' : " + e.getMessage()
);
+                continue;
+            }
+            catch ( IOException e )
+            {
+                // skip repository
+                log.warn( "IO error occured while accessing index of repository '" + repo
+ "' : " + e.getMessage() );
+                continue;
+            }
+        }
+    }
+
+    private SearchResults convertToSearchResults( FlatSearchResponse response )
+    {
+        SearchResults results = new SearchResults();
+        Set<ArtifactInfo> artifactInfos = response.getResults();
+
+        for ( ArtifactInfo artifactInfo : artifactInfos )
+        {
+            String id = artifactInfo.groupId + ":" + artifactInfo.artifactId;
+            Map<String, SearchResultHit> hitsMap = results.getHitsMap();
+
+            SearchResultHit hit = hitsMap.get( id );
+            if ( hit != null )
+            {
+                hit.addVersion( artifactInfo.version );
+            }
+            else
+            {
+                hit = new SearchResultHit();
+                hit.setArtifactId( artifactInfo.artifactId );
+                hit.setGroupId( artifactInfo.groupId );
+                hit.setRepositoryId( artifactInfo.repository );
+                hit.setUrl( artifactInfo.repository + "/" + artifactInfo.fname );
+                hit.addVersion( artifactInfo.version );
+            }
+
+            results.addHit( id, hit );
+        }
+
+        return results;
+    }
+
+}

Added: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearch.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearch.java?rev=736971&view=auto
==============================================================================
--- archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearch.java
(added)
+++ archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearch.java
Fri Jan 23 00:33:35 2009
@@ -0,0 +1,51 @@
+package org.apache.archiva.indexer.search;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+import org.apache.maven.archiva.indexer.search.SearchResultLimits;
+import org.apache.maven.archiva.indexer.search.SearchResults;
+
+public interface RepositorySearch
+{
+    /**
+     * Quick search.
+     * 
+     * @param principal
+     * @param selectedRepos
+     * @param term
+     * @param limits
+     * @return
+     */
+    SearchResults search( String principal, List<String> selectedRepos, String term,
SearchResultLimits limits )
+        throws RepositorySearchException;
+    
+    /**
+     * Advanced search.
+     * 
+     * @param principal
+     * @param searchFields
+     * @param limits
+     * @return
+     */
+    SearchResults search( String principal, SearchFields searchFields, SearchResultLimits
limits )
+        throws RepositorySearchException;
+}

Added: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearchException.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearchException.java?rev=736971&view=auto
==============================================================================
--- archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearchException.java
(added)
+++ archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearchException.java
Fri Jan 23 00:33:35 2009
@@ -0,0 +1,44 @@
+package org.apache.archiva.indexer.search;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class RepositorySearchException
+    extends Exception
+{
+    public RepositorySearchException()
+    {
+        super();
+    }
+
+    public RepositorySearchException( String msg )
+    {
+        super( msg );
+    }
+    
+    public RepositorySearchException( Throwable e )
+    {
+        super( e );
+    }
+
+    public RepositorySearchException( String msg, Throwable e )
+    {
+        super( msg, e );
+    }
+}

Added: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchFields.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchFields.java?rev=736971&view=auto
==============================================================================
--- archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchFields.java
(added)
+++ archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchFields.java
Fri Jan 23 00:33:35 2009
@@ -0,0 +1,107 @@
+package org.apache.archiva.indexer.search;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class SearchFields
+{
+    private String groupId;
+
+    private String artifactId;
+
+    private String version;
+
+    private String packaging;
+
+    private String className;
+
+    private String packageName;
+
+    private String repositoryId;
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public void setGroupId( String groupId )
+    {
+        this.groupId = groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public void setArtifactId( String artifactId )
+    {
+        this.artifactId = artifactId;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+
+    public String getPackaging()
+    {
+        return packaging;
+    }
+
+    public void setPackaging( String packaging )
+    {
+        this.packaging = packaging;
+    }
+
+    public String getClassName()
+    {
+        return className;
+    }
+
+    public void setClassName( String className )
+    {
+        this.className = className;
+    }
+
+    public String getPackageName()
+    {
+        return packageName;
+    }
+
+    public void setPackageName( String packageName )
+    {
+        this.packageName = packageName;
+    }
+
+    public String getRepositoryId()
+    {
+        return repositoryId;
+    }
+
+    public void setRepositoryId( String repositoryId )
+    {
+        this.repositoryId = repositoryId;
+    }
+}

Modified: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResultHit.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResultHit.java?rev=736971&r1=736970&r2=736971&view=diff
==============================================================================
--- archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResultHit.java
(original)
+++ archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResultHit.java
Fri Jan 23 00:33:35 2009
@@ -157,4 +157,14 @@
     {
         this.repositoryId = repositoryId;
     }
+    
+    public void addVersion( String version )
+    {
+        if( versions == null )
+        {
+            versions = new ArrayList<String>();
+        }
+        
+        versions.add( version );
+    }
 }

Modified: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResults.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResults.java?rev=736971&r1=736970&r2=736971&view=diff
==============================================================================
--- archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResults.java
(original)
+++ archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/SearchResults.java
Fri Jan 23 00:33:35 2009
@@ -51,6 +51,12 @@
         /* do nothing */
     }
 
+    // for new RepositorySearch
+    public void addHit( String id, SearchResultHit hit )
+    {   
+        hits.put( id, hit );
+    }
+    
     public void addHit( LuceneRepositoryContentRecord record )
     {
         if ( record instanceof FileContentRecord )
@@ -149,6 +155,11 @@
     {
         return new ArrayList( hits.values() );
     }
+    
+    public Map<String, SearchResultHit> getHitsMap()
+    {
+        return hits;
+    }
 
     public List getRepositories()
     {

Added: archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java?rev=736971&view=auto
==============================================================================
--- archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java
(added)
+++ archiva/branches/archiva-nexus-indexer/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java
Fri Jan 23 00:33:35 2009
@@ -0,0 +1,76 @@
+package org.apache.archiva.indexer.search;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
+import org.sonatype.nexus.index.NexusIndexer;
+
+public class NexusRepositorySearchTest
+    extends PlexusInSpringTestCase
+{
+    private RepositorySearch search;
+    
+    private ArchivaConfiguration archivaConfig;
+    
+    private NexusIndexer indexer;
+    
+    @Override
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+        
+        indexer = ( NexusIndexer )lookup( NexusIndexer.class );
+        
+        search = new NexusRepositorySearch( indexer, archivaConfig );
+    }
+    
+    public void testQuickSearch()
+        throws Exception
+    {
+    
+    }
+    
+    public void testNoIndexFound()
+        throws Exception
+    {
+    
+    }
+    
+    public void testSearchWithinSearchResults()
+        throws Exception
+    {
+    
+    }
+    
+    public void testAdvancedSearch()
+        throws Exception
+    {
+    
+    }
+    
+    public void testPagination()
+        throws Exception
+    {
+    
+    }
+    
+}



Mime
View raw message