You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by mi...@apache.org on 2009/06/25 15:13:05 UTC
svn commit: r788347 -
/lucene/java/trunk/src/java/org/apache/lucene/search/Query.java
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));
}
/**