// Occur.SHOULD );
FlatSearchRequest flatSearchRequest =
new FlatSearchRequest( q, indexer.getIndexingContexts().get( repositoryConfig.getId() ) );
FlatSearchResponse response = indexer.searchFlat( flatSearchRequest );
assertTrue( new File( repositoryConfig.getLocation(), ".indexer" ).exists() );
assertFalse( new File( repositoryConfig.getLocation(), ".index" ).exists() );
// should return 1 hit
assertEquals( 1, response.getTotalHitsCount() );
// remove added artifact from index
task = new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.DELETE,
getIndexingContext() );
indexingExecutor.executeTask( task );
task = new ArtifactIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.FINISH,
getIndexingContext() );
indexingExecutor.executeTask( task );
q = new BooleanQuery();
q.add( indexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression( "org.apache.archiva" ) ),
Occur.SHOULD );
q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID,
new SourcedSearchExpression( "archiva-index-methods-jar-test" ) ),
Occur.SHOULD );
assertTrue( new File( repositoryConfig.getLocation(), ".indexer" ).exists() );
assertFalse( new File( repositoryConfig.getLocation(), ".index" ).exists() );
flatSearchRequest = new FlatSearchRequest( q, getIndexingContext() );
response = indexer.searchFlat( flatSearchRequest );
// artifact should have been removed from the index!
assertEquals( 0, response.getTotalHitsCount() );//.totalHits );
// TODO: test it was removed from the packaged index also
}