jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1213756 - in /jackrabbit/sandbox/microkernel/src: main/java/org/apache/jackrabbit/mk/index/Indexer.java main/java/org/apache/jackrabbit/mk/index/PropertyIndex.java test/java/org/apache/jackrabbit/mk/index/PropertyIndexTest.java
Date Tue, 13 Dec 2011 15:58:21 GMT
Author: thomasm
Date: Tue Dec 13 15:58:20 2011
New Revision: 1213756

URL: http://svn.apache.org/viewvc?rev=1213756&view=rev
Log:
Indexer: use the prefix "id:" for unique properties, and the prefix "property:" for non-unique
properties (instead of appending ";unique" / ";nonUnique" to the node name).

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/Indexer.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/PropertyIndex.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/PropertyIndexTest.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/Indexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/Indexer.java?rev=1213756&r1=1213755&r2=1213756&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/Indexer.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/Indexer.java
Tue Dec 13 15:58:20 2011
@@ -149,10 +149,7 @@ public class Indexer {
             page = new BTreeLeaf(tree, parent, name,
                     new String[0], new String[0]);
         } else {
-            JsopTokenizer t = new JsopTokenizer(json);
-            t.read('{');
-            NodeMap map = new NodeMap();
-            NodeImpl n = NodeImpl.parse(map, t, 0);
+            NodeImpl n = NodeImpl.parse(json);
             String keys = n.getProperty("keys");
             String values = n.getProperty("values");
             String children = n.getProperty("children");

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/PropertyIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/PropertyIndex.java?rev=1213756&r1=1213755&r2=1213756&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/PropertyIndex.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/PropertyIndex.java
Tue Dec 13 15:58:20 2011
@@ -34,23 +34,21 @@ public class PropertyIndex implements In
     public PropertyIndex(Indexer indexer, String propertyName, boolean unique) {
         this.indexer = indexer;
         this.propertyName = propertyName;
-        this.tree = new BTree(indexer, "property:" + propertyName + ";" + (unique ? "unique"
: "nonUnique"), unique);
+        this.tree = new BTree(indexer, (unique ? "id:" : "property:") + propertyName, unique);
         tree.setMinSize(10);
     }
 
     public static PropertyIndex fromNodeName(Indexer indexer, String nodeName) {
-        if (!nodeName.startsWith("property:")) {
-            return null;
-        }
-        int index = nodeName.lastIndexOf(';');
         boolean unique;
-        if (index < 0) {
+        if (nodeName.startsWith("property:")) {
+            unique = false;
+        } else if (nodeName.startsWith("id:")) {
             unique = true;
         } else {
-            unique = nodeName.substring(index + 1).equals("unique");
-            nodeName = nodeName.substring(0, index);
+            return null;
         }
-        String propertyName = nodeName.substring("property:".length());
+        int index = nodeName.indexOf(':');
+        String propertyName = nodeName.substring(0, index);
         return new PropertyIndex(indexer, propertyName, unique);
     }
 

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/PropertyIndexTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/PropertyIndexTest.java?rev=1213756&r1=1213755&r2=1213756&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/PropertyIndexTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/PropertyIndexTest.java
Tue Dec 13 15:58:20 2011
@@ -41,7 +41,7 @@ public class PropertyIndexTest extends M
 
         // meta data
         String meta = mk.getNodes("/index", head);
-        Assert.assertEquals("{\":childNodeCount\":1,\"property:id;unique\":{\":childNodeCount\":0}}",
meta);
+        Assert.assertEquals("{\":childNodeCount\":1,\"id:id\":{\":childNodeCount\":0}}",
meta);
 
         String oldHead = head;
 



Mime
View raw message