From 80a00a0251d82b044619878c1287e18f875ed72d Mon Sep 17 00:00:00 2001 From: ryounes Date: Fri, 24 Jun 2011 16:30:22 +0000 Subject: [PATCH] NIHVIVO-2767 Change loop variable test in getClassGroups() from docs.getNumFound() to maxHitCount, since docs.getNumFound() reflects the total number found in the index, not the total returned in docs --- .../search/controller/SolrPagedSearchController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrPagedSearchController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrPagedSearchController.java index 4947f652b..be369611d 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrPagedSearchController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrPagedSearchController.java @@ -277,7 +277,7 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { if( wasHtmlRequested ){ // Search request includes no classgroup and no type, so add classgroup search refinement links. if ( !classGroupFilterRequested && !typeFilterRequested ) { - List classgroups = getClassGroups(grpDao, docs); + List classgroups = getClassGroups(grpDao, docs, maxHitCount); List classGroupLinks = new ArrayList(classgroups.size()); for (VClassGroup vcg : classgroups) { if (vcg.getPublicName() != null) { @@ -340,16 +340,16 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { /** * Get the class groups represented for the individuals in the documents. */ - private List getClassGroups(VClassGroupDao grpDao, SolrDocumentList docs) { + private List getClassGroups(VClassGroupDao grpDao, SolrDocumentList docs, int maxHitCount) { LinkedHashMap grpMap = grpDao.getClassGroupMap(); int n = grpMap.size(); HashSet classGroupsInHits = new HashSet(n); int grpsFound = 0; - long hitCount = docs.getNumFound(); - for(int i=0; i grpsFound ;i++){ + for(int i = 0; i < maxHitCount && n > grpsFound ;i++){ try{ + //log.debug("Looking for classgroups from document number " + i); SolrDocument doc = docs.get(i); Collection grps = doc.getFieldValues(VitroTermNames.CLASSGROUP_URI); if (grps != null) {