Author: pramirez
Date: Thu Sep 27 03:24:18 2012
New Revision: 1390822

URL: http://svn.apache.org/viewvc?rev=1390822&view=rev
Log:
OODT-511 Fixed date formatting so it no longer removes metadata; side affect 
introduced from call to getAllValues. Also updated indexer.properties to 
specify CAS.ProductReceivedTime instead of ProductReceivedTime as that is the 
correct key name. 

Modified:
    
oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
    oodt/trunk/filemgr/src/main/resources/indexer.properties

Modified: 
oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java?rev=1390822&r1=1390821&r2=1390822&view=diff
==============================================================================
--- 
oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
 (original)
+++ 
oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
 Thu Sep 27 03:24:18 2012
@@ -446,7 +446,7 @@ public class SolrIndexer {
            throws java.text.ParseException {
                // Do metadata replacement
                for (String key : config.getReplacementKeys()) {
-                       List<String> values = metadata.getAllValues(key);
+                       List<String> values = metadata.getAllMetadata(key);
                        if (values != null) {
                                List<String> newValues = new 
ArrayList<String>();
                                for (String value : values) {
@@ -459,16 +459,18 @@ public class SolrIndexer {
                // Format dates
                for (Object key : config.getFormatProperties().keySet()) {
                        String keyString = (String) key;
-                       List<String> values = metadata.getAllValues(keyString);
                        if (metadata.containsKey(keyString)) {
-                               List<String> newValues = new 
ArrayList<String>();
-                               SimpleDateFormat format = new 
SimpleDateFormat(config
-                                   
.getFormatProperties().getProperty(keyString).trim());
-                               for (String value : values) {
-                                       newValues.add(formatDate(format, 
value));
+                               List<String> values = 
metadata.getAllMetadata(keyString);
+                               if (values != null) {
+                                       List<String> newValues = new 
ArrayList<String>();
+                                       SimpleDateFormat format = new 
SimpleDateFormat(config
+                                           
.getFormatProperties().getProperty(keyString).trim());
+                                       for (String value : values) {
+                                               
newValues.add(formatDate(format, value));
+                                       }
+                                       metadata.removeMetadata(keyString);
+                                       metadata.addMetadata(keyString, 
newValues);
                                }
-                               metadata.removeMetadata(keyString);
-                               metadata.addMetadata(keyString, newValues);
                        }
                }
        }

Modified: oodt/trunk/filemgr/src/main/resources/indexer.properties
URL: 
http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/main/resources/indexer.properties?rev=1390822&r1=1390821&r2=1390822&view=diff
==============================================================================
--- oodt/trunk/filemgr/src/main/resources/indexer.properties (original)
+++ oodt/trunk/filemgr/src/main/resources/indexer.properties Thu Sep 27 
03:24:18 2012
@@ -46,7 +46,7 @@ map.CAS.ProductId=id
 # index doc field terminology. Only mapped fields 
 # will be added to the Solr index.
 map.MimeType=mimetype
-map.ProductReceivedTime=receivedtime
+map.CAS.ProductReceivedTime=receivedtime
 map.FileSize=filesize
 map.FileName=filename
 # map.ProductURL=producturl
@@ -55,5 +55,5 @@ map.FileName=filename
 # field coming from Solr. Solr requires a specific 
 # format when you want to map to a date so one must
 # specify the source format in the filemanager.  
-format.ProductReceivedTime=yyyy-MM-dd'T'HH:mm:ss.SSS
+format.CAS.ProductReceivedTime=yyyy-MM-dd'T'HH:mm:ss.SSS
 


Reply via email to