lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject svn commit: r781925 - /lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java
Date Fri, 05 Jun 2009 06:46:09 GMT
Author: noble
Date: Fri Jun  5 06:46:09 2009
New Revision: 781925

URL: http://svn.apache.org/viewvc?rev=781925&view=rev
Log:
SOLR-1186 parentdeltaQuery invoked on wrong entity .This has been a bug from Solr1.3 itself

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

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=781925&r1=781924&r2=781925&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
Fri Jun  5 06:46:09 2009
@@ -237,7 +237,7 @@
     addStatusMessage("Identifying Delta");
     LOG.info("Starting delta collection.");
     Set<Map<String, Object>> deletedKeys = new HashSet<Map<String, Object>>();
-    Set<Map<String, Object>> allPks = collectDelta(root, null, resolver, deletedKeys);
+    Set<Map<String, Object>> allPks = collectDelta(root, resolver, deletedKeys);
     if (stop.get())
       return;
     addStatusMessage("Deltas Obtained");
@@ -565,34 +565,33 @@
    * @return an iterator to the list of keys for which Solr documents should be updated.
    */
   @SuppressWarnings("unchecked")
-  public Set<Map<String, Object>> collectDelta(DataConfig.Entity entity,
-                                               DataConfig.Entity parentEntity, VariableResolverImpl
resolver,
+  public Set<Map<String, Object>> collectDelta(DataConfig.Entity entity, VariableResolverImpl
resolver,
                                                Set<Map<String, Object>> deletedRows)
{
     //someone called abort
     if (stop.get())
       return new HashSet();
 
+    EntityProcessor entityProcessor = getEntityProcessor(entity);
+    ContextImpl context1 = new ContextImpl(entity, resolver, null, Context.FIND_DELTA, session,
null, this);
+    resolver.context = context1;
+    entityProcessor.init(context1);
+
     Set<Map<String, Object>> myModifiedPks = new HashSet<Map<String, Object>>();
 
     if (entity.entities != null) {
 
       for (DataConfig.Entity entity1 : entity.entities) {
         //this ensures that we start from the leaf nodes
-        myModifiedPks.addAll(collectDelta(entity1, entity, resolver, deletedRows));
+        myModifiedPks.addAll(collectDelta(entity1, resolver, deletedRows));
         //someone called abort
         if (stop.get())
           return new HashSet();
       }
 
     }
-    // identifying the modified rows for this entities
+    // identifying the modified rows for this entity
 
     Set<Map<String, Object>> deltaSet = new HashSet<Map<String, Object>>();
-    resolver.addNamespace(null, (Map) entity.allAttributes);
-    EntityProcessor entityProcessor = getEntityProcessor(entity);
-    ContextImpl context1 = new ContextImpl(entity, resolver, null, Context.FIND_DELTA, session,
null, this);
-    resolver.context = context1;
-    entityProcessor.init(context1);
     LOG.info("Running ModifiedRowKey() for Entity: " + entity.name);
     //get the modified rows in this entity
     while (true) {
@@ -638,23 +637,19 @@
     myModifiedPks.addAll(deltaSet);
     Set<Map<String, Object>> parentKeyList = new HashSet<Map<String, Object>>();
     //all that we have captured is useless (in a sub-entity) if no rows in the parent is
modified because of these
-    //so propogate up the changes in the chain
-    if (parentEntity != null && parentEntity.isDocRoot) {
-      EntityProcessor parentEntityProcessor = getEntityProcessor(parentEntity);
-      ContextImpl context2 = new ContextImpl(parentEntity, resolver, null, Context.FIND_DELTA,
session, null, this);
-      resolver.context = context2;
-      parentEntityProcessor.init(context2);
+    //propogate up the changes in the chain
+    if (entity.parentEntity != null) {
       // identifying deleted rows with deltas
 
       for (Map<String, Object> row : myModifiedPks) {
-        getModifiedParentRows(resolver.addNamespace(entity.name, row), entity.name, parentEntityProcessor,
parentKeyList);
+        getModifiedParentRows(resolver.addNamespace(entity.name, row), entity.name, entityProcessor,
parentKeyList);
         // check for abort
         if (stop.get())
           return new HashSet();
       }
       // running the same for deletedrows
       for (Map<String, Object> row : deletedSet) {
-        getModifiedParentRows(resolver.addNamespace(entity.name, row), entity.name, parentEntityProcessor,
parentKeyList);
+        getModifiedParentRows(resolver.addNamespace(entity.name, row), entity.name, entityProcessor,
parentKeyList);
         // check for abort
         if (stop.get())
           return new HashSet();



Mime
View raw message