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); }
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()); }