jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r533620 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene: DerefQuery.java RangeQuery.java WildcardQuery.java
Date Mon, 30 Apr 2007 07:56:45 GMT
Author: mreutegg
Date: Mon Apr 30 00:56:44 2007
New Revision: 533620

URL: http://svn.apache.org/viewvc?view=rev&rev=533620
Log:
JCR-893: More query classes with missing extractTerms()

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardQuery.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java?view=diff&rev=533620&r1=533619&r2=533620
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DerefQuery.java
Mon Apr 30 00:56:44 2007
@@ -33,6 +33,7 @@
 import java.util.BitSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 /**
  * Implements a lucene <code>Query</code> which returns the nodes selected by
@@ -99,6 +100,13 @@
      */
     public String toString(String field) {
         return "DerefQuery";
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void extractTerms(Set terms) {
+        // no terms to extract
     }
 
     //-------------------< DerefWeight >------------------------------------

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeQuery.java?view=diff&rev=533620&r1=533619&r2=533620
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeQuery.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/RangeQuery.java
Mon Apr 30 00:56:44 2007
@@ -37,6 +37,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.HashMap;
+import java.util.Set;
 
 /**
  * Implements a variant of the lucene class {@link org.apache.lucene.search.RangeQuery}.
@@ -75,6 +76,12 @@
     private final int transform;
 
     /**
+     * The rewritten range query or <code>null</code> if the range spans more
+     * than {@link org.apache.lucene.search.BooleanQuery#maxClauseCount} terms.
+     */
+    private Query stdRangeQuery;
+
+    /**
      * Creates a new RangeQuery. The lower or the upper term may be
      * <code>null</code>, but not both!
      *
@@ -117,7 +124,8 @@
             Query stdRangeQueryImpl
                     = new org.apache.lucene.search.RangeQuery(lowerTerm, upperTerm, inclusive);
             try {
-                return stdRangeQueryImpl.rewrite(reader);
+                stdRangeQuery = stdRangeQueryImpl.rewrite(reader);
+                return stdRangeQuery;
             } catch (BooleanQuery.TooManyClauses e) {
                 log.debug("Too many terms to enumerate, using custom RangeQuery");
                 // failed, use own implementation
@@ -161,6 +169,15 @@
             buffer.append(Float.toString(getBoost()));
         }
         return buffer.toString();
+    }
+
+    /**
+     * {@inheritDoc}
+     */ 
+    public void extractTerms(Set terms) {
+        if (stdRangeQuery != null) {
+            stdRangeQuery.extractTerms(terms);
+        }
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardQuery.java?view=diff&rev=533620&r1=533619&r2=533620
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardQuery.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WildcardQuery.java
Mon Apr 30 00:56:44 2007
@@ -36,6 +36,7 @@
 import java.util.BitSet;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.Set;
 
 /**
  * Implements a wildcard query on a lucene field with an embedded property name
@@ -76,6 +77,12 @@
     private final int transform;
 
     /**
+     * The standard multi term query to execute wildcard queries. This is only
+     * set if the pattern matches less than {@link org.apache.lucene.search.BooleanQuery#maxClauseCount}.
+     */
+    private Query multiTermQuery;
+
+    /**
      * Creates a new <code>WildcardQuery</code>.
      *
      * @param field     the name of the field to search.
@@ -118,7 +125,8 @@
             }
         };
         try {
-            return stdWildcardQuery.rewrite(reader);
+            multiTermQuery = stdWildcardQuery.rewrite(reader);
+            return multiTermQuery;
         } catch (BooleanQuery.TooManyClauses e) {
             // MultiTermQuery not possible
             log.debug("Too many terms to enumerate, using custom WildcardQuery.");
@@ -144,6 +152,15 @@
      */
     public String toString(String field) {
         return propName + ":" + pattern;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void extractTerms(Set terms) {
+        if (multiTermQuery != null) {
+            multiTermQuery.extractTerms(terms);
+        }
     }
 
     /**



Mime
View raw message