jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1393950 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene: LuceneEditor.java LuceneReindexHook.java
Date Thu, 04 Oct 2012 08:14:49 GMT
Author: alexparvulescu
Date: Thu Oct  4 08:14:49 2012
New Revision: 1393950

URL: http://svn.apache.org/viewvc?rev=1393950&view=rev
Log:
OAK-340 Basic reindex support in the lucene index
 - removing the 'null' call, using an empty node state as reference instead (a trick I got
from Jukka)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneReindexHook.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java?rev=1393950&r1=1393949&r2=1393950&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneEditor.java
Thu Oct  4 08:14:49 2012
@@ -79,11 +79,6 @@ class LuceneEditor implements CommitHook
         this.index = indexDefinition;
     }
 
-    /*
-     * 
-     * If before is null, then the #processCommit call is treated as a full
-     * reindex call
-     */
     @Override
     public NodeState processCommit(NodeState before, NodeState after)
             throws CommitFailedException {
@@ -99,20 +94,12 @@ class LuceneEditor implements CommitHook
             IndexWriter writer = new IndexWriter(directory, config);
             try {
                 LuceneDiff diff = new LuceneDiff(writer, "/");
-                if (before != null) {
-                    // normal diff
-                    after.compareAgainstBaseState(before, diff);
-                } else {
-                    // trigger re-indexing
-                    diff.childNodeAdded("", after);
-                }
-
+                after.compareAgainstBaseState(before, diff);
                 diff.postProcess(after);
-                writer.commit();
-                builder.setProperty(INDEX_UPDATE,
-                        new LongValue(System.currentTimeMillis()));
             } finally {
                 writer.close();
+                builder.setProperty(INDEX_UPDATE,
+                        new LongValue(System.currentTimeMillis()));
             }
             return rootBuilder.getNodeState();
         } catch (IOException e) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneReindexHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneReindexHook.java?rev=1393950&r1=1393949&r2=1393950&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneReindexHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/lucene/LuceneReindexHook.java
Thu Oct  4 08:14:49 2012
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeState;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
 import org.apache.jackrabbit.oak.spi.query.IndexDefinition;
@@ -91,7 +92,8 @@ public class LuceneReindexHook implement
         for (IndexDefinition def : defsChanged) {
             hooks.add(new LuceneEditor(def));
         }
-        NodeState done = CompositeHook.compose(hooks).processCommit(null, after);
+        NodeState done = CompositeHook.compose(hooks).processCommit(
+                MemoryNodeState.EMPTY_NODE, after);
         LOG.debug("done reindexing repository content in {} ms.",
                 System.currentTimeMillis() - t);
         return done;



Mime
View raw message