Index: src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java
===================================================================
--- src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java	(revision 801851)
+++ src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java	(working copy)
@@ -26,7 +26,7 @@
 import org.apache.lucene.search.CheckHits;
 import org.apache.lucene.search.Explanation;
 import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.QueryWeight;
+import org.apache.lucene.search.Weight;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.LuceneTestCase;
@@ -158,7 +158,7 @@
    */
   public void testSpanNearScorerSkipTo1() throws Exception {
     SpanNearQuery q = makeQuery();
-    QueryWeight w = q.queryWeight(searcher);
+    Weight w = q.weight(searcher);
     Scorer s = w.scorer(searcher.getIndexReader(), true, false);
     assertEquals(1, s.advance(1));
   }
@@ -168,7 +168,7 @@
    */
   public void testSpanNearScorerExplain() throws Exception {
     SpanNearQuery q = makeQuery();
-    QueryWeight w = q.queryWeight(searcher);
+    Weight w = q.weight(searcher);
     Scorer s = w.scorer(searcher.getIndexReader(), true, false);
     Explanation e = s.explain(1);
     assertTrue("Scorer explanation value for doc#1 isn't positive: "
Index: src/test/org/apache/lucene/search/spans/TestSpans.java
===================================================================
--- src/test/org/apache/lucene/search/spans/TestSpans.java	(revision 801851)
+++ src/test/org/apache/lucene/search/spans/TestSpans.java	(working copy)
@@ -409,7 +409,7 @@
       }
     };
 
-    Scorer spanScorer = snq.weight(searcher).scorer(searcher.getIndexReader());
+    Scorer spanScorer = snq.weight(searcher).scorer(searcher.getIndexReader(), true, false);
 
     assertTrue("first doc", spanScorer.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
     assertEquals("first doc number", spanScorer.docID(), 11);
Index: src/test/org/apache/lucene/search/spans/JustCompileSearchSpans.java
===================================================================
--- src/test/org/apache/lucene/search/spans/JustCompileSearchSpans.java	(revision 801851)
+++ src/test/org/apache/lucene/search/spans/JustCompileSearchSpans.java	(working copy)
@@ -21,9 +21,8 @@
 import java.util.Collection;
 
 import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.search.QueryWeight;
-import org.apache.lucene.search.Similarity;
 import org.apache.lucene.search.Weight;
+import org.apache.lucene.search.Similarity;
 
 /**
  * Holds all implementations of classes in the o.a.l.s.spans package as a
@@ -123,16 +122,10 @@
   
   static final class JustCompileSpanScorer extends SpanScorer {
 
-    /** @deprecated delete in 3.0 */
     protected JustCompileSpanScorer(Spans spans, Weight weight,
         Similarity similarity, byte[] norms) throws IOException {
       super(spans, weight, similarity, norms);
     }
-    
-    protected JustCompileSpanScorer(Spans spans, QueryWeight weight,
-        Similarity similarity, byte[] norms) throws IOException {
-      super(spans, weight, similarity, norms);
-    }
 
     protected boolean setFreqCurrentDoc() throws IOException {
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
Index: src/test/org/apache/lucene/search/TestTermScorer.java
===================================================================
--- src/test/org/apache/lucene/search/TestTermScorer.java	(revision 801851)
+++ src/test/org/apache/lucene/search/TestTermScorer.java	(working copy)
@@ -69,7 +69,7 @@
         Term allTerm = new Term(FIELD, "all");
         TermQuery termQuery = new TermQuery(allTerm);
 
-        QueryWeight weight = termQuery.queryWeight(indexSearcher);
+        Weight weight = termQuery.weight(indexSearcher);
 
         TermScorer ts = new TermScorer(weight,
                                        indexReader.termDocs(allTerm), indexSearcher.getSimilarity(),
@@ -131,7 +131,7 @@
         Term allTerm = new Term(FIELD, "all");
         TermQuery termQuery = new TermQuery(allTerm);
 
-        QueryWeight weight = termQuery.queryWeight(indexSearcher);
+        Weight weight = termQuery.weight(indexSearcher);
 
         TermScorer ts = new TermScorer(weight,
                                        indexReader.termDocs(allTerm), indexSearcher.getSimilarity(),
@@ -148,7 +148,7 @@
         Term allTerm = new Term(FIELD, "all");
         TermQuery termQuery = new TermQuery(allTerm);
 
-        QueryWeight weight = termQuery.queryWeight(indexSearcher);
+        Weight weight = termQuery.weight(indexSearcher);
 
         TermScorer ts = new TermScorer(weight,
                                        indexReader.termDocs(allTerm), indexSearcher.getSimilarity(),
@@ -163,7 +163,7 @@
         Term allTerm = new Term(FIELD, "all");
         TermQuery termQuery = new TermQuery(allTerm);
 
-        QueryWeight weight = termQuery.queryWeight(indexSearcher);
+        Weight weight = termQuery.weight(indexSearcher);
 
         TermScorer ts = new TermScorer(weight,
                                        indexReader.termDocs(allTerm), indexSearcher.getSimilarity(),
@@ -181,7 +181,7 @@
 
         Term dogsTerm = new Term(FIELD, "dogs");
         termQuery = new TermQuery(dogsTerm);
-        weight = termQuery.queryWeight(indexSearcher);
+        weight = termQuery.weight(indexSearcher);
 
         ts = new TermScorer(weight, indexReader.termDocs(dogsTerm), indexSearcher.getSimilarity(),
                                        indexReader.norms(FIELD));
Index: src/test/org/apache/lucene/search/JustCompileSearch.java
===================================================================
--- src/test/org/apache/lucene/search/JustCompileSearch.java	(revision 801851)
+++ src/test/org/apache/lucene/search/JustCompileSearch.java	(working copy)
@@ -40,7 +40,7 @@
 
   static final class JustCompileSearcher extends Searcher {
 
-    protected QueryWeight createQueryWeight(Query query) throws IOException {
+    protected Weight createWeight(Query query) throws IOException {
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
     }
     
@@ -94,7 +94,7 @@
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
     }
 
-    public Explanation explain(QueryWeight weight, int doc) throws IOException {
+    public Explanation explain(Weight weight, int doc) throws IOException {
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
     }
 
@@ -106,17 +106,17 @@
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
     }
 
-    public void search(QueryWeight weight, Filter filter, Collector results)
+    public void search(Weight weight, Filter filter, Collector results)
         throws IOException {
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
     }
 
-    public TopDocs search(QueryWeight weight, Filter filter, int n)
+    public TopDocs search(Weight weight, Filter filter, int n)
         throws IOException {
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
     }
 
-    public TopFieldDocs search(QueryWeight weight, Filter filter, int n, Sort sort)
+    public TopFieldDocs search(Weight weight, Filter filter, int n, Sort sort)
         throws IOException {
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
     }
@@ -296,7 +296,7 @@
 
   static final class JustCompilePhraseScorer extends PhraseScorer {
 
-    JustCompilePhraseScorer(QueryWeight weight, TermPositions[] tps, int[] offsets,
+    JustCompilePhraseScorer(Weight weight, TermPositions[] tps, int[] offsets,
         Similarity similarity, byte[] norms) {
       super(weight, tps, offsets, similarity, norms);
     }
@@ -423,9 +423,9 @@
 
   }
 
-  static final class JustCompileWeight extends QueryWeight {
+  static final class JustCompileWeight extends Weight {
 
-    public Explanation explain(IndexReader reader, int doc) throws IOException {
+    public Explanation explain(Searcher searcher, IndexReader reader, int doc) throws IOException {
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
     }
 
Index: src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
===================================================================
--- src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java	(revision 801851)
+++ src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java	(working copy)
@@ -133,7 +133,7 @@
 
     QueryUtils.check(dq,s);
 
-    final QueryWeight dw = dq.queryWeight(s);
+    final Weight dw = dq.weight(s);
     final Scorer ds = dw.scorer(r, true, false);
     final boolean skipOk = ds.advance(3) != DocIdSetIterator.NO_MORE_DOCS;
     if (skipOk) {
@@ -148,7 +148,7 @@
 
     QueryUtils.check(dq,s);
 
-    final QueryWeight dw = dq.queryWeight(s);
+    final Weight dw = dq.weight(s);
     final Scorer ds = dw.scorer(r, true, false);
     assertTrue("firsttime skipTo found no match", ds.advance(3) != DocIdSetIterator.NO_MORE_DOCS);
     assertEquals("found wrong docid", "d4", r.document(ds.docID()).get("id"));
Index: src/test/org/apache/lucene/search/QueryUtils.java
===================================================================
--- src/test/org/apache/lucene/search/QueryUtils.java	(revision 801851)
+++ src/test/org/apache/lucene/search/QueryUtils.java	(working copy)
@@ -105,7 +105,7 @@
    * @throws IOException if serialization check fail. 
    */
   private static void checkSerialization(Query q, Searcher s) throws IOException {
-    QueryWeight w = q.queryWeight(s);
+    Weight w = q.weight(s);
     try {
       ByteArrayOutputStream bos = new ByteArrayOutputStream();
       ObjectOutputStream oos = new ObjectOutputStream(bos);
@@ -150,7 +150,7 @@
       //System.out.print("Order:");for (int i = 0; i < order.length; i++) System.out.print(order[i]==skip_op ? " skip()":" next()"); System.out.println();
       final int opidx[] = {0};
 
-      final QueryWeight w = q.queryWeight(s);
+      final Weight w = q.weight(s);
       final Scorer scorer = w.scorer(s.getIndexReader(), true, false);
       if (scorer == null) {
         continue;
@@ -234,7 +234,7 @@
         float score = scorer.score();
         try {
           for (int i=lastDoc[0]+1; i<=doc; i++) {
-            QueryWeight w = q.queryWeight(s);
+            Weight w = q.weight(s);
             Scorer scorer = w.scorer(s.getIndexReader(), true, false);
             Assert.assertTrue("query collected "+doc+" but skipTo("+i+") says no more docs!",scorer.advance(i) != DocIdSetIterator.NO_MORE_DOCS);
             Assert.assertEquals("query collected "+doc+" but skipTo("+i+") got to "+scorer.docID(),doc,scorer.docID());
@@ -254,7 +254,7 @@
         return false;
       }
     });
-    QueryWeight w = q.queryWeight(s);
+    Weight w = q.weight(s);
     Scorer scorer = w.scorer(s.getIndexReader(), true, false);
     if (scorer != null) {
       boolean more = scorer.advance(lastDoc[0] + 1) != DocIdSetIterator.NO_MORE_DOCS;
Index: src/java/org/apache/lucene/search/ConstantScoreQuery.java
===================================================================
--- src/java/org/apache/lucene/search/ConstantScoreQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/ConstantScoreQuery.java	(working copy)
@@ -18,6 +18,7 @@
  */
 
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.util.ReaderUtil;
 
 import java.io.IOException;
 import java.util.Set;
@@ -50,7 +51,7 @@
     // but may not be OK for highlighting
   }
 
-  protected class ConstantWeight extends QueryWeight {
+  protected class ConstantWeight extends Weight {
     private Similarity similarity;
     private float queryNorm;
     private float queryWeight;
@@ -81,9 +82,9 @@
       return new ConstantScorer(similarity, reader, this);
     }
 
-    public Explanation explain(IndexReader reader, int doc) throws IOException {
-
-      ConstantScorer cs = (ConstantScorer) scorer(reader, true, false);
+    public Explanation explain(Searcher searcher, IndexReader reader, int doc) throws IOException {
+      
+      ConstantScorer cs = new ConstantScorer(similarity, reader, this);
       boolean exists = cs.docIdSetIterator.advance(doc) == doc;
 
       ComplexExplanation result = new ComplexExplanation();
@@ -110,7 +111,7 @@
     final float theScore;
     int doc = -1;
 
-    public ConstantScorer(Similarity similarity, IndexReader reader, QueryWeight w) throws IOException {
+    public ConstantScorer(Similarity similarity, IndexReader reader, Weight w) throws IOException {
       super(similarity);
       theScore = w.getValue();
       DocIdSet docIdSet = filter.getDocIdSet(reader);
@@ -162,7 +163,7 @@
     }
   }
 
-  public QueryWeight createQueryWeight(Searcher searcher) {
+  public Weight createWeight(Searcher searcher) {
     return new ConstantScoreQuery.ConstantWeight(searcher);
   }
 
Index: src/java/org/apache/lucene/search/QueryWeightWrapper.java
===================================================================
--- src/java/org/apache/lucene/search/QueryWeightWrapper.java	(revision 801851)
+++ src/java/org/apache/lucene/search/QueryWeightWrapper.java	(working copy)
@@ -1,68 +0,0 @@
-package org.apache.lucene.search;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.IOException;
-
-import org.apache.lucene.index.IndexReader;
-
-/**
- * A wrapper class for the deprecated {@link Weight}.
- * Please re-implement any custom Weight classes as {@link
- * QueryWeight} instead.
- * 
- * @deprecated will be removed in 3.0
- */
-public class QueryWeightWrapper extends QueryWeight {
-
-  private Weight weight;
-  
-  public QueryWeightWrapper(Weight weight) {
-    this.weight = weight;
-  }
-  
-  public Explanation explain(IndexReader reader, int doc) throws IOException {
-    return weight.explain(reader, doc);
-  }
-
-  public Query getQuery() {
-    return weight.getQuery();
-  }
-
-  public float getValue() {
-    return weight.getValue();
-  }
-
-  public void normalize(float norm) {
-    weight.normalize(norm);
-  }
-
-  public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer)
-      throws IOException {
-    return weight.scorer(reader);
-  }
-
-  public float sumOfSquaredWeights() throws IOException {
-    return weight.sumOfSquaredWeights();
-  }
-
-  public Scorer scorer(IndexReader reader) throws IOException {
-    return weight.scorer(reader);
-  }
-
-}
Index: src/java/org/apache/lucene/search/MatchAllDocsQuery.java
===================================================================
--- src/java/org/apache/lucene/search/MatchAllDocsQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/MatchAllDocsQuery.java	(working copy)
@@ -49,7 +49,7 @@
     final byte[] norms;
     private int doc = -1;
     
-    MatchAllScorer(IndexReader reader, Similarity similarity, QueryWeight w,
+    MatchAllScorer(IndexReader reader, Similarity similarity, Weight w,
         byte[] norms) throws IOException {
       super(similarity);
       this.termDocs = reader.termDocs(null);
@@ -93,7 +93,7 @@
     }
   }
 
-  private class MatchAllDocsWeight extends QueryWeight {
+  private class MatchAllDocsWeight extends Weight {
     private Similarity similarity;
     private float queryWeight;
     private float queryNorm;
@@ -129,7 +129,7 @@
           normsField != null ? reader.norms(normsField) : null);
     }
 
-    public Explanation explain(IndexReader reader, int doc) {
+    public Explanation explain(Searcher searcher, IndexReader reader, int doc) {
       // explain query weight
       Explanation queryExpl = new ComplexExplanation
         (true, getValue(), "MatchAllDocsQuery, product of:");
@@ -142,7 +142,7 @@
     }
   }
 
-  public QueryWeight createQueryWeight(Searcher searcher) {
+  public Weight createWeight(Searcher searcher) {
     return new MatchAllDocsWeight(searcher);
   }
 
Index: src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
===================================================================
--- src/java/org/apache/lucene/search/DisjunctionMaxQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/DisjunctionMaxQuery.java	(working copy)
@@ -86,7 +86,7 @@
   }
 
   /* The Weight for DisjunctionMaxQuery's, used to normalize, score and explain these queries */
-  private class DisjunctionMaxWeight extends QueryWeight {
+  private class DisjunctionMaxWeight extends Weight {
 
     private Similarity similarity;   // The similarity which we are associated.
     private ArrayList weights = new ArrayList();  // The Weight's for our subqueries, in 1-1 correspondence with disjuncts
@@ -95,7 +95,7 @@
     public DisjunctionMaxWeight(Searcher searcher) throws IOException {
       this.similarity = searcher.getSimilarity();
       for (Iterator iter = disjuncts.iterator(); iter.hasNext();) {
-        weights.add(((Query) iter.next()).createQueryWeight(searcher));
+        weights.add(((Query) iter.next()).createWeight(searcher));
       }
     }
 
@@ -109,7 +109,7 @@
     public float sumOfSquaredWeights() throws IOException {
       float max = 0.0f, sum = 0.0f;
       for (Iterator iter = weights.iterator(); iter.hasNext();) {
-        float sub = ((QueryWeight) iter.next()).sumOfSquaredWeights();
+        float sub = ((Weight) iter.next()).sumOfSquaredWeights();
         sum += sub;
         max = Math.max(max, sub);
         
@@ -122,7 +122,7 @@
     public void normalize(float norm) {
       norm *= getBoost();  // Incorporate our boost
       for (Iterator iter = weights.iterator(); iter.hasNext();) {
-        ((QueryWeight) iter.next()).normalize(norm);
+        ((Weight) iter.next()).normalize(norm);
       }
     }
 
@@ -132,7 +132,7 @@
       Scorer[] scorers = new Scorer[weights.size()];
       int idx = 0;
       for (Iterator iter = weights.iterator(); iter.hasNext();) {
-        QueryWeight w = (QueryWeight) iter.next();
+        Weight w = (Weight) iter.next();
         Scorer subScorer = w.scorer(reader, true, false);
         if (subScorer != null && subScorer.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
           scorers[idx++] = subScorer;
@@ -144,13 +144,13 @@
     }
 
     /* Explain the score we computed for doc */
-    public Explanation explain(IndexReader reader, int doc) throws IOException {
-      if (disjuncts.size() == 1) return ((QueryWeight) weights.get(0)).explain(reader,doc);
+    public Explanation explain(Searcher searcher, IndexReader reader, int doc) throws IOException {
+      if (disjuncts.size() == 1) return ((Weight) weights.get(0)).explain(searcher, reader,doc);
       ComplexExplanation result = new ComplexExplanation();
       float max = 0.0f, sum = 0.0f;
       result.setDescription(tieBreakerMultiplier == 0.0f ? "max of:" : "max plus " + tieBreakerMultiplier + " times others of:");
       for (Iterator iter = weights.iterator(); iter.hasNext();) {
-        Explanation e = ((QueryWeight) iter.next()).explain(reader, doc);
+        Explanation e = ((Weight) iter.next()).explain(searcher, reader, doc);
         if (e.isMatch()) {
           result.setMatch(Boolean.TRUE);
           result.addDetail(e);
@@ -165,7 +165,7 @@
   }  // end of DisjunctionMaxWeight inner class
 
   /* Create the QueryWeight used to score us */
-  public QueryWeight createQueryWeight(Searcher searcher) throws IOException {
+  public Weight createWeight(Searcher searcher) throws IOException {
     return new DisjunctionMaxWeight(searcher);
   }
 
Index: src/java/org/apache/lucene/search/Searcher.java
===================================================================
--- src/java/org/apache/lucene/search/Searcher.java	(revision 801851)
+++ src/java/org/apache/lucene/search/Searcher.java	(working copy)
@@ -89,7 +89,7 @@
    */
   public TopFieldDocs search(Query query, Filter filter, int n,
                              Sort sort) throws IOException {
-    return search(createQueryWeight(query), filter, n, sort);
+    return search(createWeight(query), filter, n, sort);
   }
 
   /** Lower-level search API.
@@ -109,7 +109,7 @@
    */
   public void search(Query query, HitCollector results)
     throws IOException {
-    search(createQueryWeight(query), null, new HitCollectorWrapper(results));
+    search(createWeight(query), null, new HitCollectorWrapper(results));
   }
 
   /** Lower-level search API.
@@ -127,7 +127,7 @@
   */
  public void search(Query query, Collector results)
    throws IOException {
-   search(createQueryWeight(query), null, results);
+   search(createWeight(query), null, results);
  }
 
   /** Lower-level search API.
@@ -149,7 +149,7 @@
    */
   public void search(Query query, Filter filter, HitCollector results)
     throws IOException {
-    search(createQueryWeight(query), filter, new HitCollectorWrapper(results));
+    search(createWeight(query), filter, new HitCollectorWrapper(results));
   }
   
   /** Lower-level search API.
@@ -170,7 +170,7 @@
    */
   public void search(Query query, Filter filter, Collector results)
   throws IOException {
-    search(createQueryWeight(query), filter, results);
+    search(createWeight(query), filter, results);
   }
 
   /** Finds the top <code>n</code>
@@ -180,7 +180,7 @@
    */
   public TopDocs search(Query query, Filter filter, int n)
     throws IOException {
-    return search(createQueryWeight(query), filter, n);
+    return search(createWeight(query), filter, n);
   }
 
   /** Finds the top <code>n</code>
@@ -202,7 +202,7 @@
    * entire index.
    */
   public Explanation explain(Query query, int doc) throws IOException {
-    return explain(createQueryWeight(query), doc);
+    return explain(createWeight(query), doc);
   }
 
   /** The Similarity implementation used by this searcher. */
@@ -215,7 +215,7 @@
   public void setSimilarity(Similarity similarity) {
     this.similarity = similarity;
   }
-  
+
   /** Expert: Return the Similarity implementation used by this Searcher.
    *
    * <p>This defaults to the current value of {@link Similarity#getDefault()}.
@@ -226,16 +226,11 @@
 
   /**
    * creates a weight for <code>query</code>
-   * 
-   * @deprecated use {@link #createQueryWeight(Query)} instead.
+   * @return new weight
    */
   protected Weight createWeight(Query query) throws IOException {
-      return createQueryWeight(query);
+    return query.weight(this);
   }
-  
-  protected QueryWeight createQueryWeight(Query query) throws IOException {
-    return query.queryWeight(this);
-  }
 
   // inherit javadoc
   public int[] docFreqs(Term[] terms) throws IOException {
@@ -252,34 +247,23 @@
   /**
    * @deprecated use {@link #search(Weight, Filter, Collector)} instead.
    */
+  /**
+   * @deprecated use {@link #search(Weight, Filter, Collector)} instead.
+   */
   public void search(Weight weight, Filter filter, HitCollector results) throws IOException {
-    search(new QueryWeightWrapper(weight), filter, new HitCollectorWrapper(results));
+    search(weight, filter, new HitCollectorWrapper(results));
   }
-  /** @deprecated delete in 3.0. */
-  public void search(Weight weight, Filter filter, Collector collector)
-      throws IOException {
-    search(new QueryWeightWrapper(weight), filter, collector);
-  }
-  abstract public void search(QueryWeight weight, Filter filter, Collector results) throws IOException;
+  abstract public void search(Weight weight, Filter filter, Collector results) throws IOException;
   abstract public void close() throws IOException;
   abstract public int docFreq(Term term) throws IOException;
   abstract public int maxDoc() throws IOException;
-  /** @deprecated use {@link #search(QueryWeight, Filter, int)} instead. */
-  public TopDocs search(Weight weight, Filter filter, int n) throws IOException {
-    return search(new QueryWeightWrapper(weight), filter, n);
-  }
-  abstract public TopDocs search(QueryWeight weight, Filter filter, int n) throws IOException;
+
+  abstract public TopDocs search(Weight weight, Filter filter, int n) throws IOException;
   abstract public Document doc(int i) throws CorruptIndexException, IOException;
   abstract public Query rewrite(Query query) throws IOException;
-  /** @deprecated use {@link #explain(QueryWeight, int)} instead. */
-  public Explanation explain(Weight weight, int doc) throws IOException {
-    return explain(new QueryWeightWrapper(weight), doc);
-  }
-  abstract public Explanation explain(QueryWeight weight, int doc) throws IOException;
-  /** @deprecated use {@link #search(QueryWeight, Filter, int, Sort)} instead. */
-  public TopFieldDocs search(Weight weight, Filter filter, int n, Sort sort) throws IOException {
-    return search(new QueryWeightWrapper(weight), filter, n, sort);
-  }
-  abstract public TopFieldDocs search(QueryWeight weight, Filter filter, int n, Sort sort) throws IOException;
+
+  abstract public Explanation explain(Weight weight, int doc) throws IOException;
+
+  abstract public TopFieldDocs search(Weight weight, Filter filter, int n, Sort sort) throws IOException;
   /* End patch for GCJ bug #15411. */
 }
Index: src/java/org/apache/lucene/search/payloads/BoostingNearQuery.java
===================================================================
--- src/java/org/apache/lucene/search/payloads/BoostingNearQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/payloads/BoostingNearQuery.java	(working copy)
@@ -18,7 +18,7 @@
 
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.Explanation;
-import org.apache.lucene.search.QueryWeight;
+import org.apache.lucene.search.Weight;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Searcher;
 import org.apache.lucene.search.Similarity;
@@ -56,7 +56,7 @@
     fieldName = clauses[0].getField(); // all clauses must have same field 
   }
 
-  public QueryWeight createQueryWeight(Searcher searcher) throws IOException {
+  public Weight createWeight(Searcher searcher) throws IOException {
     return new BoostingSpanWeight(this, searcher);
   }
 
Index: src/java/org/apache/lucene/search/payloads/BoostingTermQuery.java
===================================================================
--- src/java/org/apache/lucene/search/payloads/BoostingTermQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/payloads/BoostingTermQuery.java	(working copy)
@@ -45,7 +45,7 @@
     super(term);
   }
 
-  public QueryWeight createQueryWeight(Searcher searcher) throws IOException {
+  public Weight createWeight(Searcher searcher) throws IOException {
     return new BoostingTermWeight(this, searcher);
   }
 
@@ -68,7 +68,7 @@
       protected float payloadScore;
       private int payloadsSeen;
 
-      public BoostingSpanScorer(TermSpans spans, QueryWeight weight,
+      public BoostingSpanScorer(TermSpans spans, Weight weight,
                                 Similarity similarity, byte[] norms) throws IOException {
         super(spans, weight, similarity, norms);
         positions = spans.getPositions();
Index: src/java/org/apache/lucene/search/spans/SpanScorer.java
===================================================================
--- src/java/org/apache/lucene/search/spans/SpanScorer.java	(revision 801851)
+++ src/java/org/apache/lucene/search/spans/SpanScorer.java	(working copy)
@@ -20,18 +20,16 @@
 import java.io.IOException;
 
 import org.apache.lucene.search.Explanation;
-import org.apache.lucene.search.QueryWeight;
-import org.apache.lucene.search.QueryWeightWrapper;
+import org.apache.lucene.search.Weight;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Similarity;
-import org.apache.lucene.search.Weight;
 
 /**
  * Public for extension only.
  */
 public class SpanScorer extends Scorer {
   protected Spans spans;
-  protected QueryWeight weight;
+  protected Weight weight;
   protected byte[] norms;
   protected float value;
 
@@ -41,14 +39,8 @@
 
   protected int doc;
   protected float freq;
-
-  /** @deprecated use {@link #SpanScorer(Spans, QueryWeight, Similarity, byte[])} instead.*/
-  protected SpanScorer(Spans spans, Weight weight, Similarity similarity, byte[] norms)
-    throws IOException {
-    this(spans, new QueryWeightWrapper(weight), similarity, norms);
-  }
   
-  protected SpanScorer(Spans spans, QueryWeight weight, Similarity similarity, byte[] norms)
+  protected SpanScorer(Spans spans, Weight weight, Similarity similarity, byte[] norms)
   throws IOException {
     super(similarity);
     this.spans = spans;
Index: src/java/org/apache/lucene/search/spans/FieldMaskingSpanQuery.java
===================================================================
--- src/java/org/apache/lucene/search/spans/FieldMaskingSpanQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/spans/FieldMaskingSpanQuery.java	(working copy)
@@ -23,7 +23,7 @@
 
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.QueryWeight;
+import org.apache.lucene.search.Weight;
 import org.apache.lucene.search.Searcher;
 import org.apache.lucene.search.Similarity;
 import org.apache.lucene.util.ToStringUtils;
@@ -103,8 +103,8 @@
     maskedQuery.extractTerms(terms);
   }  
 
-  public QueryWeight createQueryWeight(Searcher searcher) throws IOException {
-    return maskedQuery.createQueryWeight(searcher);
+  public Weight createWeight(Searcher searcher) throws IOException {
+    return maskedQuery.createWeight(searcher);
   }
 
   public Similarity getSimilarity(Searcher searcher) {
Index: src/java/org/apache/lucene/search/spans/SpanQuery.java
===================================================================
--- src/java/org/apache/lucene/search/spans/SpanQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/spans/SpanQuery.java	(working copy)
@@ -22,7 +22,6 @@
 
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.QueryWeight;
 import org.apache.lucene.search.Searcher;
 import org.apache.lucene.search.Weight;
 
@@ -40,13 +39,8 @@
    * @see Query#extractTerms(Set)
    */
   public abstract Collection getTerms();
-
-  /** @deprecated delete in 3.0. */
-  protected Weight createWeight(Searcher searcher) throws IOException {
-    return createQueryWeight(searcher);
-  }
   
-  public QueryWeight createQueryWeight(Searcher searcher) throws IOException {
+  public Weight createWeight(Searcher searcher) throws IOException {
     return new SpanWeight(this, searcher);
   }
 
Index: src/java/org/apache/lucene/search/spans/SpanWeight.java
===================================================================
--- src/java/org/apache/lucene/search/spans/SpanWeight.java	(revision 801851)
+++ src/java/org/apache/lucene/search/spans/SpanWeight.java	(working copy)
@@ -29,7 +29,7 @@
 /**
  * Expert-only.  Public for use by other weight implementations
  */
-public class SpanWeight extends QueryWeight {
+public class SpanWeight extends Weight {
   protected Similarity similarity;
   protected float value;
   protected float idf;
@@ -68,7 +68,7 @@
         .norms(query.getField()));
   }
 
-  public Explanation explain(IndexReader reader, int doc)
+  public Explanation explain(Searcher searcher, IndexReader reader, int doc)
     throws IOException {
 
     ComplexExplanation result = new ComplexExplanation();
Index: src/java/org/apache/lucene/search/SloppyPhraseScorer.java
===================================================================
--- src/java/org/apache/lucene/search/SloppyPhraseScorer.java	(revision 801851)
+++ src/java/org/apache/lucene/search/SloppyPhraseScorer.java	(working copy)
@@ -28,7 +28,7 @@
     private PhrasePositions tmpPos[]; // for flipping repeating pps.
     private boolean checkedRepeats;
 
-    SloppyPhraseScorer(QueryWeight weight, TermPositions[] tps, int[] offsets, Similarity similarity,
+    SloppyPhraseScorer(Weight weight, TermPositions[] tps, int[] offsets, Similarity similarity,
                        int slop, byte[] norms) {
         super(weight, tps, offsets, similarity, norms);
         this.slop = slop;
Index: src/java/org/apache/lucene/search/MultiPhraseQuery.java
===================================================================
--- src/java/org/apache/lucene/search/MultiPhraseQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/MultiPhraseQuery.java	(working copy)
@@ -123,7 +123,7 @@
   }
 
 
-  private class MultiPhraseWeight extends QueryWeight {
+  private class MultiPhraseWeight extends Weight {
     private Similarity similarity;
     private float value;
     private float idf;
@@ -186,7 +186,7 @@
                                       slop, reader.norms(field));
     }
 
-    public Explanation explain(IndexReader reader, int doc)
+    public Explanation explain(Searcher searcher, IndexReader reader, int doc)
       throws IOException {
       ComplexExplanation result = new ComplexExplanation();
       result.setDescription("weight("+getQuery()+" in "+doc+"), product of:");
@@ -265,7 +265,7 @@
     }
   }
 
-  public QueryWeight createQueryWeight(Searcher searcher) throws IOException {
+  public Weight createWeight(Searcher searcher) throws IOException {
     return new MultiPhraseWeight(searcher);
   }
 
Index: src/java/org/apache/lucene/search/FilteredQuery.java
===================================================================
--- src/java/org/apache/lucene/search/FilteredQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/FilteredQuery.java	(working copy)
@@ -58,10 +58,10 @@
    * Returns a Weight that applies the filter to the enclosed query's Weight.
    * This is accomplished by overriding the Scorer returned by the Weight.
    */
-  public QueryWeight createQueryWeight(final Searcher searcher) throws IOException {
-    final QueryWeight weight = query.createQueryWeight (searcher);
+  public Weight createWeight(final Searcher searcher) throws IOException {
+    final Weight weight = query.createWeight (searcher);
     final Similarity similarity = query.getSimilarity(searcher);
-    return new QueryWeight() {
+    return new Weight() {
       private float value;
         
       // pass these methods through to enclosed query's weight
@@ -73,8 +73,8 @@
         weight.normalize(v);
         value = weight.getValue() * getBoost();
       }
-      public Explanation explain (IndexReader ir, int i) throws IOException {
-        Explanation inner = weight.explain (ir, i);
+      public Explanation explain (Searcher searcher, IndexReader ir, int i) throws IOException {
+        Explanation inner = weight.explain (searcher, ir, i);
         if (getBoost()!=1) {
           Explanation preBoost = inner;
           inner = new Explanation(inner.getValue()*getBoost(),"product of:");
Index: src/java/org/apache/lucene/search/Searchable.java
===================================================================
--- src/java/org/apache/lucene/search/Searchable.java	(revision 801851)
+++ src/java/org/apache/lucene/search/Searchable.java	(working copy)
@@ -82,33 +82,9 @@
    * @param collector
    *          to receive hits
    * @throws BooleanQuery.TooManyClauses
-   * 
-   * @deprecated use {@link #search(QueryWeight, Filter, Collector)} instead.
    */
   void search(Weight weight, Filter filter, Collector collector) throws IOException;
 
-  /**
-   * Lower-level search API.
-   * 
-   * <p>
-   * {@link Collector#collect(int)} is called for every document. <br>
-   * Collector-based access to remote indexes is discouraged.
-   * 
-   * <p>
-   * Applications should only use this if they need <i>all</i> of the matching
-   * documents. The high-level search API ({@link Searcher#search(Query)}) is
-   * usually more efficient, as it skips non-high-scoring hits.
-   * 
-   * @param weight
-   *          to match documents
-   * @param filter
-   *          if non-null, used to permit documents to be collected.
-   * @param collector
-   *          to receive hits
-   * @throws BooleanQuery.TooManyClauses
-   */
-  void search(QueryWeight weight, Filter filter, Collector collector) throws IOException;
-
   /** Frees resources associated with this Searcher.
    * Be careful not to call this method while you are still using objects
    * like {@link Hits}.
@@ -144,17 +120,6 @@
    * @deprecated use {@link #search(QueryWeight, Filter, int)} instead.
    */
   TopDocs search(Weight weight, Filter filter, int n) throws IOException;
-  
-  /** Expert: Low-level search implementation.  Finds the top <code>n</code>
-   * hits for <code>query</code>, applying <code>filter</code> if non-null.
-   *
-   * <p>Called by {@link Hits}.
-   *
-   * <p>Applications should usually call {@link Searcher#search(Query)} or
-   * {@link Searcher#search(Query,Filter)} instead.
-   * @throws BooleanQuery.TooManyClauses
-   */
-  TopDocs search(QueryWeight weight, Filter filter, int n) throws IOException;
 
   /** Expert: Returns the stored fields of document <code>i</code>.
    * Called by {@link HitCollector} implementations.
@@ -205,19 +170,6 @@
    * @deprecated use {@link #explain(QueryWeight, int)} instead.
    */
   Explanation explain(Weight weight, int doc) throws IOException;
-  
-  /** Expert: low-level implementation method
-   * Returns an Explanation that describes how <code>doc</code> scored against
-   * <code>weight</code>.
-   *
-   * <p>This is intended to be used in developing Similarity implementations,
-   * and, for good performance, should not be displayed with every hit.
-   * Computing an explanation is as expensive as executing the query over the
-   * entire index.
-   * <p>Applications should call {@link Searcher#explain(Query, int)}.
-   * @throws BooleanQuery.TooManyClauses
-   */
-  Explanation explain(QueryWeight weight, int doc) throws IOException;
 
   /** Expert: Low-level search implementation with arbitrary sorting.  Finds
    * the top <code>n</code> hits for <code>query</code>, applying
@@ -228,22 +180,8 @@
    * Searcher#search(Query,Filter,Sort)} instead.
    * 
    * @throws BooleanQuery.TooManyClauses
-   * @deprecated use {@link #search(QueryWeight, Filter, int, Sort)} instead.
    */
   TopFieldDocs search(Weight weight, Filter filter, int n, Sort sort)
   throws IOException;
-  
-  /** Expert: Low-level search implementation with arbitrary sorting.  Finds
-   * the top <code>n</code> hits for <code>query</code>, applying
-   * <code>filter</code> if non-null, and sorting the hits by the criteria in
-   * <code>sort</code>.
-   *
-   * <p>Applications should usually call {@link
-   * Searcher#search(Query,Filter,Sort)} instead.
-   * 
-   * @throws BooleanQuery.TooManyClauses
-   */
-  TopFieldDocs search(QueryWeight weight, Filter filter, int n, Sort sort)
-  throws IOException;
 
 }
Index: src/java/org/apache/lucene/search/PhraseScorer.java
===================================================================
--- src/java/org/apache/lucene/search/PhraseScorer.java	(revision 801851)
+++ src/java/org/apache/lucene/search/PhraseScorer.java	(working copy)
@@ -32,7 +32,7 @@
  * means a match. 
  */
 abstract class PhraseScorer extends Scorer {
-  private QueryWeight weight;
+  private Weight weight;
   protected byte[] norms;
   protected float value;
 
@@ -43,7 +43,7 @@
 
   private float freq; //prhase frequency in current doc as computed by phraseFreq().
 
-  PhraseScorer(QueryWeight weight, TermPositions[] tps, int[] offsets,
+  PhraseScorer(Weight weight, TermPositions[] tps, int[] offsets,
       Similarity similarity, byte[] norms) {
     super(similarity);
     this.norms = norms;
Index: src/java/org/apache/lucene/search/function/ValueSourceQuery.java
===================================================================
--- src/java/org/apache/lucene/search/function/ValueSourceQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/function/ValueSourceQuery.java	(working copy)
@@ -20,6 +20,7 @@
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.TermDocs;
 import org.apache.lucene.search.*;
+import org.apache.lucene.util.ReaderUtil;
 import org.apache.lucene.util.ToStringUtils;
 
 import java.io.IOException;
@@ -62,7 +63,7 @@
     // no terms involved here
   }
 
-  private class ValueSourceWeight extends QueryWeight {
+  class ValueSourceWeight extends Weight {
     Similarity similarity;
     float queryNorm;
     float queryWeight;
@@ -92,14 +93,14 @@
       this.queryNorm = norm;
       queryWeight *= this.queryNorm;
     }
-
+    
     public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer) throws IOException {
       return new ValueSourceScorer(similarity, reader, this);
     }
 
     /*(non-Javadoc) @see org.apache.lucene.search.Weight#explain(org.apache.lucene.index.IndexReader, int) */
-    public Explanation explain(IndexReader reader, int doc) throws IOException {
-      return scorer(reader, true, false).explain(doc);
+    public Explanation explain(Searcher searcher, IndexReader reader, int doc) throws IOException {
+      return new ValueSourceScorer(similarity, reader, this).explain(doc);
     }
   }
 
@@ -172,7 +173,7 @@
     }
   }
 
-  public QueryWeight createQueryWeight(Searcher searcher) {
+  public Weight createWeight(Searcher searcher) {
     return new ValueSourceQuery.ValueSourceWeight(searcher);
   }
 
Index: src/java/org/apache/lucene/search/function/CustomScoreQuery.java
===================================================================
--- src/java/org/apache/lucene/search/function/CustomScoreQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/function/CustomScoreQuery.java	(working copy)
@@ -23,11 +23,13 @@
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.ComplexExplanation;
 import org.apache.lucene.search.Explanation;
+import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.QueryWeight;
+import org.apache.lucene.search.Weight;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Searcher;
 import org.apache.lucene.search.Similarity;
+import org.apache.lucene.util.ReaderUtil;
 import org.apache.lucene.util.ToStringUtils;
 
 /**
@@ -271,18 +273,18 @@
 
   //=========================== W E I G H T ============================
   
-  private class CustomWeight extends QueryWeight {
+  private class CustomWeight extends Weight {
     Similarity similarity;
-    QueryWeight subQueryWeight;
-    QueryWeight[] valSrcWeights;
+    Weight subQueryWeight;
+    Weight[] valSrcWeights;
     boolean qStrict;
 
     public CustomWeight(Searcher searcher) throws IOException {
       this.similarity = getSimilarity(searcher);
-      this.subQueryWeight = subQuery.queryWeight(searcher);
-      this.valSrcWeights = new QueryWeight[valSrcQueries.length];
+      this.subQueryWeight = subQuery.weight(searcher);
+      this.valSrcWeights = new Weight[valSrcQueries.length];
       for(int i = 0; i < valSrcQueries.length; i++) {
-        this.valSrcWeights[i] = valSrcQueries[i].createQueryWeight(searcher);
+        this.valSrcWeights[i] = valSrcQueries[i].createWeight(searcher);
       }
       this.qStrict = strict;
     }
@@ -336,16 +338,39 @@
       }
       Scorer[] valSrcScorers = new Scorer[valSrcWeights.length];
       for(int i = 0; i < valSrcScorers.length; i++) {
-         valSrcScorers[i] = valSrcWeights[i].scorer(reader, true, false);
+         valSrcScorers[i] = valSrcWeights[i].scorer(reader, true, topScorer);
       }
       return new CustomScorer(similarity, reader, this, subQueryScorer, valSrcScorers);
     }
 
-    public Explanation explain(IndexReader reader, int doc) throws IOException {
+    public Explanation explain(Searcher searcher, IndexReader reader, int doc) throws IOException {
       Scorer scorer = scorer(reader, true, false);
-      return scorer == null ? new Explanation(0.0f, "no matching docs") : scorer.explain(doc);
+      return scorer == null ? new Explanation(0.0f, "no matching docs") : doExplain(searcher, reader, doc);
     }
     
+    private Explanation doExplain(Searcher searcher, IndexReader reader, int doc) throws IOException {
+      Scorer[] valSrcScorers = new Scorer[valSrcWeights.length];
+      for(int i = 0; i < valSrcScorers.length; i++) {
+         valSrcScorers[i] = valSrcWeights[i].scorer(reader, true, false);
+      }
+      Explanation subQueryExpl = subQueryWeight.explain(searcher, reader, doc);
+      if (!subQueryExpl.isMatch()) {
+        return subQueryExpl;
+      }
+      // match
+      Explanation[] valSrcExpls = new Explanation[valSrcScorers.length];
+      for(int i = 0; i < valSrcScorers.length; i++) {
+        valSrcExpls[i] = valSrcScorers[i].explain(doc);
+      }
+      Explanation customExp = customExplain(doc,subQueryExpl,valSrcExpls);
+      float sc = getValue() * customExp.getValue();
+      Explanation res = new ComplexExplanation(
+        true, sc, CustomScoreQuery.this.toString() + ", product of:");
+      res.addDetail(customExp);
+      res.addDetail(new Explanation(getValue(), "queryBoost")); // actually using the q boost as q weight (== weight value)
+      return res;
+    }
+
     public boolean scoresDocsOutOfOrder() {
       return false;
     }
@@ -427,7 +452,7 @@
     
     /*(non-Javadoc) @see org.apache.lucene.search.Scorer#explain(int) */
     public Explanation explain(int doc) throws IOException {
-      Explanation subQueryExpl = weight.subQueryWeight.explain(reader,doc);
+      Explanation subQueryExpl = weight.subQueryWeight.explain(null, reader,doc); // nocommit: needs resolution
       if (!subQueryExpl.isMatch()) {
         return subQueryExpl;
       }
@@ -446,7 +471,7 @@
     }
   }
 
-  public QueryWeight createQueryWeight(Searcher searcher) throws IOException {
+  public Weight createWeight(Searcher searcher) throws IOException {
     return new CustomWeight(searcher);
   }
 
Index: src/java/org/apache/lucene/search/BooleanQuery.java
===================================================================
--- src/java/org/apache/lucene/search/BooleanQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/BooleanQuery.java	(working copy)
@@ -172,7 +172,7 @@
   /** Returns the list of clauses in this query. */
   public List clauses() { return clauses; }
 
-  private class BooleanWeight extends QueryWeight {
+  private class BooleanWeight extends Weight {
     protected Similarity similarity;
     protected ArrayList weights;
 
@@ -182,7 +182,7 @@
       weights = new ArrayList(clauses.size());
       for (int i = 0 ; i < clauses.size(); i++) {
         BooleanClause c = (BooleanClause)clauses.get(i);
-        weights.add(c.getQuery().createQueryWeight(searcher));
+        weights.add(c.getQuery().createWeight(searcher));
       }
     }
 
@@ -193,7 +193,7 @@
       float sum = 0.0f;
       for (int i = 0 ; i < weights.size(); i++) {
         BooleanClause c = (BooleanClause)clauses.get(i);
-        QueryWeight w = (QueryWeight)weights.get(i);
+        Weight w = (Weight)weights.get(i);
         // call sumOfSquaredWeights for all clauses in case of side effects
         float s = w.sumOfSquaredWeights();         // sum sub weights
         if (!c.isProhibited())
@@ -210,13 +210,13 @@
     public void normalize(float norm) {
       norm *= getBoost();                         // incorporate boost
       for (Iterator iter = weights.iterator(); iter.hasNext();) {
-        QueryWeight w = (QueryWeight) iter.next();
+        Weight w = (Weight) iter.next();
         // normalize all clauses, (even if prohibited in case of side affects)
         w.normalize(norm);
       }
     }
 
-    public Explanation explain(IndexReader reader, int doc)
+    public Explanation explain(Searcher searcher, IndexReader reader, int doc)
       throws IOException {
       final int minShouldMatch =
         BooleanQuery.this.getMinimumNumberShouldMatch();
@@ -228,12 +228,12 @@
       boolean fail = false;
       int shouldMatchCount = 0;
       for (Iterator wIter = weights.iterator(), cIter = clauses.iterator(); wIter.hasNext();) {
-        QueryWeight w = (QueryWeight) wIter.next();
+        Weight w = (Weight) wIter.next();
         BooleanClause c = (BooleanClause) cIter.next();
         if (w.scorer(reader, true, true) == null) {
           continue;
         }
-        Explanation e = w.explain(reader, doc);
+        Explanation e = w.explain(searcher, reader, doc);
         if (!c.isProhibited()) maxCoord++;
         if (e.isMatch()) {
           if (!c.isProhibited()) {
@@ -293,7 +293,7 @@
       List prohibited = new ArrayList();
       List optional = new ArrayList();
       for (Iterator wIter = weights.iterator(), cIter = clauses.iterator(); wIter.hasNext();) {
-        QueryWeight w = (QueryWeight) wIter.next();
+        Weight w = (Weight) wIter.next();
         BooleanClause c = (BooleanClause) cIter.next();
         Scorer subScorer = w.scorer(reader, true, false);
         if (subScorer == null) {
@@ -354,7 +354,7 @@
    * Whether hit docs may be collected out of docid order.
    * 
    * @deprecated this will not be needed anymore, as
-   *             {@link QueryWeight#scoresDocsOutOfOrder()} is used.
+   *             {@link Weight#scoresDocsOutOfOrder()} is used.
    */
   private static boolean allowDocsOutOfOrder = true;
 
@@ -381,7 +381,7 @@
    * </p>
    * 
    * @deprecated this is not needed anymore, as
-   *             {@link QueryWeight#scoresDocsOutOfOrder()} is used.
+   *             {@link Weight#scoresDocsOutOfOrder()} is used.
    */
   public static void setAllowDocsOutOfOrder(boolean allow) {
     allowDocsOutOfOrder = allow;
@@ -392,7 +392,7 @@
    * 
    * @see #setAllowDocsOutOfOrder(boolean)
    * @deprecated this is not needed anymore, as
-   *             {@link QueryWeight#scoresDocsOutOfOrder()} is used.
+   *             {@link Weight#scoresDocsOutOfOrder()} is used.
    */
   public static boolean getAllowDocsOutOfOrder() {
     return allowDocsOutOfOrder;
@@ -412,7 +412,7 @@
 	return getAllowDocsOutOfOrder();
   }
 
-  public QueryWeight createQueryWeight(Searcher searcher) throws IOException {
+  public Weight createWeight(Searcher searcher) throws IOException {
     return new BooleanWeight(searcher);
   }
 
Index: src/java/org/apache/lucene/search/Query.java
===================================================================
--- src/java/org/apache/lucene/search/Query.java	(revision 801851)
+++ src/java/org/apache/lucene/search/Query.java	(working copy)
@@ -86,45 +86,17 @@
    * 
    * <p>
    * Only implemented by primitive queries, which re-write to themselves.
-   * @deprecated use {@link #createQueryWeight(Searcher)} instead.
    */
   protected Weight createWeight(Searcher searcher) throws IOException {
     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 {
-    return new QueryWeightWrapper(createWeight(searcher));
-  }
-
-  /**
    * Expert: Constructs and initializes a Weight for a top-level query.
-   * 
-   * @deprecated use {@link #queryWeight(Searcher)} instead.
    */
   public Weight weight(Searcher searcher) throws IOException {
-    return queryWeight(searcher);
-  }
-
-  /**
-   * Expert: Constructs and initializes a {@link QueryWeight} for a top-level
-   * query.
-   */
-  public QueryWeight queryWeight(Searcher searcher) throws IOException {
     Query query = searcher.rewrite(this);
-    QueryWeight weight = query.createQueryWeight(searcher);
+    Weight weight = query.createWeight(searcher);
     float sum = weight.sumOfSquaredWeights();
     float norm = getSimilarity(searcher).queryNorm(sum);
     weight.normalize(norm);
Index: src/java/org/apache/lucene/search/PhraseQuery.java
===================================================================
--- src/java/org/apache/lucene/search/PhraseQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/PhraseQuery.java	(working copy)
@@ -106,7 +106,7 @@
       return result;
   }
 
-  private class PhraseWeight extends QueryWeight {
+  private class PhraseWeight extends Weight {
     private Similarity similarity;
     private float value;
     private float idf;
@@ -158,7 +158,7 @@
 
     }
 
-    public Explanation explain(IndexReader reader, int doc)
+    public Explanation explain(Searcher searcher, IndexReader reader, int doc)
       throws IOException {
 
       Explanation result = new Explanation();
@@ -241,12 +241,12 @@
     }
   }
 
-  public QueryWeight createQueryWeight(Searcher searcher) throws IOException {
+  public Weight createWeight(Searcher searcher) throws IOException {
     if (terms.size() == 1) {			  // optimize one-term case
       Term term = (Term)terms.get(0);
       Query termQuery = new TermQuery(term);
       termQuery.setBoost(getBoost());
-      return termQuery.createQueryWeight(searcher);
+      return termQuery.createWeight(searcher);
     }
     return new PhraseWeight(searcher);
   }
Index: src/java/org/apache/lucene/search/TermQuery.java
===================================================================
--- src/java/org/apache/lucene/search/TermQuery.java	(revision 801851)
+++ src/java/org/apache/lucene/search/TermQuery.java	(working copy)
@@ -31,7 +31,7 @@
 public class TermQuery extends Query {
   private Term term;
 
-  private class TermWeight extends QueryWeight {
+  private class TermWeight extends Weight {
     private Similarity similarity;
     private float value;
     private float idf;
@@ -69,15 +69,19 @@
       return new TermScorer(this, termDocs, similarity, reader.norms(term.field()));
     }
 
-    public Explanation explain(IndexReader reader, int doc)
+    public Explanation explain(Searcher searcher, IndexReader reader, int doc)
       throws IOException {
 
       ComplexExplanation result = new ComplexExplanation();
       result.setDescription("weight("+getQuery()+" in "+doc+"), product of:");
 
-      Explanation idfExpl =
-        new Explanation(idf, "idf(docFreq=" + reader.docFreq(term) +
-            ", numDocs=" + reader.numDocs() + ")");
+      Explanation expl;
+      if(searcher == null) {
+        expl = new Explanation(idf, "idf(" + idf + ")");
+      } else {
+        expl = new Explanation(idf, "idf(docFreq=" + searcher.docFreq(term) +
+            ", maxDocs=" + searcher.maxDoc() + ")");
+      }
 
       // explain query weight
       Explanation queryExpl = new Explanation();
@@ -86,13 +90,13 @@
       Explanation boostExpl = new Explanation(getBoost(), "boost");
       if (getBoost() != 1.0f)
         queryExpl.addDetail(boostExpl);
-      queryExpl.addDetail(idfExpl);
+      queryExpl.addDetail(expl);
 
       Explanation queryNormExpl = new Explanation(queryNorm,"queryNorm");
       queryExpl.addDetail(queryNormExpl);
 
       queryExpl.setValue(boostExpl.getValue() *
-                         idfExpl.getValue() *
+                         expl.getValue() *
                          queryNormExpl.getValue());
 
       result.addDetail(queryExpl);
@@ -105,7 +109,7 @@
 
       Explanation tfExpl = scorer(reader, true, false).explain(doc);
       fieldExpl.addDetail(tfExpl);
-      fieldExpl.addDetail(idfExpl);
+      fieldExpl.addDetail(expl);
 
       Explanation fieldNormExpl = new Explanation();
       byte[] fieldNorms = reader.norms(field);
@@ -117,7 +121,7 @@
       
       fieldExpl.setMatch(Boolean.valueOf(tfExpl.isMatch()));
       fieldExpl.setValue(tfExpl.getValue() *
-                         idfExpl.getValue() *
+                         expl.getValue() *
                          fieldNormExpl.getValue());
 
       result.addDetail(fieldExpl);
@@ -141,7 +145,7 @@
   /** Returns the term of this query. */
   public Term getTerm() { return term; }
 
-  public QueryWeight createQueryWeight(Searcher searcher) throws IOException {
+  public Weight createWeight(Searcher searcher) throws IOException {
     return new TermWeight(searcher);
   }
 
Index: src/java/org/apache/lucene/search/Hits.java
===================================================================
--- src/java/org/apache/lucene/search/Hits.java	(revision 801851)
+++ src/java/org/apache/lucene/search/Hits.java	(working copy)
@@ -53,7 +53,7 @@
  * </pre>
  */
 public final class Hits {
-  private QueryWeight weight;
+  private Weight weight;
   private Searcher searcher;
   private Filter filter = null;
   private Sort sort = null;
@@ -73,7 +73,7 @@
   boolean debugCheckedForDeletions = false; // for test purposes.
 
   Hits(Searcher s, Query q, Filter f) throws IOException {
-    weight = q.queryWeight(s);
+    weight = q.weight(s);
     searcher = s;
     filter = f;
     nDeletions = countDeletions(s);
@@ -82,7 +82,7 @@
   }
 
   Hits(Searcher s, Query q, Filter f, Sort o) throws IOException {
-    weight = q.queryWeight(s);
+    weight = q.weight(s);
     searcher = s;
     filter = f;
     sort = o;
Index: src/java/org/apache/lucene/search/MultiSearcher.java
===================================================================
--- src/java/org/apache/lucene/search/MultiSearcher.java	(revision 801851)
+++ src/java/org/apache/lucene/search/MultiSearcher.java	(working copy)
@@ -22,6 +22,7 @@
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.util.ReaderUtil;
 
 import java.io.IOException;
 import java.util.HashMap;
@@ -94,19 +95,19 @@
         throw new UnsupportedOperationException();
     }
 
-    public Explanation explain(QueryWeight weight,int doc) {
+    public Explanation explain(Weight weight,int doc) {
       throw new UnsupportedOperationException();
     }
 
-    public void search(QueryWeight weight, Filter filter, Collector results) {
+    public void search(Weight weight, Filter filter, Collector results) {
       throw new UnsupportedOperationException();
     }
     
-    public TopDocs search(QueryWeight weight,Filter filter,int n) {
+    public TopDocs search(Weight weight,Filter filter,int n) {
       throw new UnsupportedOperationException();
     }
 
-    public TopFieldDocs search(QueryWeight weight,Filter filter,int n,Sort sort) {
+    public TopFieldDocs search(Weight weight,Filter filter,int n,Sort sort) {
       throw new UnsupportedOperationException();
     }
   }
@@ -164,25 +165,7 @@
   /** Returns index of the searcher for document <code>n</code> in the array
    * used to construct this searcher. */
   public int subSearcher(int n) {                 // find searcher for doc n:
-    // replace w/ call to Arrays.binarySearch in Java 1.2
-    int lo = 0;					  // search starts array
-    int hi = searchables.length - 1;		  // for first element less
-						  // than n, return its index
-    while (hi >= lo) {
-      int mid = (lo + hi) >>> 1;
-      int midValue = starts[mid];
-      if (n < midValue)
-	hi = mid - 1;
-      else if (n > midValue)
-	lo = mid + 1;
-      else {                                      // found a match
-        while (mid+1 < searchables.length && starts[mid+1] == midValue) {
-          mid++;                                  // scan to last match
-        }
-	return mid;
-      }
-    }
-    return hi;
+    return ReaderUtil.subIndex(n, starts);
   }
 
   /** Returns the document number of document <code>n</code> within its
@@ -195,7 +178,7 @@
     return maxDoc;
   }
 
-  public TopDocs search(QueryWeight weight, Filter filter, int nDocs)
+  public TopDocs search(Weight weight, Filter filter, int nDocs)
       throws IOException {
 
     HitQueue hq = new HitQueue(nDocs, false);
@@ -222,7 +205,7 @@
     return new TopDocs(totalHits, scoreDocs, maxScore);
   }
 
-  public TopFieldDocs search (QueryWeight weight, Filter filter, int n, Sort sort)
+  public TopFieldDocs search (Weight weight, Filter filter, int n, Sort sort)
   throws IOException {
     FieldDocSortedHitQueue hq = null;
     int totalHits = 0;
@@ -264,7 +247,7 @@
   }
 
   // inherit javadoc
-  public void search(QueryWeight weight, Filter filter, final Collector collector)
+  public void search(Weight weight, Filter filter, final Collector collector)
   throws IOException {
     for (int i = 0; i < searchables.length; i++) {
       
@@ -297,7 +280,7 @@
     return queries[0].combine(queries);
   }
 
-  public Explanation explain(QueryWeight weight, int doc) throws IOException {
+  public Explanation explain(Weight weight, int doc) throws IOException {
     int i = subSearcher(doc);			  // find searcher index
     return searchables[i].explain(weight, doc - starts[i]); // dispatch to searcher
   }
@@ -317,7 +300,7 @@
    *
    * @return rewritten queries
    */
-  protected QueryWeight createQueryWeight(Query original) throws IOException {
+  protected Weight createWeight(Query original) throws IOException {
     // step 1
     Query rewrittenQuery = rewrite(original);
 
@@ -345,7 +328,7 @@
     int numDocs = maxDoc();
     CachedDfSource cacheSim = new CachedDfSource(dfMap, numDocs, getSimilarity());
 
-    return rewrittenQuery.queryWeight(cacheSim);
+    return rewrittenQuery.weight(cacheSim);
   }
 
 }
Index: src/java/org/apache/lucene/search/QueryWrapperFilter.java
===================================================================
--- src/java/org/apache/lucene/search/QueryWrapperFilter.java	(revision 801851)
+++ src/java/org/apache/lucene/search/QueryWrapperFilter.java	(working copy)
@@ -69,7 +69,7 @@
   }
   
   public DocIdSet getDocIdSet(final IndexReader reader) throws IOException {
-    final QueryWeight weight = query.queryWeight(new IndexSearcher(reader));
+    final Weight weight = query.createWeight(new IndexSearcher(reader));
     return new DocIdSet() {
       public DocIdSetIterator iterator() throws IOException {
         return weight.scorer(reader, true, false);
Index: src/java/org/apache/lucene/search/ParallelMultiSearcher.java
===================================================================
--- src/java/org/apache/lucene/search/ParallelMultiSearcher.java	(revision 801851)
+++ src/java/org/apache/lucene/search/ParallelMultiSearcher.java	(working copy)
@@ -52,7 +52,7 @@
    * Searchable, waits for each search to complete and merge
    * the results back together.
    */
-  public TopDocs search(QueryWeight weight, Filter filter, int nDocs)
+  public TopDocs search(Weight weight, Filter filter, int nDocs)
     throws IOException {
     HitQueue hq = new HitQueue(nDocs, false);
     int totalHits = 0;
@@ -97,7 +97,7 @@
    * Searchable, waits for each search to complete and merges
    * the results back together.
    */
-  public TopFieldDocs search(QueryWeight weight, Filter filter, int nDocs, Sort sort)
+  public TopFieldDocs search(Weight weight, Filter filter, int nDocs, Sort sort)
     throws IOException {
     // don't specify the fields - we'll wait to do this until we get results
     FieldDocSortedHitQueue hq = new FieldDocSortedHitQueue (null, nDocs);
@@ -153,7 +153,7 @@
   * 
   * @todo parallelize this one too
   */
-  public void search(QueryWeight weight, Filter filter, final Collector collector)
+  public void search(Weight weight, Filter filter, final Collector collector)
    throws IOException {
    for (int i = 0; i < searchables.length; i++) {
 
@@ -194,7 +194,7 @@
 class MultiSearcherThread extends Thread {
 
   private Searchable searchable;
-  private QueryWeight weight;
+  private Weight weight;
   private Filter filter;
   private int nDocs;
   private TopDocs docs;
@@ -204,7 +204,7 @@
   private IOException ioe;
   private Sort sort;
 
-  public MultiSearcherThread(Searchable searchable, QueryWeight weight, Filter filter,
+  public MultiSearcherThread(Searchable searchable, Weight weight, Filter filter,
       int nDocs, HitQueue hq, int i, int[] starts, String name) {
     super(name);
     this.searchable = searchable;
@@ -216,7 +216,7 @@
     this.starts = starts;
   }
 
-  public MultiSearcherThread(Searchable searchable, QueryWeight weight,
+  public MultiSearcherThread(Searchable searchable, Weight weight,
       Filter filter, int nDocs, FieldDocSortedHitQueue hq, Sort sort, int i,
       int[] starts, String name) {
     super(name);
Index: src/java/org/apache/lucene/search/IndexSearcher.java
===================================================================
--- src/java/org/apache/lucene/search/IndexSearcher.java	(revision 801851)
+++ src/java/org/apache/lucene/search/IndexSearcher.java	(working copy)
@@ -27,6 +27,7 @@
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.ReaderUtil;
 
 /** Implements search over a single IndexReader.
  *
@@ -121,15 +122,7 @@
   }
 
   protected void gatherSubReaders(List allSubReaders, IndexReader r) {
-    IndexReader[] subReaders = r.getSequentialSubReaders();
-    if (subReaders == null) {
-      // Add the reader itself, and do not recurse
-      allSubReaders.add(r);
-    } else {
-      for (int i = 0; i < subReaders.length; i++) {
-        gatherSubReaders(allSubReaders, subReaders[i]);
-      }
-    }
+    ReaderUtil.gatherSubReaders(allSubReaders, r);
   }
 
   /** Return the {@link IndexReader} this searches. */
@@ -169,7 +162,7 @@
   }
 
   // inherit javadoc
-  public TopDocs search(QueryWeight weight, Filter filter, final int nDocs) throws IOException {
+  public TopDocs search(Weight weight, Filter filter, final int nDocs) throws IOException {
 
     if (nDocs <= 0) {
       throw new IllegalArgumentException("nDocs must be > 0");
@@ -180,22 +173,22 @@
     return collector.topDocs();
   }
 
-  public TopFieldDocs search(QueryWeight weight, Filter filter,
+  public TopFieldDocs search(Weight weight, Filter filter,
       final int nDocs, Sort sort) throws IOException {
     return search(weight, filter, nDocs, sort, true);
   }
 
   /**
-   * Just like {@link #search(QueryWeight, Filter, int, Sort)}, but you choose
+   * Just like {@link #search(Weight, Filter, int, Sort)}, but you choose
    * whether or not the fields in the returned {@link FieldDoc} instances should
    * be set by specifying fillFields.<br>
    * <b>NOTE:</b> currently, this method tracks document scores and sets them in
    * the returned {@link FieldDoc}, however in 3.0 it will move to not track
    * document scores. If document scores tracking is still needed, you can use
-   * {@link #search(QueryWeight, Filter, Collector)} and pass in a
+   * {@link #search(Weight, Filter, Collector)} and pass in a
    * {@link TopFieldCollector} instance.
    */
-  public TopFieldDocs search(QueryWeight weight, Filter filter, final int nDocs,
+  public TopFieldDocs search(Weight weight, Filter filter, final int nDocs,
                              Sort sort, boolean fillFields)
       throws IOException {
     
@@ -242,7 +235,7 @@
     return (TopFieldDocs) collector.topDocs();
   }
 
-  public void search(QueryWeight weight, Filter filter, Collector collector)
+  public void search(Weight weight, Filter filter, Collector collector)
       throws IOException {
     
     if (filter == null) {
@@ -261,7 +254,7 @@
     }
   }
 
-  private void searchWithFilter(IndexReader reader, QueryWeight weight,
+  private void searchWithFilter(IndexReader reader, Weight weight,
       final Filter filter, final Collector collector) throws IOException {
 
     assert filter != null;
@@ -316,8 +309,11 @@
     return query;
   }
 
-  public Explanation explain(QueryWeight weight, int doc) throws IOException {
-    return weight.explain(reader, doc);
+  public Explanation explain(Weight weight, int doc) throws IOException {
+    int n = ReaderUtil.subIndex(doc, docStarts);
+    int deBasedDoc = doc - docStarts[n];
+    
+    return weight.explain(this, subReaders[n], deBasedDoc);
   }
 
   private boolean fieldSortDoTrackScores;
Index: src/java/org/apache/lucene/search/TermScorer.java
===================================================================
--- src/java/org/apache/lucene/search/TermScorer.java	(revision 801851)
+++ src/java/org/apache/lucene/search/TermScorer.java	(working copy)
@@ -27,7 +27,7 @@
   
   private static final float[] SIM_NORM_DECODER = Similarity.getNormDecoder();
   
-  private QueryWeight weight;
+  private Weight weight;
   private TermDocs termDocs;
   private byte[] norms;
   private float weightValue;
@@ -53,30 +53,8 @@
    *          computations.
    * @param norms
    *          The field norms of the document fields for the <code>Term</code>.
-   * 
-   * @deprecated use delete in 3.0, kept around for TestTermScorer in tag which
-   *             creates TermScorer directly, and cannot pass in a QueryWeight
-   *             object.
    */
   TermScorer(Weight weight, TermDocs td, Similarity similarity, byte[] norms) {
-    this(new QueryWeightWrapper(weight), td, similarity, norms);
-  }
-
-  /**
-   * Construct a <code>TermScorer</code>.
-   * 
-   * @param weight
-   *          The weight of the <code>Term</code> in the query.
-   * @param td
-   *          An iterator over the documents matching the <code>Term</code>.
-   * @param similarity
-   *          The </code>Similarity</code> implementation to be used for score
-   *          computations.
-   * @param norms
-   *          The field norms of the document fields for the <code>Term</code>.
-   */
-  TermScorer(QueryWeight weight, TermDocs td, Similarity similarity,
-             byte[] norms) {
     super(similarity);
     this.weight = weight;
     this.termDocs = td;
Index: src/java/org/apache/lucene/search/ExactPhraseScorer.java
===================================================================
--- src/java/org/apache/lucene/search/ExactPhraseScorer.java	(revision 801851)
+++ src/java/org/apache/lucene/search/ExactPhraseScorer.java	(working copy)
@@ -22,7 +22,7 @@
 
 final class ExactPhraseScorer extends PhraseScorer {
 
-  ExactPhraseScorer(QueryWeight weight, TermPositions[] tps, int[] offsets,
+  ExactPhraseScorer(Weight weight, TermPositions[] tps, int[] offsets,
       Similarity similarity, byte[] norms) {
     super(weight, tps, offsets, similarity, norms);
   }
Index: src/java/org/apache/lucene/search/Weight.java
===================================================================
--- src/java/org/apache/lucene/search/Weight.java	(revision 801851)
+++ src/java/org/apache/lucene/search/Weight.java	(working copy)
@@ -18,47 +18,108 @@
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 
 import org.apache.lucene.index.IndexReader;
 
-/** Expert: Calculate query weights and build query scorers.
+/**
+ * Expert: Calculate query weights and build query scorers.
  * <p>
- * The purpose of Weight is to make it so that searching does not modify
- * a Query, so that a Query instance can be reused. <br>
- * Searcher dependent state of the query should reside in the Weight. <br>
- * IndexReader dependent state should reside in the Scorer.
+ * The purpose of {@link Weight} is to ensure searching does not
+ * modify a {@link Query}, so that a {@link Query} instance can be reused. <br>
+ * {@link Searcher} dependent state of the query should reside in the
+ * {@link Weight}. <br>
+ * {@link IndexReader} dependent state should reside in the {@link Scorer}.
  * <p>
  * A <code>Weight</code> is used in the following way:
  * <ol>
- * <li>A <code>Weight</code> is constructed by a top-level query,
- *     given a <code>Searcher</code> ({@link Query#createWeight(Searcher)}).
- * <li>The {@link #sumOfSquaredWeights()} method is called
- *     on the <code>Weight</code> to compute
- *     the query normalization factor {@link Similarity#queryNorm(float)}
- *     of the query clauses contained in the query.
- * <li>The query normalization factor is passed to {@link #normalize(float)}.
- *     At this point the weighting is complete.
+ * <li>A <code>Weight</code> is constructed by a top-level query, given a
+ * <code>Searcher</code> ({@link Query#createWeight(Searcher)}).
+ * <li>The {@link #sumOfSquaredWeights()} method is called on the
+ * <code>Weight</code> to compute the query normalization factor
+ * {@link Similarity#queryNorm(float)} of the query clauses contained in the
+ * query.
+ * <li>The query normalization factor is passed to {@link #normalize(float)}. At
+ * this point the weighting is complete.
  * <li>A <code>Scorer</code> is constructed by {@link #scorer(IndexReader)}.
  * </ol>
  * 
- * @deprecated use {@link QueryWeight} instead. 
+ * @since 2.9
  */
-public interface Weight extends java.io.Serializable {
+public abstract class Weight implements Serializable {
+
+  /**
+   * An explanation of the score computation for the named document. 
+   * 
+   * @param searcher
+   * @param reader sub-reader containing the give doc
+   * @param doc
+   * @return an Explanation for the score
+   * @throws IOException
+   */
+  public abstract Explanation explain(Searcher searcher, IndexReader reader, int doc) throws IOException;
+
+  public Explanation explain(IndexReader reader, int doc) throws IOException {
+    return explain(null, reader, doc);
+  }
+
   /** The query that this concerns. */
-  Query getQuery();
+  public abstract Query getQuery();
 
   /** The weight for this query. */
-  float getValue();
+  public abstract float getValue();
 
+  /** Assigns the query normalization factor to this. */
+  public abstract void normalize(float norm);
+
+  /**
+   * Returns a {@link Scorer} which scores documents in/out-of order according
+   * to <code>scoreDocsInOrder</code>.
+   * <p>
+   * <b>NOTE:</b> even if <code>scoreDocsInOrder</code> is false, it is
+   * recommended to check whether the returned <code>Scorer</code> indeed scores
+   * documents out of order (i.e., call {@link #scoresDocsOutOfOrder()}), as
+   * some <code>Scorer</code> implementations will always return documents
+   * in-order.<br>
+   * <b>NOTE:</b> null can be returned if no documents will be scored by this
+   * query.
+   * 
+   * @param reader
+   *          the {@link IndexReader} for which to return the {@link Scorer}.
+   * @param scoreDocsInOrder
+   *          specifies whether in-order scoring of documents is required. Note
+   *          that if set to false (i.e., out-of-order scoring is required),
+   *          this method can return whatever scoring mode it supports, as every
+   *          in-order scorer is also an out-of-order one. However, an
+   *          out-of-order scorer may not support {@link Scorer#nextDoc()}
+   *          and/or {@link Scorer#advance(int)}, therfore it is recommended to
+   *          request an in-order scorer if use of these methods is required.
+   * @param topScorer
+   *          specifies whether the returned {@link Scorer} will be used as a
+   *          top scorer or as in iterator. I.e., if true,
+   *          {@link Scorer#score(Collector)} will be called; if false,
+   *          {@link Scorer#nextDoc()} and/or {@link Scorer#advance(int)} will
+   *          be called.
+   * @return a {@link Scorer} which scores documents in/out-of order.
+   * @throws IOException
+   */
+  public abstract Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
+      boolean topScorer) throws IOException;
+  
   /** The sum of squared weights of contained query clauses. */
-  float sumOfSquaredWeights() throws IOException;
+  public abstract float sumOfSquaredWeights() throws IOException;
 
-  /** Assigns the query normalization factor to this. */
-  void normalize(float norm);
+  /**
+   * Returns true iff this implementation scores docs only out of order. This
+   * method is used in conjunction with {@link Collector}'s
+   * {@link Collector#acceptsDocsOutOfOrder() acceptsDocsOutOfOrder} and
+   * {@link #scorer(org.apache.lucene.index.IndexReader, boolean, boolean)} to
+   * create a matching {@link Scorer} instance for a given {@link Collector}, or
+   * vice versa.
+   * <p>
+   * <b>NOTE:</b> the default implementation returns <code>false</code>, i.e.
+   * the <code>Scorer</code> scores documents in-order.
+   */
+  public boolean scoresDocsOutOfOrder() { return false; }
 
-  /** Constructs a scorer for this. */
-  Scorer scorer(IndexReader reader) throws IOException;
-
-  /** An explanation of the score computation for the named document. */
-  Explanation explain(IndexReader reader, int doc) throws IOException;
 }
Index: src/java/org/apache/lucene/index/DocumentsWriter.java
===================================================================
--- src/java/org/apache/lucene/index/DocumentsWriter.java	(revision 801851)
+++ src/java/org/apache/lucene/index/DocumentsWriter.java	(working copy)
@@ -32,9 +32,9 @@
 import org.apache.lucene.document.Document;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.QueryWeight;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Similarity;
+import org.apache.lucene.search.Weight;
 import org.apache.lucene.store.AlreadyClosedException;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.ArrayUtil;
@@ -1005,7 +1005,7 @@
       Entry entry = (Entry) iter.next();
       Query query = (Query) entry.getKey();
       int limit = ((Integer) entry.getValue()).intValue();
-      QueryWeight weight = query.queryWeight(searcher);
+      Weight weight = query.weight(searcher);
       Scorer scorer = weight.scorer(reader, true, false);
       if (scorer != null) {
         while(true)  {
Index: src/java/org/apache/lucene/util/ReaderUtil.java
===================================================================
--- src/java/org/apache/lucene/util/ReaderUtil.java	(revision 0)
+++ src/java/org/apache/lucene/util/ReaderUtil.java	(revision 0)
@@ -0,0 +1,96 @@
+package org.apache.lucene.util;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.lucene.index.IndexReader;
+
+public class ReaderUtil {
+
+  /**
+   * Gathers sub-readers from reader into a List.
+   * 
+   * @param allSubReaders
+   * @param reader
+   */
+  public static void gatherSubReaders(List allSubReaders, IndexReader reader) {
+    IndexReader[] subReaders = reader.getSequentialSubReaders();
+    if (subReaders == null) {
+      // Add the reader itself, and do not recurse
+      allSubReaders.add(reader);
+    } else {
+      for (int i = 0; i < subReaders.length; i++) {
+        gatherSubReaders(allSubReaders, subReaders[i]);
+      }
+    }
+  }
+
+  /**
+   * Returns sub IndexReader that contains the given document id.
+   */
+  public static IndexReader subReader(int doc, IndexReader reader) {
+    List subReadersList = new ArrayList();
+    ReaderUtil.gatherSubReaders(subReadersList, reader);
+    IndexReader[] subReaders = (IndexReader[]) subReadersList
+        .toArray(new IndexReader[subReadersList.size()]);
+    int[] docStarts = new int[subReaders.length];
+    int maxDoc = 0;
+    for (int i = 0; i < subReaders.length; i++) {
+      docStarts[i] = maxDoc;
+      maxDoc += subReaders[i].maxDoc();
+    }
+    return subReaders[ReaderUtil.subIndex(doc, docStarts)];
+  }
+  
+  public static IndexReader subReader(IndexReader reader, int subIndex) {
+    List subReadersList = new ArrayList();
+    ReaderUtil.gatherSubReaders(subReadersList, reader);
+    IndexReader[] subReaders = (IndexReader[]) subReadersList
+        .toArray(new IndexReader[subReadersList.size()]);
+    return subReaders[subIndex];
+  }
+
+
+  /**
+   * Returns index of the searcher/reader for document <code>n</code> in the
+   * array used to construct this searcher/reader.
+   */
+  public static int subIndex(int n, int[] docStarts) { // find
+    // searcher/reader for doc n:
+    int size = docStarts.length;
+    int lo = 0; // search starts array
+    int hi = size - 1; // for first element less than n, return its index
+    while (hi >= lo) {
+      int mid = (lo + hi) >>> 1;
+      int midValue = docStarts[mid];
+      if (n < midValue)
+        hi = mid - 1;
+      else if (n > midValue)
+        lo = mid + 1;
+      else { // found a match
+        while (mid + 1 < size && docStarts[mid + 1] == midValue) {
+          mid++; // scan to last match
+        }
+        return mid;
+      }
+    }
+    return hi;
+  }
+}

Property changes on: src/java/org/apache/lucene/util/ReaderUtil.java
___________________________________________________________________
Name: svn:keywords
   + Date Author Id Revision HeadURL
Name: svn:eol-style
   + native

Index: contrib/remote/src/java/org/apache/lucene/search/RemoteSearchable.java
===================================================================
--- contrib/remote/src/java/org/apache/lucene/search/RemoteSearchable.java	(revision 801851)
+++ contrib/remote/src/java/org/apache/lucene/search/RemoteSearchable.java	(working copy)
@@ -48,15 +48,10 @@
   /** @deprecated use {@link #search(Weight, Filter, Collector)} instead. */
   public void search(Weight weight, Filter filter, HitCollector results)
     throws IOException {
-    search(new QueryWeightWrapper(weight), filter, new HitCollectorWrapper(results));
+    local.search(weight, filter, results);
   }
 
   public void search(Weight weight, Filter filter, Collector results)
-      throws IOException {
-    search(new QueryWeightWrapper(weight), filter, results);
-  }
-
-  public void search(QueryWeight weight, Filter filter, Collector results)
   throws IOException {
     local.search(weight, filter, results);
   }
@@ -79,20 +74,11 @@
   }
 
   public TopDocs search(Weight weight, Filter filter, int n) throws IOException {
-    return search(new QueryWeightWrapper(weight), filter, n);
-  }
-  
-  public TopDocs search(QueryWeight weight, Filter filter, int n) throws IOException {
     return local.search(weight, filter, n);
   }
-
+  
   public TopFieldDocs search(Weight weight, Filter filter, int n, Sort sort)
   throws IOException {
-    return search(new QueryWeightWrapper(weight), filter, n, sort);
-  }
-  
-  public TopFieldDocs search(QueryWeight weight, Filter filter, int n, Sort sort)
-  throws IOException {
     return local.search (weight, filter, n, sort);
   }
 
@@ -109,10 +95,6 @@
   }
 
   public Explanation explain(Weight weight, int doc) throws IOException {
-    return explain(new QueryWeightWrapper(weight), doc);
-  }
-  
-  public Explanation explain(QueryWeight weight, int doc) throws IOException {
     return local.explain(weight, doc);
   }
 
