NIHVIVO-2736 Adding a DocumentModifier that adds source institution to a field called SITE_URL

This commit is contained in:
deepakkoni 2011-07-27 20:00:38 +00:00
parent 137357c754
commit dd132c040b
3 changed files with 38 additions and 0 deletions

View file

@ -581,6 +581,9 @@
<!-- field for storing locations of thumbnails --> <!-- field for storing locations of thumbnails -->
<field name="THUMBNAIL_URL" type="string" indexed="false" stored="true"/> <field name="THUMBNAIL_URL" type="string" indexed="false" stored="true"/>
<!-- field for source institution's name -->
<field name="SITE_URL" type="string" indexed="true" stored="true"/>
<!-- Copy nameLowercase to sortable field. --> <!-- Copy nameLowercase to sortable field. -->
<copyField source="nameLowercase" dest="nameLowercaseSingleValued" /> <copyField source="nameLowercase" dest="nameLowercaseSingleValued" />

View file

@ -70,4 +70,7 @@ public class VitroSearchTermNames {
/** download url location for thumbnail */ /** download url location for thumbnail */
public static final String THUMBNAIL_URL = "THUMBNAIL_URL"; public static final String THUMBNAIL_URL = "THUMBNAIL_URL";
/** source institution url */
public static final String SITE_URL = "SITE_URL";
} }

View file

@ -0,0 +1,32 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.search.solr;
import org.apache.solr.common.SolrInputDocument;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames;
public class SourceInstitution implements DocumentModifier {
private String siteURL;
static VitroSearchTermNames term = new VitroSearchTermNames();
private String fieldForSiteURL = term.SITE_URL;
public SourceInstitution(String siteURL){
this.siteURL = siteURL;
}
@Override
public void modifyDocument(Individual individual, SolrInputDocument doc,
StringBuffer addUri) throws SkipIndividualException {
doc.addField(fieldForSiteURL, siteURL);
}
@Override
public void shutdown() {
}
}