From dad9430c2f31c27fc7eee189d025f48a20f59b68 Mon Sep 17 00:00:00 2001 From: hudajkhan Date: Thu, 17 Jan 2013 11:53:41 -0500 Subject: [PATCH] updates to dynamic fields etc. for search, enable parameter to remove space for dynamic field --- solr/homeDirectoryTemplate/conf/schema.xml | 2 +- .../solr/documentBuilding/ContextNodeFields.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/solr/homeDirectoryTemplate/conf/schema.xml b/solr/homeDirectoryTemplate/conf/schema.xml index 0292cd5f8..b784f33c9 100644 --- a/solr/homeDirectoryTemplate/conf/schema.xml +++ b/solr/homeDirectoryTemplate/conf/schema.xml @@ -253,7 +253,7 @@ - + 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 bee1be521..b9d71beb6 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 @@ -80,7 +80,7 @@ public class ContextNodeFields implements DocumentModifier{ * @return StringBuffer with text values to add to ALLTEXT field of solr Document. */ protected StringBuffer executeQueryForValues( Individual individual, Collection queries){ - /* execute all the queries on the list and concat the values to add to all text */ + /* execute all the queries on the list and concat the values to add to all text */ RDFService rdfService = rdfServiceFactory.getRDFService(); StringBuffer allValues = new StringBuffer(""); @@ -95,7 +95,7 @@ public class ContextNodeFields implements DocumentModifier{ ResultSet results = RDFServiceUtils.sparqlSelectQuery(subInUriQuery, rdfService); while(results.hasNext()){ valuesForQuery.append( - getTextForRow( results.nextSolution() ) ) ; + getTextForRow( results.nextSolution(), true ) ) ; } }catch(Throwable t){ @@ -111,10 +111,10 @@ public class ContextNodeFields implements DocumentModifier{ } rdfService.close(); - return allValues; + return allValues; } - protected String getTextForRow( QuerySolution row){ + protected String getTextForRow( QuerySolution row, boolean addSpace){ if( row == null ) return ""; @@ -124,7 +124,11 @@ public class ContextNodeFields implements DocumentModifier{ String name = iter.next(); RDFNode node = row.get( name ); if( node != null ){ - text.append(" ").append( node.toString() ); + if(addSpace) { + text.append(" ").append( node.toString() ); + } else { + text.append(node.toString()); + } }else{ log.debug(name + " is null"); } @@ -132,7 +136,6 @@ public class ContextNodeFields implements DocumentModifier{ return text.toString(); } - public void shutdown(){ shutdown=true; }