예제 #1
0
        public virtual void  TestOffsets()
        {
            TokenStream      stream    = new KeywordAnalyzer().TokenStream("field", new System.IO.StringReader("abcd"));
            IOffsetAttribute offsetAtt = stream.AddAttribute <IOffsetAttribute>();

            Assert.IsTrue(stream.IncrementToken());
            Assert.AreEqual(0, offsetAtt.StartOffset);
            Assert.AreEqual(4, offsetAtt.EndOffset);
        }
예제 #2
0
		public virtual void  TestOffsets()
		{
			TokenStream stream = new KeywordAnalyzer().TokenStream("field", new System.IO.StringReader("abcd"));
			OffsetAttribute offsetAtt = (OffsetAttribute) stream.AddAttribute(typeof(OffsetAttribute));
			Assert.IsTrue(stream.IncrementToken());
			Assert.AreEqual(0, offsetAtt.StartOffset());
			Assert.AreEqual(4, offsetAtt.EndOffset());
		}