From 5d87f1b9952f8c7ab1e40eee173c27b921484904 Mon Sep 17 00:00:00 2001 From: bdc34 Date: Thu, 15 Jul 2010 17:59:54 +0000 Subject: [PATCH] removing individuals from search index when they are inferred to be a prohibited type. NIHVIVO-824 --- .../vitro/webapp/search/indexing/IndexBuilder.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexBuilder.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexBuilder.java index c2a97abba..dd6693068 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexBuilder.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexBuilder.java @@ -16,7 +16,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import edu.cornell.mannlib.vitro.webapp.beans.Individual; -import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl; import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.dao.VClassDao; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; @@ -68,10 +67,10 @@ public class IndexBuilder { public IndexBuilder(ServletContext context, IndexerIface indexer, - List /*ObjectSourceIface*/ sources ){ + List /*ObjectSourceIface*/ sources){ this.indexer = indexer; this.sourceList = sources; - this.context = context; + this.context = context; this.changedUris = new HashSet(); this.indexingThread = new IndexBuilderThread(this); @@ -341,14 +340,18 @@ public class IndexBuilder { boolean prohibitedClass = false; if( classesProhibitedFromSearch != null ){ for( VClass vclass : ind.getVClasses() ){ - if( classesProhibitedFromSearch.isClassProhibited(vclass.getURI()) ){ + if( classesProhibitedFromSearch.isClassProhibited(vclass.getURI()) ){ prohibitedClass = true; + log.debug("not indexing " + ind.getURI() + " because class " + vclass.getURI() + " is on prohibited list."); break; } } } if( !prohibitedClass ) indexer.index(ind, newDoc); + else + indexer.removeFromIndex(ind); + }catch(Throwable ex){ log.debug("IndexBuilder.indexItem() Error indexing " + ind + "\n" +ex);