本文整理汇总了C#中Lucene.Net.Search.DisjunctionMaxQuery.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DisjunctionMaxQuery.ToString方法的具体用法?C# DisjunctionMaxQuery.ToString怎么用?C# DisjunctionMaxQuery.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Search.DisjunctionMaxQuery
的用法示例。
在下文中一共展示了DisjunctionMaxQuery.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSimpleTiebreaker
public virtual void TestSimpleTiebreaker()
{
DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.01f);
q.Add(Tq("dek", "albino"));
q.Add(Tq("dek", "elephant"));
QueryUtils.Check(q, s);
Hits h = s.Search(q);
try
{
Assert.AreEqual(3, h.Length(), "3 docs should match " + q.ToString());
Assert.AreEqual("d2", h.Doc(0).Get("id"), "wrong first");
float score0 = h.Score(0);
float score1 = h.Score(1);
float score2 = h.Score(2);
Assert.IsTrue(score0 > score1, "d2 does not have better score then others: " + score0 + " >? " + score1);
Assert.AreEqual(score1, score2, SCORE_COMP_THRESH, "d4 and d1 don't have equal scores");
}
catch (System.ApplicationException e)
{
PrintHits("testSimpleTiebreaker", h);
throw e;
}
}
示例2: TestSimpleTiebreaker
public virtual void TestSimpleTiebreaker()
{
DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.01f);
q.Add(Tq("dek", "albino"));
q.Add(Tq("dek", "elephant"));
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());
Assert.AreEqual("d2", s.Doc(h[0].Doc).Get("id"), "wrong first");
float score0 = h[0].Score;
float score1 = h[1].Score;
float score2 = h[2].Score;
Assert.IsTrue(score0 > score1, "d2 does not have better score then others: " + score0 + " >? " + score1);
Assert.AreEqual(score1, score2, SCORE_COMP_THRESH, "d4 and d1 don't have equal scores");
}
catch (Exception e)
{
PrintHits("testSimpleTiebreaker", h, s);
throw e;
}
}
示例3: TestSimpleEqualScores3
public virtual void TestSimpleEqualScores3()
{
DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.0f);
q.Add(Tq("hed", "albino"));
q.Add(Tq("hed", "elephant"));
q.Add(Tq("dek", "albino"));
q.Add(Tq("dek", "elephant"));
QueryUtils.Check(q, s);
Hits h = s.Search(q);
try
{
Assert.AreEqual(4, h.Length(), "all docs should match " + q.ToString());
float score = h.Score(0);
for (int i = 1; i < h.Length(); i++)
{
Assert.AreEqual(score, h.Score(i), SCORE_COMP_THRESH, "score #" + i + " is not the same");
}
}
catch (System.ApplicationException e)
{
PrintHits("testSimpleEqualScores3", h);
throw e;
}
}
示例4: TestSimpleEqualScores3
public virtual void TestSimpleEqualScores3()
{
DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.0f);
q.Add(Tq("hed", "albino"));
q.Add(Tq("hed", "elephant"));
q.Add(Tq("dek", "albino"));
q.Add(Tq("dek", "elephant"));
QueryUtils.Check(Random(), q, s, Similarity);
ScoreDoc[] h = s.Search(q, null, 1000).ScoreDocs;
try
{
Assert.AreEqual(4, h.Length, "all 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("testSimpleEqualScores3", h, s);
throw e;
}
}