diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupCache.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupCache.java index 824581d97..f5a039ce5 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupCache.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupCache.java @@ -340,6 +340,7 @@ public class VClassGroupCache implements IndexingEventListener { if( group == null ) return; String groupUri = group.getURI(); + String facetOnField = VitroSearchTermNames.RDFTYPE; SolrQuery query = new SolrQuery( ). setRows(0). @@ -347,7 +348,7 @@ public class VClassGroupCache implements IndexingEventListener { setQuery(VitroSearchTermNames.CLASSGROUP_URI + ":" + groupUri ). //facet on type to get counts for classes in classgroup setFacet(true). - addFacetField( VitroSearchTermNames.RDFTYPE ). + addFacetField( facetOnField ). setFacetMinCount(0); log.debug("query: " + query); @@ -358,12 +359,22 @@ public class VClassGroupCache implements IndexingEventListener { log.debug("Number of individuals found " + individualCount); group.setIndividualCount((int) individualCount); //get counts for classes - FacetField ff = rsp.getFacetField( VitroSearchTermNames.RDFTYPE ); - List counts = ff.getValues(); - for( Count ct: counts){ - String classUri = ct.getName(); - long individualsInClass = ct.getCount(); - setClassCount( group, classUri, individualsInClass); + FacetField ff = rsp.getFacetField( facetOnField ); + if( ff != null ){ + List counts = ff.getValues(); + if( counts != null ){ + for( Count ct: counts){ + if( ct != null ){ + String classUri = ct.getName(); + long individualsInClass = ct.getCount(); + setClassCount( group, classUri, individualsInClass); + } + } + }else{ + log.debug("no Counts found for FacetField " + facetOnField); + } + }else{ + log.debug("no FaccetField found for " + facetOnField); } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexingEventListener.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexingEventListener.java new file mode 100644 index 000000000..2b88cafd6 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexingEventListener.java @@ -0,0 +1,20 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ +package edu.cornell.mannlib.vitro.webapp.search.indexing; + +/** + * Classes that implement this interface can get informed of + * events that happen to the IndexBuilder. + */ +public interface IndexingEventListener { + + public enum EventTypes { + START_UPDATE, + FINISHED_UPDATE, + START_FULL_REBUILD, + FINISH_FULL_REBUILD, + SHUTDOWN + } + + + public void notifyOfIndexingEvent(EventTypes ie); +}