From ed39756a195928e8d9d59b1cb821172ae44346bb Mon Sep 17 00:00:00 2001 From: j2blake Date: Wed, 16 Oct 2013 16:16:34 -0400 Subject: [PATCH] VIVO-374 Unpack Literals properly for the search index. --- .../solr/documentBuilding/ContextNodeFields.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/documentBuilding/ContextNodeFields.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/documentBuilding/ContextNodeFields.java index 1ae12b010..693018358 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/documentBuilding/ContextNodeFields.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/documentBuilding/ContextNodeFields.java @@ -6,6 +6,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.solr.common.SolrInputDocument; @@ -124,10 +125,15 @@ public class ContextNodeFields implements DocumentModifier{ String name = iter.next(); RDFNode node = row.get( name ); if( node != null ){ - if(addSpace) { - text.append(" ").append( node.toString() ); - } else { - text.append(node.toString()); + String value = (node.isLiteral()) ? + node.asLiteral().getString(): + node.toString(); + if (StringUtils.isNotBlank(value)) { + if(addSpace) { + text.append(" ").append( value ); + } else { + text.append(value); + } } }else{ log.debug(name + " is null");