NIHVIVO-2847 - Added core:URLLink to set of prohibited classes.

This commit is contained in:
deepakkoni 2011-07-11 15:22:14 +00:00
parent d08e8ef6ce
commit be0a835b29

View file

@ -42,6 +42,8 @@ public class IndividualToSolrDocument {
private static List<String> contextNodeClassNames = new ArrayList<String>(); private static List<String> contextNodeClassNames = new ArrayList<String>();
private static List<String> blackListedClasses = new ArrayList<String>();
public IndividualToSolrDocument( public IndividualToSolrDocument(
ClassProhibitedFromSearch classesProhibitedFromSearch, ClassProhibitedFromSearch classesProhibitedFromSearch,
IndividualProhibitedFromSearch individualProhibitedFromSearch){ IndividualProhibitedFromSearch individualProhibitedFromSearch){
@ -59,8 +61,10 @@ public class IndividualToSolrDocument {
this.individualProhibitedFromSearch = individualProhibitedFromSearch; this.individualProhibitedFromSearch = individualProhibitedFromSearch;
this.documentModifiers = docModifiers; this.documentModifiers = docModifiers;
fillContextNodes(); fillContextNodes();
fillInBlackListedClasses();
} }
@SuppressWarnings("static-access") @SuppressWarnings("static-access")
public SolrInputDocument translate(Individual ind) throws IndexingException{ public SolrInputDocument translate(Individual ind) throws IndexingException{
try{ try{
@ -256,7 +260,7 @@ public class IndividualToSolrDocument {
continue; continue;
} else if(clz.getURI().startsWith(OWL.NS)){ } else if(clz.getURI().startsWith(OWL.NS)){
throw new SkipIndividualException("not indexing " + ind.getURI() + " because of type " + clz.getURI() ); throw new SkipIndividualException("not indexing " + ind.getURI() + " because of type " + clz.getURI() );
} else if(contextNodeClassNames.contains(superLclName)) { // check to see if context node is being indexed. } else if(contextNodeClassNames.contains(superLclName) || blackListedClasses.contains(superLclName)) { // check to see if context node is being indexed.
throw new SkipIndividualException("not indexing " + ind.getURI() + " because of context node type " + clz.getURI() ); throw new SkipIndividualException("not indexing " + ind.getURI() + " because of context node type " + clz.getURI() );
} else { } else {
if( !prohibited && classesProhibitedFromSearch.isClassProhibitedFromSearch(clz.getURI())) if( !prohibited && classesProhibitedFromSearch.isClassProhibitedFromSearch(clz.getURI()))
@ -355,8 +359,16 @@ public class IndividualToSolrDocument {
IndividualToSolrDocument.contextNodeClassNames.add("AdvisingRelationship"); IndividualToSolrDocument.contextNodeClassNames.add("AdvisingRelationship");
IndividualToSolrDocument.contextNodeClassNames.add("Authorship"); IndividualToSolrDocument.contextNodeClassNames.add("Authorship");
IndividualToSolrDocument.contextNodeClassNames.add("AcademicDegree"); IndividualToSolrDocument.contextNodeClassNames.add("AcademicDegree");
} }
// bk392 : Ideally this needs to be removed and the check for a blacklisted class
// has to made by firing a query against the display model which contains
// blacklisted classes (grabbed from search.n3)
private void fillInBlackListedClasses() {
//class that needs to be excluded from search
IndividualToSolrDocument.blackListedClasses.add("URLLink");
}
public static float NAME_BOOST = 1.2F; public static float NAME_BOOST = 1.2F;