lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r788347 - /lucene/java/trunk/src/java/org/apache/lucene/search/Query.java
Date Thu, 25 Jun 2009 13:13:05 GMT
Author: mikemccand
Date: Thu Jun 25 13:13:05 2009
New Revision: 788347

URL: http://svn.apache.org/viewvc?rev=788347&view=rev
Log:
LUCENE-1630: make Query.createQueryWeight optional, with default impl to wrap existing createWeight

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/Query.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/Query.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/Query.java?rev=788347&r1=788346&r2=788347&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/Query.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/Query.java Thu Jun 25 13:13:05 2009
@@ -88,18 +88,24 @@
    * @deprecated use {@link #createQueryWeight(Searcher)} instead.
    */
   protected Weight createWeight(Searcher searcher) throws IOException {
-    return createQueryWeight(searcher);
+    throw new UnsupportedOperationException();
   }
 
   /**
    * Expert: Constructs an appropriate {@link QueryWeight} implementation for
    * this query.
-   * 
    * <p>
    * Only implemented by primitive queries, which re-write to themselves.
+   * <p>
+   * <b>NOTE:</b> in 3.0 this method will throw
+   * {@link UnsupportedOperationException}. It is implemented now by calling
+   * {@link #createWeight(Searcher)} for backwards compatibility, for
+   * {@link Query} implementations that did not override it yet (but did
+   * override {@link #createWeight(Searcher)}).
    */
+  // TODO (3.0): change to throw UnsupportedOperationException.
   public QueryWeight createQueryWeight(Searcher searcher) throws IOException {
-    throw new UnsupportedOperationException();
+    return new QueryWeightWrapper(weight(searcher));
   }
 
   /**



Mime
View raw message