lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy <w...@rcsb.rutgers.edu>
Subject Re: help with DIH transformer to add a suffix to column names
Date Mon, 22 Aug 2016 14:58:32 GMT
Hi Alex,Thank you for your response. I include the details below. Hope it
makes more clear. I wanted to append _stem to each column name, so I can
specify fields dynamically with *_stem w/o specifying each field
names.Thanks!I use solr 6.1.0  to index data from mysql database.I wrote a
java class of FieldTransformer as following. But it didn't work. It got null
when retrieving column name. How to fix the java code?
Thanks!-----------------------------------------------------------package
my.solr.transformer;	import java.util.ArrayList;	public class
FieldTransformer {	    public Object transformRow(Map<String, Object> row) {	    
int s = row.size(); 	    		    	System.out.println("row size = " + s);	    	    		    
for (Entry<String, Object> entry : row.entrySet()) {	    	    String
columnName = entry.getKey();	    	    row.put(columnName + "_stem",
entry.getValue());	    	    System.out.println("column name = " +
columnName);	    	    System.out.println("value = " + entry.getKey());	    	   
row.remove(columnName);	    	}	    	System.out.println("after processed row
size = " + row.size());	        return row;	    }	}-----------Other solr
config files------------------------------1. part of db-data-config.xml 
<entity name=&quot;pdb_entry&quot; pk=&quot;pdb_id&quot;
transformer=&quot;my.solr.transformer.FieldTransformer&quot;              
query=&quot;select * from pdb_entry where status_code = 'REL' &quot;	            
       
&lt;entity  name=&quot;citation&quot;  onError=&quot;continue&quot; 
transformer=&quot;my.solr.transformer.FieldTransformer&quot;	
query=&quot;select title  from citation where
Structure_ID='${pdb_entry.pdb_id}' and id = 'primary' and title is not
null&quot;                 parentDeltaQuery=&quot;select pdb_id from
pdb_entry where pdb_id=${citation.Structure_ID}&quot; >                           
  
.....      2. part of managed-schema file             ......     ......3.
part of solrconfig.xml file   db-data-config.xml              true               
explicit              edismax               pdb_id^20.0	       
classification_stem^10.0                *_stem^0.3                
rest_fields_stem ^0.3                                       7               
1000                text      



--
View this message in context: http://lucene.472066.n3.nabble.com/help-with-DIH-transformer-to-add-a-suffix-to-column-names-tp4292448p4292627.html
Sent from the Solr - User mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message