@Override
 public Query rewrite(IndexReader reader) throws IOException {
   Query newQ = q.rewrite(reader);
   if (newQ == q) return this;
   BoostedQuery bq = (BoostedQuery) this.clone();
   bq.q = newQ;
   return bq;
 }
 @Override
 public boolean equals(Object o) {
   if (getClass() != o.getClass()) return false;
   BoostedQuery other = (BoostedQuery) o;
   return this.getBoost() == other.getBoost()
       && this.q.equals(other.q)
       && this.boostVal.equals(other.boostVal);
 }