### Question:
MavenIndexManager implements ArchivaIndexManager { @Override public void removeArtifactsFromIndex( ArchivaIndexingContext context, Collection<URI> artifactReference ) throws IndexUpdateFailedException { final StorageAsset ctxUri = context.getPath(); executeUpdateFunction(context, indexingContext -> { Collection<ArtifactContext> artifacts = artifactReference.stream().map(r -> artifactContextProducer.getArtifactContext(indexingContext, Paths.get(ctxUri.getFilePath().toUri().resolve(r)).toFile())).collect(Collectors.toList()); try { indexer.deleteArtifactsFromIndex(artifacts, indexingContext); } catch (IOException e) { log.error("IOException while removing artifact {}", e.getMessage(), e); throw new IndexUpdateFailedException("Error occured while removing artifact from index of "+context.getId() + (StringUtils.isNotEmpty(e.getMessage()) ? ": "+e.getMessage() : "")); } }); }  static IndexingContext getMvnContext( ArchivaIndexingContext context ); @Override void pack( final ArchivaIndexingContext context ); @Override void scan(final ArchivaIndexingContext context); @Override void update(final ArchivaIndexingContext context, final boolean fullUpdate); @Override void addArtifactsToIndex( final ArchivaIndexingContext context, final Collection<URI> artifactReference ); @Override void removeArtifactsFromIndex( ArchivaIndexingContext context, Collection<URI> artifactReference ); @Override boolean supportsRepository( RepositoryType type ); @Override ArchivaIndexingContext createContext( Repository repository ); @Override ArchivaIndexingContext reset(ArchivaIndexingContext context); @Override ArchivaIndexingContext move(ArchivaIndexingContext context, Repository repo); @Override void updateLocalIndexPath(Repository repo); @Override ArchivaIndexingContext mergeContexts(Repository destinationRepo, List<ArchivaIndexingContext> contexts,
                                                boolean packIndex);  }### Answer:
@Test public void removeArtifactsFromIndex() throws Exception { ArchivaIndexingContext ctx = createTestContext(); Path destDir = repository.getRoot().getFilePath().resolve("org/apache/archiva/archiva-search/1.0"); Path srcDir = Paths.get("src/test/maven-search-test-repo/org/apache/archiva/archiva-search/1.0"); org.apache.commons.io.FileUtils.copyDirectory(srcDir.toFile(), destDir.toFile()); List<URI> uriList = new ArrayList<>(); uriList.add(destDir.resolve("archiva-search-1.0.jar").toUri()); uriList.add(destDir.resolve("archiva-search-1.0-sources.jar").toUri()); mavenIndexManager.addArtifactsToIndex(ctx, uriList); IndexingContext mvnCtx = mavenIndexManager.getMvnContext(ctx); String term = "org.apache.archiva"; Query q = new BooleanQuery.Builder().add( queryCreator.constructQuery( MAVEN.GROUP_ID, new UserInputSearchExpression( term ) ), BooleanClause.Occur.SHOULD ).build(); assertEquals(2, mvnCtx.acquireIndexSearcher().count(q)); uriList.remove(0); mavenIndexManager.removeArtifactsFromIndex(ctx, uriList); assertEquals(1, mvnCtx.acquireIndexSearcher().count(q)); }