LUCENE-1694: fix Query.mergeBooleanQueries to take BooleanQuery[] param

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@785222 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-06-16 14:08:28 +00:00
parent 757795bffe
commit ea9fcfe3fc
2 changed files with 5 additions and 5 deletions

View File

@ -94,9 +94,9 @@ public class BooleanClause implements java.io.Serializable {
/** Returns true iff <code>o</code> is equal to this. */
/** Returns true if <code>o</code> is equal to this. */
public boolean equals(Object o) {
if (!(o instanceof BooleanClause))
if (o == null || !(o instanceof BooleanClause))
return false;
BooleanClause other = (BooleanClause)o;
return this.query.equals(other.query)

View File

@ -169,17 +169,17 @@ public abstract class Query implements java.io.Serializable, Cloneable {
*
*<p>A utility for use by {@link #combine(Query[])} implementations.
*/
public static Query mergeBooleanQueries(Query[] queries) {
public static Query mergeBooleanQueries(BooleanQuery[] queries) {
HashSet allClauses = new HashSet();
for (int i = 0; i < queries.length; i++) {
BooleanClause[] clauses = ((BooleanQuery)queries[i]).getClauses();
BooleanClause[] clauses = queries[i].getClauses();
for (int j = 0; j < clauses.length; j++) {
allClauses.add(clauses[j]);
}
}
boolean coordDisabled =
queries.length==0? false : ((BooleanQuery)queries[0]).isCoordDisabled();
queries.length==0? false : queries[0].isCoordDisabled();
BooleanQuery result = new BooleanQuery(coordDisabled);
Iterator i = allClauses.iterator();
while (i.hasNext()) {