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


C# SpanOrQuery.GetSpans方法代码示例

本文整理汇总了C#中Lucene.Net.Search.Spans.SpanOrQuery.GetSpans方法的典型用法代码示例。如果您正苦于以下问题:C# SpanOrQuery.GetSpans方法的具体用法?C# SpanOrQuery.GetSpans怎么用?C# SpanOrQuery.GetSpans使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lucene.Net.Search.Spans.SpanOrQuery的用法示例。


在下文中一共展示了SpanOrQuery.GetSpans方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestSpans1

		public virtual void  TestSpans1()
		{
			SpanQuery q1 = new SpanTermQuery(new Term("first", "sally"));
			SpanQuery q2 = new SpanTermQuery(new Term("first", "james"));
			SpanQuery qA = new SpanOrQuery(new SpanQuery[]{q1, q2});
			SpanQuery qB = new FieldMaskingSpanQuery(qA, "id");
			
			Check(qA, new int[]{0, 1, 2, 4});
			Check(qB, new int[]{0, 1, 2, 4});
			
			Spans spanA = qA.GetSpans(searcher.GetIndexReader());
			Spans spanB = qB.GetSpans(searcher.GetIndexReader());
			
			while (spanA.Next())
			{
				Assert.IsTrue(spanB.Next(), "spanB not still going");
				Assert.AreEqual(S(spanA), S(spanB), "spanA not equal spanB");
			}
			Assert.IsTrue(!(spanB.Next()), "spanB still going even tough spanA is done");
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:20,代码来源:TestFieldMaskingSpanQuery.cs

示例2: TestSpans0

		public virtual void  TestSpans0()
		{
			SpanQuery q1 = new SpanTermQuery(new Term("gender", "female"));
			SpanQuery q2 = new SpanTermQuery(new Term("first", "james"));
			SpanQuery q = new SpanOrQuery(new SpanQuery[]{q1, new FieldMaskingSpanQuery(q2, "gender")});
			Check(q, new int[]{0, 1, 2, 3, 4});
			
			Spans span = q.GetSpans(searcher.GetIndexReader());
			
			Assert.AreEqual(true, span.Next());
			Assert.AreEqual(S(0, 0, 1), S(span));
			
			Assert.AreEqual(true, span.Next());
			Assert.AreEqual(S(1, 0, 1), S(span));
			
			Assert.AreEqual(true, span.Next());
			Assert.AreEqual(S(1, 1, 2), S(span));
			
			Assert.AreEqual(true, span.Next());
			Assert.AreEqual(S(2, 0, 1), S(span));
			
			Assert.AreEqual(true, span.Next());
			Assert.AreEqual(S(2, 1, 2), S(span));
			
			Assert.AreEqual(true, span.Next());
			Assert.AreEqual(S(2, 2, 3), S(span));
			
			Assert.AreEqual(true, span.Next());
			Assert.AreEqual(S(3, 0, 1), S(span));
			
			Assert.AreEqual(true, span.Next());
			Assert.AreEqual(S(4, 0, 1), S(span));
			
			Assert.AreEqual(true, span.Next());
			Assert.AreEqual(S(4, 1, 2), S(span));
			
			Assert.AreEqual(false, span.Next());
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:38,代码来源:TestFieldMaskingSpanQuery.cs


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