NIHVIVO-2767 Fix loop variable test in SolrPagedSearchController.getClassGroups(), so no error is generated if fewer results returned than the maxHitCount.

This commit is contained in:
ryounes 2011-06-24 19:26:51 +00:00
parent 9665f3b327
commit 76fc86abc4

View file

@ -347,9 +347,9 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet {
HashSet<String> classGroupsInHits = new HashSet<String>(n);
int grpsFound = 0;
for(int i = 0; i < maxHitCount && n > grpsFound ;i++){
long maxHits = Math.min(docs.getNumFound(), maxHitCount);
for(int i = 0; i < maxHits && n > grpsFound ;i++){
try{
//log.debug("Looking for classgroups from document number " + i);
SolrDocument doc = docs.get(i);
Collection<Object> grps = doc.getFieldValues(VitroTermNames.CLASSGROUP_URI);
if (grps != null) {