Getting ride of vitro:keyword in lucene index, adding class names to lucene index.

This commit is contained in:
bdc34 2011-02-03 20:29:52 +00:00
parent e956a3668a
commit 5302a32096

View file

@ -96,7 +96,8 @@ public class Entity2LuceneDoc implements Obj2DocIface{
Individual ent = (Individual)obj; Individual ent = (Individual)obj;
String value; String value;
Document doc = new Document(); Document doc = new Document();
String classPublicNames = "";
//DocId //DocId
String id = ent.getURI(); String id = ent.getURI();
if( id == null ){ if( id == null ){
@ -145,14 +146,16 @@ public class Entity2LuceneDoc implements Obj2DocIface{
//rdf:type and ClassGroup //rdf:type and ClassGroup
List<VClass> vclasses = ent.getVClasses(false); List<VClass> vclasses = ent.getVClasses(false);
for( VClass clz : vclasses){ for( VClass clz : vclasses){
log.debug( id + " as type " + clz.getURI() );
//document boost for given classes //document boost for given classes
if( clz.getSearchBoost() != null ) if( clz.getSearchBoost() != null )
doc.setBoost( doc.getBoost() + clz.getSearchBoost() ); doc.setBoost( doc.getBoost() + clz.getSearchBoost() );
doc.add( new Field(term.RDFTYPE, clz.getURI(), doc.add( new Field(term.RDFTYPE, clz.getURI(),
Field.Store.YES, Field.Index.NOT_ANALYZED)); Field.Store.YES, Field.Index.NOT_ANALYZED));
if( clz.getName() != null )
classPublicNames = classPublicNames + " " + clz.getName();
//Classgroup URI //Classgroup URI
if( clz.getGroupURI() != null ) if( clz.getGroupURI() != null )
doc.add( new Field(term.CLASSGROUP_URI, clz.getGroupURI(), doc.add( new Field(term.CLASSGROUP_URI, clz.getGroupURI(),
@ -244,6 +247,7 @@ public class Entity2LuceneDoc implements Obj2DocIface{
value+= " "+ ( ((t=ent.getBlurb()) == null)?"":t ); value+= " "+ ( ((t=ent.getBlurb()) == null)?"":t );
value+= " "+ getKeyterms(ent); value+= " "+ getKeyterms(ent);
value+= " " + classPublicNames;
List<DataPropertyStatement> dataPropertyStatements = ent.getDataPropertyStatements(); List<DataPropertyStatement> dataPropertyStatements = ent.getDataPropertyStatements();
if (dataPropertyStatements != null) { if (dataPropertyStatements != null) {
@ -370,15 +374,8 @@ public class Entity2LuceneDoc implements Obj2DocIface{
} }
private String getKeyterms(Individual ent){ private String getKeyterms(Individual ent){
//List<String> terms = entityWADao.getKeywords(ent.getId()); /* bdc34: vitro:keywords are no longer being indexed */
List<String> terms = ent.getKeywords(); return "";
String rv = "";
if( terms != null ){
for( String term : terms){
rv += term + " ";
}
}
return rv;
} }
public static float NAME_BOOST = 10; public static float NAME_BOOST = 10;