diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/DocumentModifier.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/DocumentModifier.java index a97f47349..277d96f4d 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/DocumentModifier.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/DocumentModifier.java @@ -7,6 +7,8 @@ import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchInputDocument /** * An object that can add to a SearchInputDocument. + * + * Implementations must be thread-safe. */ public interface DocumentModifier { /** diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/NameBoost.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/NameBoost.java index 631db918d..149b1da52 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/NameBoost.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/NameBoost.java @@ -23,9 +23,9 @@ public class NameBoost implements DocumentModifier { * please consider if you need to change this list * of name fields to boost. */ - private String[] fieldsToBoost = {NAME_RAW,NAME_LOWERCASE,NAME_UNSTEMMED,NAME_STEMMED}; + private final String[] fieldsToBoost = {NAME_RAW,NAME_LOWERCASE,NAME_UNSTEMMED,NAME_STEMMED}; - private Float boost; + private volatile Float boost; @Property(uri="http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationSetup#hasBoost") public void setBoost(float boost) { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/NameFields.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/NameFields.java index 9511b5e6d..a2e7e835a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/NameFields.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/NameFields.java @@ -2,6 +2,8 @@ package edu.cornell.mannlib.vitro.webapp.searchindex.documentBuilding; +import static edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames.NAME_RAW; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -15,18 +17,16 @@ import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchInputDocument import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService; import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService.ResultFormat; import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException; -import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames; import edu.cornell.mannlib.vitro.webapp.utils.configuration.ContextModelsUser; /** * Adds all labels to name fields, not just the one returned by Individual.getName(). */ public class NameFields implements DocumentModifier, ContextModelsUser { - private RDFService rdfService; - - public static final VitroSearchTermNames term = new VitroSearchTermNames(); public static final Log log = LogFactory.getLog(NameFields.class.getName()); + private volatile RDFService rdfService; + @Override public void setContextModels(ContextModelAccess models) { this.rdfService = models.getRDFService(); @@ -59,7 +59,7 @@ public class NameFields implements DocumentModifier, ContextModelsUser { } log.debug("Adding labels for " + ind.getURI() + " \"" + buffer.toString() + "\""); - doc.addField(term.NAME_RAW, buffer.toString()); + doc.addField(NAME_RAW, buffer.toString()); } catch (RDFServiceException e) { log.error("could not get the rdfs:label for " + ind.getURI(), e); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/SourceInstitution.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/SourceInstitution.java deleted file mode 100644 index b87a26d6f..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/SourceInstitution.java +++ /dev/null @@ -1,37 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.searchindex.documentBuilding; - -import edu.cornell.mannlib.vitro.webapp.beans.Individual; -import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchInputDocument; -import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames; - -public class SourceInstitution implements DocumentModifier { - - private String siteURL; - private String siteName; - - static VitroSearchTermNames term = new VitroSearchTermNames(); - private String fieldForSiteURL = term.SITE_URL; - private String fieldForSiteName = term.SITE_NAME; - - public SourceInstitution(String siteURL, String siteName) { - this.siteURL = siteURL; - this.siteName = siteName; - } - - @Override - public void modifyDocument(Individual individual, SearchInputDocument doc) { - - doc.addField(VitroSearchTermNames.SITE_URL, siteURL); - doc.addField(VitroSearchTermNames.SITE_NAME, siteURL); - - doc.addField(fieldForSiteName, siteName); - } - - @Override - public void shutdown() { - - } - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/ThumbnailImageURL.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/ThumbnailImageURL.java index a28020a6b..4638476c8 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/ThumbnailImageURL.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/documentBuilding/ThumbnailImageURL.java @@ -22,6 +22,7 @@ import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.RDFServiceUtils; import edu.cornell.mannlib.vitro.webapp.utils.configuration.ContextModelsUser; public class ThumbnailImageURL implements DocumentModifier, ContextModelsUser { + private static final Log log = LogFactory.getLog(ThumbnailImageURL.class); private static final String PREFIX = "prefix owl: " + " prefix vitroDisplay: " @@ -37,8 +38,7 @@ public class ThumbnailImageURL implements DocumentModifier, ContextModelsUser { + " ?uri ?a . " + " ?a ?downloadLocation . } "; - private RDFService rdf; - private Log log = LogFactory.getLog(ThumbnailImageURL.class); + private volatile RDFService rdf; @Override public void setContextModels(ContextModelAccess models) {