]> source.dussan.org Git - archiva.git/commitdiff
better handling of index not existing
authorBrett Porter <brett@apache.org>
Thu, 13 Jul 2006 05:20:41 +0000 (05:20 +0000)
committerBrett Porter <brett@apache.org>
Thu, 13 Jul 2006 05:20:41 +0000 (05:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@421500 13f79535-47bb-0310-9956-ffa450edef68

maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/QuickSearchAction.java
maven-repository-webapp/src/main/resources/xwork.xml
maven-repository-webapp/src/main/webapp/WEB-INF/jsp/quickSearch.jsp

index 2b9af2822a53bda7012466abad2be38b634441f4..27f13afe3416a609d1f56d12a6b1fdf6aa00acf5 100644 (file)
@@ -261,7 +261,7 @@ public abstract class AbstractRepositoryIndex
      * @return true if the index already exists
      * @throws RepositoryIndexException
      */
-    protected boolean indexExists()
+    public boolean indexExists()
         throws RepositoryIndexException
     {
         if ( IndexReader.indexExists( indexPath ) )
index 35f5de74fa251527eacc0ff26ddd0e07b9ae6044..c480af4b6f94ffcf19cd432305650c5a00102858 100644 (file)
@@ -83,8 +83,6 @@ public class QuickSearchAction
     {
         // TODO: give action message if indexing is in progress
 
-        // TODO: return zero results if index doesn't yet exist
-
         assert q != null && q.length() != 0;
 
         Configuration configuration = configurationStore.getConfigurationFromStore();
@@ -94,6 +92,12 @@ public class QuickSearchAction
 
         ArtifactRepositoryIndex index = factory.createArtifactRepositoryIndex( indexPath, repository );
 
+        if ( !index.indexExists() )
+        {
+            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
+            return ERROR;
+        }
+
         searchResult = searchLayer.searchGeneral( q, index );
 
         return SUCCESS;
index 9a4ccfd010f9124da5d16e07345a8032caf1fb1e..9a71a8c4c56a9e06e70df9f0a4f3660ea7b1b988 100644 (file)
@@ -48,6 +48,7 @@
     <action name="quickSearch" class="quickSearchAction">
       <result name="input">/WEB-INF/jsp/quickSearch.jsp</result>
       <result>/WEB-INF/jsp/results.jsp</result>
+      <result name="error">/WEB-INF/jsp/quickSearch.jsp</result>
     </action>
 
     <!-- TODO! old actions
index 6b800b9da17560de702048a035890998bb42f21b..aacb872a87d119ba73373adc7277676ef2309648 100644 (file)
@@ -33,6 +33,7 @@
     </ww:form>
     <p>
       Enter your search terms. A variety of data will be searched for your keywords.
+      <ww:actionerror />
     </p>
   </div>
 </div>