lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r1544421 - in /lucene/dev/trunk/solr: ./ contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/
Date Fri, 22 Nov 2013 06:45:15 GMT
Author: shalin
Date: Fri Nov 22 06:45:14 2013
New Revision: 1544421

URL: http://svn.apache.org/r1544421
Log:
SOLR-4376: DataImportHandler uses wrong date format for last_index_time if a delta-import
is run first before any full-imports

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHProperties.java
    lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java
    lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SimplePropertiesWriter.java
    lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1544421&r1=1544420&r2=1544421&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Fri Nov 22 06:45:14 2013
@@ -135,6 +135,10 @@ Bug Fixes
   in zookeeper as UTF-8. This bug was found after upgrading to forbidden-apis
   1.4.  (Uwe Schindler)
 
+* SOLR-4376: DataImportHandler uses wrong date format for last_index_time if
+  a delta-import is run first before any full-imports.
+  (Sebastien Lorber, Arcadius Ahouansou via shalin)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHProperties.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHProperties.java?rev=1544421&r1=1544420&r2=1544421&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHProperties.java
(original)
+++ lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DIHProperties.java
Fri Nov 22 06:45:14 2013
@@ -37,6 +37,8 @@ public abstract class DIHProperties {
   
   public abstract Map<String, Object> readIndexerProperties();
   
+  public abstract String convertDateToString(Date d);
+  
   public Date getCurrentTimestamp() {
     return new Date();
   }

Modified: lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java?rev=1544421&r1=1544420&r2=1544421&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java
(original)
+++ lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java
Fri Nov 22 06:45:14 2013
@@ -117,6 +117,7 @@ public class DocBuilder {
   private VariableResolver getVariableResolver() {
     try {
       VariableResolver resolver = null;
+      String epoch = propWriter.convertDateToString(EPOCH);
       if(dataImporter != null && dataImporter.getCore() != null
           && dataImporter.getCore().getResourceLoader().getCoreProperties() != null){
         resolver =  new VariableResolver(dataImporter.getCore().getResourceLoader().getCoreProperties());
@@ -129,7 +130,7 @@ public class DocBuilder {
         indexerNamespace.put(LAST_INDEX_TIME, persistedProperties.get(LAST_INDEX_TIME));
       } else  {
         // set epoch
-        indexerNamespace.put(LAST_INDEX_TIME, EPOCH);
+        indexerNamespace.put(LAST_INDEX_TIME, epoch);
       }
       indexerNamespace.put(INDEX_START_TIME, dataImporter.getIndexStartTime());
       indexerNamespace.put("request", new HashMap<String,Object>(reqParams.getRawParams()));
@@ -140,7 +141,7 @@ public class DocBuilder {
         if (lastIndex != null) {
           entityNamespace.put(SolrWriter.LAST_INDEX_KEY, lastIndex);
         } else  {
-          entityNamespace.put(SolrWriter.LAST_INDEX_KEY, EPOCH);
+          entityNamespace.put(SolrWriter.LAST_INDEX_KEY, epoch);
         }
         indexerNamespace.put(entity.getName(), entityNamespace);
       }

Modified: lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SimplePropertiesWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SimplePropertiesWriter.java?rev=1544421&r1=1544420&r2=1544421&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SimplePropertiesWriter.java
(original)
+++ lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SimplePropertiesWriter.java
Fri Nov 22 06:45:14 2013
@@ -130,7 +130,8 @@ public class SimplePropertiesWriter exte
     
   }
   
-  protected String convertDateToString(Date d) {
+  @Override
+  public String convertDateToString(Date d) {
     return dateFormat.format(d);
   }
   protected Date convertStringToDate(String s) {

Modified: lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java?rev=1544421&r1=1544420&r2=1544421&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java
(original)
+++ lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java
Fri Nov 22 06:45:14 2013
@@ -23,7 +23,7 @@ import org.junit.Test;
  */
 
 /**
- * Test with various combinations of parameters, child entites, transformers.
+ * Test with various combinations of parameters, child entities, transformers.
  */
 public class TestSqlEntityProcessorDelta extends AbstractSqlEntityProcessorTestCase {
   private boolean delta = false;
@@ -48,6 +48,21 @@ public class TestSqlEntityProcessorDelta
     singleEntity(c);
     validateChanges();
   }
+  
+  @Test
+  public void testDeltaImportWithoutInitialFullImport() throws Exception {
+    log.debug("testDeltaImportWithoutInitialFullImport delta-import...");
+    countryEntity = false;
+    delta = true;
+    /*
+     * We need to add 2 in total: 
+     * +1 for deltaQuery i.e identifying id of items to update, 
+     * +1 for deletedPkQuery i.e delete query
+     */
+    singleEntity(totalPeople() + 2);
+    validateChanges();
+  }
+
   @Test
   public void testWithSimpleTransformer() throws Exception {
     log.debug("testWithSimpleTransformer full-import...");    



Mime
View raw message