final IndexSearcher indexSearcher = context.acquireIndexSearcher();
try
{
for ( String uinfo : uinfos )
{
TopScoreDocCollector collector = TopScoreDocCollector.create( 1, false );
indexSearcher.search( new TermQuery( new Term( ArtifactInfo.UINFO, uinfo ) ), collector );
if ( collector.getTotalHits() > 0 )
{
String[] ra = ArtifactInfo.FS_PATTERN.split( uinfo );
ArtifactInfo ai = new ArtifactInfo();
ai.repository = context.getRepositoryId();
ai.groupId = ra[0];
ai.artifactId = ra[1];
ai.version = ra[2];
if ( ra.length > 3 )
{
ai.classifier = ArtifactInfo.renvl( ra[3] );
}
if ( ra.length > 4 )
{
ai.packaging = ArtifactInfo.renvl( ra[4] );
}
// minimal ArtifactContext for removal
ArtifactContext ac = new ArtifactContext( null, null, null, ai, ai.calculateGav() );
for ( int i = 0; i < collector.getTotalHits(); i++ )
{
if ( contextPath == null
|| context.getGavCalculator().gavToPath( ac.getGav() ).startsWith( contextPath ) )
{
indexerEngine.remove( context, ac );