if (ctx == null) {
return IteratorSearchResponse.empty(pq);
}
// to have sorted results by version in descending order
final IteratorSearchRequest sreq = new IteratorSearchRequest(pq, ctx);
// filter that filters out classified artifacts
final ClassifierArtifactInfoFilter classifierFilter = new ClassifierArtifactInfoFilter();
// combine it with others if needed (unused in cli, but perm filtering in server!)
if (request.getArtifactInfoFilter() != null) {
final AndMultiArtifactInfoFilter andArtifactFilter =
new AndMultiArtifactInfoFilter(Arrays.asList(new ArtifactInfoFilter[]{
classifierFilter,
request.getArtifactInfoFilter()
}));
sreq.setArtifactInfoFilter(andArtifactFilter);
}
else {
sreq.setArtifactInfoFilter(classifierFilter);
}
return indexer.searchIterator(sreq);
}