当前位置: 首页>>代码示例>>C#>>正文


C# DisjunctionMaxQuery.ToString方法代码示例

本文整理汇总了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;
			}
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:27,代码来源:TestDisjunctionMaxQuery.cs

示例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;
            }
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:25,代码来源:TestDisjunctionMaxQuery.cs

示例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;
			}
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:28,代码来源:TestDisjunctionMaxQuery.cs

示例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;
            }
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:26,代码来源:TestDisjunctionMaxQuery.cs


注:本文中的Lucene.Net.Search.DisjunctionMaxQuery.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。