mirror of https://github.com/apache/archiva.git
better handling of index not existing
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@421500 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5c970ed39e
commit
867ec5b07c
|
@ -261,7 +261,7 @@ public abstract class AbstractRepositoryIndex
|
||||||
* @return true if the index already exists
|
* @return true if the index already exists
|
||||||
* @throws RepositoryIndexException
|
* @throws RepositoryIndexException
|
||||||
*/
|
*/
|
||||||
protected boolean indexExists()
|
public boolean indexExists()
|
||||||
throws RepositoryIndexException
|
throws RepositoryIndexException
|
||||||
{
|
{
|
||||||
if ( IndexReader.indexExists( indexPath ) )
|
if ( IndexReader.indexExists( indexPath ) )
|
||||||
|
|
|
@ -83,8 +83,6 @@ public class QuickSearchAction
|
||||||
{
|
{
|
||||||
// TODO: give action message if indexing is in progress
|
// 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;
|
assert q != null && q.length() != 0;
|
||||||
|
|
||||||
Configuration configuration = configurationStore.getConfigurationFromStore();
|
Configuration configuration = configurationStore.getConfigurationFromStore();
|
||||||
|
@ -94,6 +92,12 @@ public class QuickSearchAction
|
||||||
|
|
||||||
ArtifactRepositoryIndex index = factory.createArtifactRepositoryIndex( indexPath, repository );
|
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 );
|
searchResult = searchLayer.searchGeneral( q, index );
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
<action name="quickSearch" class="quickSearchAction">
|
<action name="quickSearch" class="quickSearchAction">
|
||||||
<result name="input">/WEB-INF/jsp/quickSearch.jsp</result>
|
<result name="input">/WEB-INF/jsp/quickSearch.jsp</result>
|
||||||
<result>/WEB-INF/jsp/results.jsp</result>
|
<result>/WEB-INF/jsp/results.jsp</result>
|
||||||
|
<result name="error">/WEB-INF/jsp/quickSearch.jsp</result>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
<!-- TODO! old actions
|
<!-- TODO! old actions
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
</ww:form>
|
</ww:form>
|
||||||
<p>
|
<p>
|
||||||
Enter your search terms. A variety of data will be searched for your keywords.
|
Enter your search terms. A variety of data will be searched for your keywords.
|
||||||
|
<ww:actionerror />
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue