jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1371097 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java test/java/org/apache/jackrabbit/core/query/DescendantSelfAxisTest.java
Date Thu, 09 Aug 2012 08:55:14 GMT
Author: alexparvulescu
Date: Thu Aug  9 08:55:13 2012
New Revision: 1371097

URL: http://svn.apache.org/viewvc?rev=1371097&view=rev
Log:
JCR-3401 Wrong results when querying with a DescendantSelfAxisQuery

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DescendantSelfAxisTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java?rev=1371097&r1=1371096&r2=1371097&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java
Thu Aug  9 08:55:13 2012
@@ -517,7 +517,7 @@ class DescendantSelfAxisQuery extends Qu
                 return currentDoc;
             }
 
-            currentDoc = subScorer.nextDoc();
+            currentDoc = subScorer.advance(target);
             if (currentDoc == NO_MORE_DOCS) {
                 return NO_MORE_DOCS;
             } else {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DescendantSelfAxisTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DescendantSelfAxisTest.java?rev=1371097&r1=1371096&r2=1371097&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DescendantSelfAxisTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DescendantSelfAxisTest.java
Thu Aug  9 08:55:13 2012
@@ -17,6 +17,7 @@
 
 package org.apache.jackrabbit.core.query;
 
+import static org.apache.jackrabbit.JcrConstants.*;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 
@@ -29,4 +30,23 @@ public class DescendantSelfAxisTest exte
         String xpathNPE = "//element(*,nt:unstructured)[fn:lower-case(@jcr:language)='en']//element(*,nt:unstructured)[@jcr:message]/(@jcr:key|@jcr:message)";
         executeXPathQuery(xpathNPE, new Node[] {});
     }
+
+    /**
+     * JCR-3401 Wrong results when querying with a DescendantSelfAxisQuery
+     */
+    public void testNodeName() throws RepositoryException {
+        String name = "testNodeName" + System.currentTimeMillis();
+
+        Node foo = testRootNode.addNode("foo", NT_UNSTRUCTURED);
+        foo.addNode("branch1", NT_FOLDER).addNode(name, NT_FOLDER);
+        foo.addNode("branch2", NT_FOLDER).addNode(name, NT_FOLDER);
+        Node bar = testRootNode.addNode(name, NT_UNSTRUCTURED);
+
+        testRootNode.getSession().save();
+
+        executeXPathQuery("//element(*, nt:unstructured)[fn:name() = '" + name
+                + "']", new Node[] { bar });
+        executeXPathQuery("//element(" + name + ", nt:unstructured)",
+                new Node[] { bar });
+    }
 }



Mime
View raw message