public boolean equals(Object o) { if (o instanceof ReRankQuery) { ReRankQuery rrq = (ReRankQuery) o; return (mainQuery.equals(rrq.mainQuery) && reRankQuery.equals(rrq.reRankQuery) && reRankWeight == rrq.reRankWeight && reRankDocs == rrq.reRankDocs && getBoost() == rrq.getBoost() && scale == rrq.scale); } return false; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; GlobalOrdinalsQuery that = (GlobalOrdinalsQuery) o; if (!fromQuery.equals(that.fromQuery)) return false; if (!joinField.equals(that.joinField)) return false; if (!toQuery.equals(that.toQuery)) return false; if (!indexReader.equals(that.indexReader)) return false; return true; }
@Override public boolean equals(Object _other) { if (_other instanceof ToParentBlockJoinQuery) { final ToParentBlockJoinQuery other = (ToParentBlockJoinQuery) _other; return origChildQuery.equals(other.origChildQuery) && parentsFilter.equals(other.parentsFilter) && scoreMode == other.scoreMode && super.equals(other); } else { return false; } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; CompositeVerifyQuery that = (CompositeVerifyQuery) o; if (!indexQuery.equals(that.indexQuery)) return false; if (!predicateValueSource.equals(that.predicateValueSource)) return false; return true; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || obj.getClass() != this.getClass()) { return false; } HasParentFilter that = (HasParentFilter) obj; if (!originalParentQuery.equals(that.parentQuery)) { return false; } if (!parentType.equals(that.parentType)) { return false; } return true; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } TermsQuery other = (TermsQuery) obj; if (!fromQuery.equals(other.fromQuery)) { return false; } return true; }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final QueryFactoryResult that = (QueryFactoryResult) o; if (mustNotOccur != that.mustNotOccur) { return false; } if (!luceneQuery.equals(that.luceneQuery)) { return false; } return true; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } TermsIncludingScoreQuery other = (TermsIncludingScoreQuery) obj; if (!field.equals(other.field)) { return false; } if (!unwrittenOriginalQuery.equals(other.unwrittenOriginalQuery)) { return false; } return true; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || obj.getClass() != this.getClass()) { return false; } ChildrenQuery that = (ChildrenQuery) obj; if (!originalChildQuery.equals(that.originalChildQuery)) { return false; } if (!childType.equals(that.childType)) { return false; } if (getBoost() != that.getBoost()) { return false; } return true; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || obj.getClass() != this.getClass()) { return false; } ChildrenConstantScoreQuery that = (ChildrenConstantScoreQuery) obj; if (!originalChildQuery.equals(that.originalChildQuery)) { return false; } if (!childType.equals(that.childType)) { return false; } if (shortCircuitParentDocSet != that.shortCircuitParentDocSet) { return false; } if (getBoost() != that.getBoost()) { return false; } return true; }
public void testEqualsHashcode() { Query query = new RangeQuery(new Term("content", "A"), new Term("content", "C"), true); query.setBoost(1.0f); Query other = new RangeQuery(new Term("content", "A"), new Term("content", "C"), true); other.setBoost(1.0f); assertEquals("query equals itself is true", query, query); assertEquals("equivalent queries are equal", query, other); assertEquals( "hashcode must return same value when equals is true", query.hashCode(), other.hashCode()); other.setBoost(2.0f); assertFalse("Different boost queries are not equal", query.equals(other)); other = new RangeQuery(new Term("notcontent", "A"), new Term("notcontent", "C"), true); assertFalse("Different fields are not equal", query.equals(other)); other = new RangeQuery(new Term("content", "X"), new Term("content", "C"), true); assertFalse("Different lower terms are not equal", query.equals(other)); other = new RangeQuery(new Term("content", "A"), new Term("content", "Z"), true); assertFalse("Different upper terms are not equal", query.equals(other)); query = new RangeQuery(null, new Term("content", "C"), true); other = new RangeQuery(null, new Term("content", "C"), true); assertEquals("equivalent queries with null lowerterms are equal()", query, other); assertEquals( "hashcode must return same value when equals is true", query.hashCode(), other.hashCode()); query = new RangeQuery(new Term("content", "C"), null, true); other = new RangeQuery(new Term("content", "C"), null, true); assertEquals("equivalent queries with null upperterms are equal()", query, other); assertEquals("hashcode returns same value", query.hashCode(), other.hashCode()); query = new RangeQuery(null, new Term("content", "C"), true); other = new RangeQuery(new Term("content", "C"), null, true); assertFalse("queries with different upper and lower terms are not equal", query.equals(other)); query = new RangeQuery(new Term("content", "A"), new Term("content", "C"), false); other = new RangeQuery(new Term("content", "A"), new Term("content", "C"), true); assertFalse("queries with different inclusive are not equal", query.equals(other)); }
private void _includeIfUnique( BooleanQuery booleanQuery, boolean like, QueryParser queryParser, Query query, BooleanClause.Occur occur) { if (query instanceof TermQuery) { Set<Term> terms = new HashSet<Term>(); TermQuery termQuery = (TermQuery) query; termQuery.extractTerms(terms); float boost = termQuery.getBoost(); for (Term term : terms) { String termValue = term.text(); if (like) { termValue = termValue.toLowerCase(queryParser.getLocale()); term = term.createTerm(StringPool.STAR.concat(termValue).concat(StringPool.STAR)); query = new WildcardQuery(term); } else { query = new TermQuery(term); } query.setBoost(boost); boolean included = false; for (BooleanClause booleanClause : booleanQuery.getClauses()) { if (query.equals(booleanClause.getQuery())) { included = true; } } if (!included) { booleanQuery.add(query, occur); } } } else if (query instanceof BooleanQuery) { BooleanQuery curBooleanQuery = (BooleanQuery) query; BooleanQuery containerBooleanQuery = new BooleanQuery(); for (BooleanClause booleanClause : curBooleanQuery.getClauses()) { _includeIfUnique( containerBooleanQuery, like, queryParser, booleanClause.getQuery(), booleanClause.getOccur()); } if (containerBooleanQuery.getClauses().length > 0) { booleanQuery.add(containerBooleanQuery, occur); } } else { boolean included = false; for (BooleanClause booleanClause : booleanQuery.getClauses()) { if (query.equals(booleanClause.getQuery())) { included = true; } } if (!included) { booleanQuery.add(query, occur); } } }
private boolean equalsTo(BoostingQuery other) { return match.equals(other.match) && context.equals(other.context) && Float.floatToIntBits(boost) == Float.floatToIntBits(other.boost); }