jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r551890 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.java
Date Fri, 29 Jun 2007 13:31:53 GMT
Author: mreutegg
Date: Fri Jun 29 06:31:52 2007
New Revision: 551890

URL: http://svn.apache.org/viewvc?view=rev&rev=551890
Log:
JCR-992: Improve Performance of DescendantSelfAxisQuery

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DescendantSelfAxisQuery.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?view=diff&rev=551890&r1=551889&r2=551890
==============================================================================
--- 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
Fri Jun 29 06:31:52 2007
@@ -26,7 +26,10 @@
 import org.apache.lucene.search.Weight;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.BitSet;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -334,15 +337,21 @@
             // check if doc is a descendant of one of the context nodes
             int parentDoc = hResolver.getParent(doc);
 
+            List ancestorDocs = new ArrayList();
+            ancestorDocs.add(new Integer(parentDoc));
+
             // traverse
             while (parentDoc != -1 && !contextHits.get(parentDoc)) {
                 parentDoc = hResolver.getParent(parentDoc);
+                ancestorDocs.add(new Integer(parentDoc));
             }
 
             if (parentDoc != -1) {
                 // since current parentDoc is a descendant of one of the context
-                // docs we can promote parentDoc to the context hits
-                contextHits.set(parentDoc);
+                // docs we can promote all ancestorDocs to the context hits
+                for (Iterator iter = ancestorDocs.iterator(); iter.hasNext();) {
+                    contextHits.set(((Integer) iter.next()).intValue());
+                }
                 return true;
             }
             return false;



Mime
View raw message