jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1404930 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/Indexer.java
Date Fri, 02 Nov 2012 11:36:09 GMT
Author: thomasm
Date: Fri Nov  2 11:36:08 2012
New Revision: 1404930

URL: http://svn.apache.org/viewvc?rev=1404930&view=rev
Log:
OAK-137 Query: content index (adding an index didn't always work correctly)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/Indexer.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/Indexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/Indexer.java?rev=1404930&r1=1404929&r2=1404930&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/Indexer.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/Indexer.java
Fri Nov  2 11:36:08 2012
@@ -116,15 +116,15 @@ public class Indexer implements Property
         readRevision = revision;
         boolean exists = mk.nodeExists(indexRootNode, revision);
         createNodes(INDEX_CONTENT);
-            if (exists) {
+        if (exists) {
             String node = mk.getNodes(indexRootNode, revision, 1, 0, Integer.MAX_VALUE, null);
             JsopTokenizer t = new JsopTokenizer(node);
             NodeMap map = new NodeMap();
             t.read('{');
             NodeImpl n = NodeImpl.parse(map, t, 0);
-            String rev = JsopTokenizer.decodeQuoted(n.getNode(INDEX_CONTENT).getProperty("rev"));
+            String rev = n.getNode(INDEX_CONTENT).getProperty("rev");
             if (rev != null) {
-                readRevision = rev;
+                readRevision = JsopTokenizer.decodeQuoted(rev);
             }
             for (int i = 0; i < n.getChildNodeCount(); i++) {
                 String k = n.getChildNodeName(i);
@@ -608,22 +608,22 @@ public class Indexer implements Property
 
     private void buildIndex(PIndex index) {
         // TODO index: add ability to start / stop / restart indexing; log the progress
-        addRecursive(index, "/");
+        addRecursive(index, "/", mk.getHeadRevision());
     }
 
-    private void addRecursive(PIndex index, String path) {
+    private void addRecursive(PIndex index, String path, String revision) {
         if (isInIndex(path)) {
             return;
         }
         // TODO add: support large child node lists
-        String node = mk.getNodes(path, readRevision, 0, 0, Integer.MAX_VALUE, null);
+        String node = mk.getNodes(path, revision, 0, 0, Integer.MAX_VALUE, null);
         JsopTokenizer t = new JsopTokenizer(node);
         NodeMap map = new NodeMap();
         t.read('{');
         NodeImpl n = NodeImpl.parse(map, t, 0, path);
         index.addOrRemoveNode(n, true);
         for (Iterator<String> it = n.getChildNodeNames(Integer.MAX_VALUE); it.hasNext();)
{
-            addRecursive(index, PathUtils.concat(path, it.next()));
+            addRecursive(index, PathUtils.concat(path, it.next()), revision);
         }
         if (needFlush()) {
             flushBuffer();



Mime
View raw message