public virtual void TestBooleanRequiredEqualScores()
{
BooleanQuery q = new BooleanQuery();
{
DisjunctionMaxQuery q1 = new DisjunctionMaxQuery(0.0f);
q1.Add(Tq("hed", "albino"));
q1.Add(Tq("dek", "albino"));
q.Add(q1, BooleanClause.Occur.MUST); // true,false);
QueryUtils.Check(Random(), q1, s, Similarity);
}
{
DisjunctionMaxQuery q2 = new DisjunctionMaxQuery(0.0f);
q2.Add(Tq("hed", "elephant"));
q2.Add(Tq("dek", "elephant"));
q.Add(q2, BooleanClause.Occur.MUST); // true,false);
QueryUtils.Check(Random(), q2, s, Similarity);
}
QueryUtils.Check(Random(), q, s, Similarity);
ScoreDoc[] h = s.Search(q, null, 1000).ScoreDocs;
try
{
Assert.AreEqual(3, h.Length, "3 docs should match " + q.ToString());
float score = h[0].Score;
for (int i = 1; i < h.Length; i++)
{
Assert.AreEqual(score, h[i].Score, SCORE_COMP_THRESH, "score #" + i + " is not the same");
}
}
catch (Exception e)
{
PrintHits("testBooleanRequiredEqualScores1", h, s);
throw e;
}
}