public virtual void TestEquality() { BooleanQuery bq1 = new BooleanQuery(); bq1.Add(new TermQuery(new Term("field", "value1")), Occur.SHOULD); bq1.Add(new TermQuery(new Term("field", "value2")), Occur.SHOULD); BooleanQuery nested1 = new BooleanQuery(); nested1.Add(new TermQuery(new Term("field", "nestedvalue1")), Occur.SHOULD); nested1.Add(new TermQuery(new Term("field", "nestedvalue2")), Occur.SHOULD); bq1.Add(nested1, Occur.SHOULD); BooleanQuery bq2 = new BooleanQuery(); bq2.Add(new TermQuery(new Term("field", "value1")), Occur.SHOULD); bq2.Add(new TermQuery(new Term("field", "value2")), Occur.SHOULD); BooleanQuery nested2 = new BooleanQuery(); nested2.Add(new TermQuery(new Term("field", "nestedvalue1")), Occur.SHOULD); nested2.Add(new TermQuery(new Term("field", "nestedvalue2")), Occur.SHOULD); bq2.Add(nested2, Occur.SHOULD); Assert.IsTrue(bq1.Equals(bq2)); //Assert.AreEqual(bq1, bq2); }
public virtual void TestEquality() { BooleanQuery bq1 = new BooleanQuery(); bq1.Add(new TermQuery(new Term("field", "value1")), BooleanClause.Occur.SHOULD); bq1.Add(new TermQuery(new Term("field", "value2")), BooleanClause.Occur.SHOULD); BooleanQuery nested1 = new BooleanQuery(); nested1.Add(new TermQuery(new Term("field", "nestedvalue1")), BooleanClause.Occur.SHOULD); nested1.Add(new TermQuery(new Term("field", "nestedvalue2")), BooleanClause.Occur.SHOULD); bq1.Add(nested1, BooleanClause.Occur.SHOULD); BooleanQuery bq2 = new BooleanQuery(); bq2.Add(new TermQuery(new Term("field", "value1")), BooleanClause.Occur.SHOULD); bq2.Add(new TermQuery(new Term("field", "value2")), BooleanClause.Occur.SHOULD); BooleanQuery nested2 = new BooleanQuery(); nested2.Add(new TermQuery(new Term("field", "nestedvalue1")), BooleanClause.Occur.SHOULD); nested2.Add(new TermQuery(new Term("field", "nestedvalue2")), BooleanClause.Occur.SHOULD); bq2.Add(nested2, BooleanClause.Occur.SHOULD); Assert.IsTrue(bq1.Equals(bq2)); //Assert.AreEqual(bq1, bq2); }