VIVO-374 Unpack Literals properly for the search index.

This commit is contained in:
j2blake 2013-10-16 16:16:34 -04:00
parent 4e851d0c35
commit ed39756a19

View file

@ -6,6 +6,7 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.SolrInputDocument;
@ -124,10 +125,15 @@ public class ContextNodeFields implements DocumentModifier{
String name = iter.next(); String name = iter.next();
RDFNode node = row.get( name ); RDFNode node = row.get( name );
if( node != null ){ if( node != null ){
if(addSpace) { String value = (node.isLiteral()) ?
text.append(" ").append( node.toString() ); node.asLiteral().getString():
} else { node.toString();
text.append(node.toString()); if (StringUtils.isNotBlank(value)) {
if(addSpace) {
text.append(" ").append( value );
} else {
text.append(value);
}
} }
}else{ }else{
log.debug(name + " is null"); log.debug(name + " is null");