lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject svn commit: r807537 - in /lucene/solr/trunk/contrib/dataimporthandler/src: main/java/org/apache/solr/handler/dataimport/ test/java/org/apache/solr/handler/dataimport/
Date Tue, 25 Aug 2009 09:54:26 GMT
Author: noble
Date: Tue Aug 25 09:54:26 2009
New Revision: 807537

URL: http://svn.apache.org/viewvc?rev=807537&view=rev
Log:
SOLR-1229 deletedPkQuery feature does not work when pk and uniqueKey field do not have the
same value

Modified:
    lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
    lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java
    lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java
    lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta2.java

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java?rev=807537&r1=807536&r2=807537&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
Tue Aug 25 09:54:26 2009
@@ -173,6 +173,10 @@
         dataSrc.close();
         dataSrc = null;
     }
+
+    public String getPk(){
+      return pk == null ? pkMappingFromSchema : pk;
+    }
   }
 
   public static class Script {

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java?rev=807537&r1=807536&r2=807537&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java
Tue Aug 25 09:54:26 2009
@@ -273,12 +273,7 @@
     Iterator<Map<String, Object>> iter = deletedKeys.iterator();
     while (iter.hasNext()) {
       Map<String, Object> map = iter.next();
-      Object key = null;
-      if(root.pkMappingFromSchema != null){
-        key = map.get(root.pkMappingFromSchema);
-      } else if(root.pk != null){
-          key = map.get(root.pk);
-     } 
+      Object key = map.get(root.getPk()); 
       if(key == null) {
         LOG.warn("no key was available for deleteted pk query");
         continue;
@@ -623,7 +618,7 @@
 
       //Check to see if this delete is in the current delta set
       for (Map<String, Object> modifiedRow : deltaSet) {
-        if (modifiedRow.get(entity.pk).equals(row.get(entity.pk))) {
+        if (modifiedRow.get(entity.getPk()).equals(row.get(entity.getPk()))) {
           deltaRemoveSet.add(modifiedRow);
         }
       }

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java?rev=807537&r1=807536&r2=807537&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta.java
Tue Aug 25 09:54:26 2009
@@ -281,7 +281,7 @@
 
   private static String dataConfig_delta = "<dataConfig>\n"
     + "       <document>\n"
-    + "               <entity name=\"x\" pk=\"id\" transformer=\"TemplateTransformer\""
+    + "               <entity name=\"x\" transformer=\"TemplateTransformer\""
     + "				query=\"" + FULLIMPORT_QUERY + "\""
     + "				deletedPkQuery=\"" + DELETED_PK_QUERY + "\""
     + " 				deltaImportQuery=\"select * from x where id='${dataimporter.delta.id}'\""

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta2.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta2.java?rev=807537&r1=807536&r2=807537&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta2.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestSqlEntityProcessorDelta2.java
Tue Aug 25 09:54:26 2009
@@ -277,12 +277,12 @@
 
   private static String dataConfig_delta2 = "<dataConfig>\n"
     + "       <document>\n"
-    + "               <entity name=\"x\" pk=\"id\" transformer=\"TemplateTransformer\""
+    + "               <entity name=\"x\" transformer=\"TemplateTransformer\""
     + "				query=\"" + FULLIMPORT_QUERY + "\""
     + "				deletedPkQuery=\"" + DELETED_PK_QUERY + "\""
     + " 				deltaImportQuery=\"select * from x where id='${dataimporter.delta.id}'\""
     + "				deltaQuery=\"" + DELTA_QUERY + "\">\n"
-    + "                       <field column=\"solr_id\" template=\"prefix-${x.id}\"/>\n"
+    + "                       <field column=\"tmpid\" template=\"prefix-${x.id}\" name=\"solr_id\"/>\n"
     + "                       <entity name=\"y\" query=\"select * from y where y.A='${x.id}'\">\n"
     + "                               <field column=\"desc\" />\n"
     + "                       </entity>\n" + "               </entity>\n"



Mime
View raw message