Setting some things in ContextNodeFields to protected so they can be used in subclasses.
This commit is contained in:
parent
5990fe18c2
commit
7df0381a1e
2 changed files with 24 additions and 15 deletions
|
@ -33,18 +33,18 @@ import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames;
|
import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames;
|
||||||
|
|
||||||
public class ContextNodeFields implements DocumentModifier{
|
public class ContextNodeFields implements DocumentModifier{
|
||||||
private Model model;
|
protected Model model;
|
||||||
|
|
||||||
private boolean shutdown = false;
|
protected boolean shutdown = false;
|
||||||
private static ExecutorService threadPool = null;
|
protected static ExecutorService threadPool = null;
|
||||||
private static final int THREAD_POOL_SIZE = 10;
|
protected static final int THREAD_POOL_SIZE = 10;
|
||||||
|
|
||||||
private static final List<String> singleValuedQueriesForAgent = new ArrayList<String>();
|
protected static final List<String> singleValuedQueriesForAgent = new ArrayList<String>();
|
||||||
private static final List<String> singleValuedQueriesForInformationResource = new ArrayList<String>();
|
protected static final List<String> singleValuedQueriesForInformationResource = new ArrayList<String>();
|
||||||
private static final List<String> multiValuedQueriesForAgent = new ArrayList<String>();
|
protected static final List<String> multiValuedQueriesForAgent = new ArrayList<String>();
|
||||||
private static final String multiValuedQueryForInformationResource;
|
protected static final String multiValuedQueryForInformationResource;
|
||||||
|
|
||||||
private Log log = LogFactory.getLog(ContextNodeFields.class);
|
protected Log log = LogFactory.getLog(ContextNodeFields.class);
|
||||||
|
|
||||||
public ContextNodeFields(Model model){
|
public ContextNodeFields(Model model){
|
||||||
this.model = model;
|
this.model = model;
|
||||||
|
@ -57,12 +57,19 @@ public class ContextNodeFields implements DocumentModifier{
|
||||||
StringBuffer objectProperties = singleThreadExecute( individual, multiValuedQueriesForAgent);
|
StringBuffer objectProperties = singleThreadExecute( individual, multiValuedQueriesForAgent);
|
||||||
|
|
||||||
SolrInputField field = doc.getField(VitroSearchTermNames.ALLTEXT);
|
SolrInputField field = doc.getField(VitroSearchTermNames.ALLTEXT);
|
||||||
|
if( field == null ){
|
||||||
field.addValue(objectProperties + " " + runQuery(individual, multiValuedQueryForInformationResource), field.getBoost());
|
doc.addField(VitroSearchTermNames.ALLTEXT,
|
||||||
|
objectProperties + " " +
|
||||||
|
runQuery(individual, multiValuedQueryForInformationResource));
|
||||||
|
}else{
|
||||||
|
field.addValue(objectProperties + " " +
|
||||||
|
runQuery(individual, multiValuedQueryForInformationResource),
|
||||||
|
field.getBoost());
|
||||||
|
}
|
||||||
log.debug("context node values are retrieved");
|
log.debug("context node values are retrieved");
|
||||||
}
|
}
|
||||||
|
|
||||||
private StringBuffer singleThreadExecute(Individual individual, List<String> queries ){
|
protected StringBuffer singleThreadExecute(Individual individual, List<String> queries ){
|
||||||
StringBuffer propertyValues = new StringBuffer(" ");
|
StringBuffer propertyValues = new StringBuffer(" ");
|
||||||
for(String query : queries ){
|
for(String query : queries ){
|
||||||
propertyValues.append(runQuery(individual, query));
|
propertyValues.append(runQuery(individual, query));
|
||||||
|
@ -110,7 +117,7 @@ public class ContextNodeFields implements DocumentModifier{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static final String prefix = "prefix owl: <http://www.w3.org/2002/07/owl#> "
|
protected static final String prefix = "prefix owl: <http://www.w3.org/2002/07/owl#> "
|
||||||
+ " prefix vitroDisplay: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#> "
|
+ " prefix vitroDisplay: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#> "
|
||||||
+ " prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
|
+ " prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
|
||||||
+ " prefix core: <http://vivoweb.org/ontology/core#> "
|
+ " prefix core: <http://vivoweb.org/ontology/core#> "
|
||||||
|
|
|
@ -25,7 +25,9 @@ public class SourceInstitution implements DocumentModifier {
|
||||||
public void modifyDocument(Individual individual, SolrInputDocument doc,
|
public void modifyDocument(Individual individual, SolrInputDocument doc,
|
||||||
StringBuffer addUri) throws SkipIndividualException {
|
StringBuffer addUri) throws SkipIndividualException {
|
||||||
|
|
||||||
doc.addField(fieldForSiteURL, siteURL);
|
doc.addField(VitroSearchTermNames.SITE_URL, siteURL);
|
||||||
|
doc.addField(VitroSearchTermNames.SITE_NAME, siteURL);
|
||||||
|
|
||||||
doc.addField(fieldForSiteName, siteName);
|
doc.addField(fieldForSiteName, siteName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue