Index: src/java/org/apache/lucene/search/Query.java =================================================================== --- src/java/org/apache/lucene/search/Query.java (revision 788324) +++ src/java/org/apache/lucene/search/Query.java (working copy) @@ -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. - * *
* Only implemented by primitive queries, which re-write to themselves. + *
+ * NOTE: in 3.0 this method will throw + * {@link UnsupportedOperationException}. It is implemented now by calline + * {@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)); } /**