jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r239657 - in /incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene: ChildAxisQuery.java MatchAllScorer.java
Date Wed, 24 Aug 2005 13:19:59 GMT
Author: mreutegg
Date: Wed Aug 24 06:19:56 2005
New Revision: 239657

URL: http://svn.apache.org/viewcvs?rev=239657&view=rev
Log:
- Speedup various other queries

Modified:
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java?rev=239657&r1=239656&r2=239657&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java
(original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java
Wed Aug 24 06:19:56 2005
@@ -313,15 +313,16 @@
                 // collect the doc ids of all child nodes. we reuse the existing
                 // bitset.
                 hits.clear();
-                for (Iterator it = uuids.iterator(); it.hasNext();) {
-                    TermDocs children = reader.termDocs(new Term(FieldNames.PARENT, (String)
it.next()));
-                    try {
-                        while (children.next()) {
-                            hits.set(children.doc());
+                TermDocs docs = reader.termDocs();
+                try {
+                    for (Iterator it = uuids.iterator(); it.hasNext();) {
+                        docs.seek(new Term(FieldNames.PARENT, (String) it.next()));
+                        while (docs.next()) {
+                            hits.set(docs.doc());
                         }
-                    } finally {
-                        children.close();
                     }
+                } finally {
+                    docs.close();
                 }
                 // filter out the child nodes that do not match the name test
                 // if there is any name test at all.

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java?rev=239657&r1=239656&r2=239657&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java
(original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/MatchAllScorer.java
Wed Aug 24 06:19:56 2005
@@ -146,29 +146,24 @@
     private void calculateDocFilter() throws IOException {
         docFilter = new BitSet(reader.maxDoc());
         // we match all terms
-        TermEnum terms = null;
+        TermEnum terms = reader.terms(new Term(FieldNames.PROPERTIES, field));
         try {
-            terms = reader.terms(new Term(FieldNames.PROPERTIES, field));
-            while (terms.term() != null
-                    && terms.term().field() == FieldNames.PROPERTIES
-                    && terms.term().text().startsWith(field)) {
-                TermDocs termDocs = null;
-                try {
-                    termDocs = reader.termDocs(terms.term());
-                    while (termDocs.next()) {
-                        docFilter.set(termDocs.doc());
-                    }
-                } finally {
-                    if (termDocs != null) {
-                        termDocs.close();
+            TermDocs docs = reader.termDocs();
+            try {
+                while (terms.term() != null
+                        && terms.term().field() == FieldNames.PROPERTIES
+                        && terms.term().text().startsWith(field)) {
+                    docs.seek(terms);
+                    while (docs.next()) {
+                        docFilter.set(docs.doc());
                     }
+                    terms.next();
                 }
-                terms.next();
+            } finally {
+                docs.close();
             }
         } finally {
-            if (terms != null) {
-                terms.close();
-            }
+            terms.close();
         }
     }
 }



Mime
View raw message