// == NG stuff
protected IteratorSearchRequest createRequest(Query bq, Integer from, Integer count, Integer hitLimit,
boolean uniqueRGA, List<ArtifactInfoFilter> extraFilters)
{
IteratorSearchRequest req = new IteratorSearchRequest(bq);
List<ArtifactInfoFilter> filters = new ArrayList<ArtifactInfoFilter>();
// security filter
filters.add(new ArtifactInfoFilter()
{
public boolean accepts(IndexingContext ctx, ArtifactInfo ai) {
return indexArtifactFilter.filterArtifactInfo(ai);
}
});
if (extraFilters != null && extraFilters.size() > 0) {
filters.addAll(extraFilters);
}
req.setArtifactInfoFilter(new AndMultiArtifactInfoFilter(filters));
if (uniqueRGA) {
req.setArtifactInfoPostprocessor(new ArtifactInfoPostprocessor()
{
public void postprocess(IndexingContext ctx, ArtifactInfo ai) {
ai.context = "Aggregated";
ai.repository = null;
}
});
}
else {
// we may do this only when !uniqueRGA, otherwise UniqueGAArtifactFilterPostprocessor nullifies
// ai.repository and ai.context
req.setArtifactInfoPostprocessor(new ArtifactInfoPostprocessor()
{
public void postprocess(IndexingContext ctx, ArtifactInfo ai) {
String result = ai.context;
try {
Repository sourceRepository = repositoryRegistry.getRepository(ai.repository);
result = sourceRepository.getName();
}
catch (NoSuchRepositoryException e) {
// nothing
}
ai.context = result;
}
});
}
if (from != null) {
req.setStart(from);
}
// MINDEXER-14: no hit limit anymore. But to make change least obtrusive, we set hitLimit as count 1st, and if
// user set count, it will override it anyway
if (hitLimit != null) {
req.setCount(hitLimit);
}
if (count != null) {
req.setCount(count);
}
return req;
}