@@ -0,0 +1,2034 @@
+/*%0A * Copyright 2011 The greplin-lucene-utils Authors.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.greplin.lucene.query;%0A%0Aimport org.apache.lucene.index.IndexReader;%0Aimport org.apache.lucene.search.Query;%0A%0Aimport java.io.IOException;%0A%0A/**%0A * A Query that just wraps a sub query and adds a name to it in toString()%0A */%0Apublic class NamedQuery extends Query %7B%0A%0A  /**%0A   * The query to match.%0A   */%0A  private final Query query;%0A%0A  /**%0A   * The name of the query, for toString.%0A   */%0A  private final String name;%0A%0A  /**%0A   * Constructs a query that adds a name to a sub query.%0A   * @param query the sub query%0A   * @param name the name of the query%0A   */%0A  public NamedQuery(final Query query, final String name) %7B%0A    this.query = query;%0A    this.name = name;%0A  %7D%0A%0A  @Override%0A  public final String toString(final String field) %7B%0A    return this.name + '=' + this.query.toString(field);%0A  %7D%0A%0A  @Override%0A  public final int hashCode() %7B%0A    // Only check for query equality.%0A    return this.query.hashCode();%0A  %7D%0A%0A  @Override%0A  public final boolean equals(final Object obj) %7B%0A    if (this == obj) %7B%0A      return true;%0A    %7D%0A    if (!super.equals(obj)) %7B%0A      return false;%0A    %7D%0A    if (getClass() != obj.getClass()) %7B%0A      return false;%0A    %7D%0A    NamedQuery other = (NamedQuery) obj;%0A    // Only check for query equality.%0A    return this.query.equals(other.query);%0A  %7D%0A%0A%0A  @Override%0A  public final Query rewrite(final IndexReader reader) throws IOException %7B%0A    return this.query.rewrite(reader);%0A  %7D%0A%0A%7D%0A

Add named query object for debugging