public TestFilter(TestMultiAnalyzer enclosingInstance, TokenStream in_Renamed) : base(in_Renamed)
 {
     InitBlock(enclosingInstance);
     termAtt    = (TermAttribute)AddAttribute(typeof(TermAttribute));
     posIncrAtt = (PositionIncrementAttribute)AddAttribute(typeof(PositionIncrementAttribute));
     offsetAtt  = (OffsetAttribute)AddAttribute(typeof(OffsetAttribute));
     typeAtt    = (TypeAttribute)AddAttribute(typeof(TypeAttribute));
 }
Example #2
0
        public virtual void  TestIntStream()
        {
            NumericTokenStream stream = new NumericTokenStream().SetIntValue(ivalue);
            // use getAttribute to test if attributes really exist, if not an IAE will be throwed
            TermAttribute termAtt = (TermAttribute)stream.GetAttribute(typeof(TermAttribute));
            TypeAttribute typeAtt = (TypeAttribute)stream.GetAttribute(typeof(TypeAttribute));

            for (int shift = 0; shift < 32; shift += NumericUtils.PRECISION_STEP_DEFAULT)
            {
                Assert.IsTrue(stream.IncrementToken(), "New token is available");
                Assert.AreEqual(NumericUtils.IntToPrefixCoded(ivalue, shift), termAtt.Term(), "Term is correctly encoded");
                Assert.AreEqual((shift == 0)?NumericTokenStream.TOKEN_TYPE_FULL_PREC:NumericTokenStream.TOKEN_TYPE_LOWER_PREC, typeAtt.Type(), "Type correct");
            }
            Assert.IsFalse(stream.IncrementToken(), "No more tokens available");
        }
 /// <summary>Construct filtering <i>in</i>. </summary>
 public StandardFilter(TokenStream in_Renamed)
     : base(in_Renamed)
 {
     termAtt = (TermAttribute) AddAttribute(typeof(TermAttribute));
     typeAtt = (TypeAttribute) AddAttribute(typeof(TypeAttribute));
 }
 private void Init(System.IO.TextReader input, bool replaceInvalidAcronym)
 {
     this.replaceInvalidAcronym = replaceInvalidAcronym;
     this.input = input;
     termAtt = (TermAttribute) AddAttribute(typeof(TermAttribute));
     offsetAtt = (OffsetAttribute) AddAttribute(typeof(OffsetAttribute));
     posIncrAtt = (PositionIncrementAttribute) AddAttribute(typeof(PositionIncrementAttribute));
     typeAtt = (TypeAttribute) AddAttribute(typeof(TypeAttribute));
 }
			public TestFilter(TestMultiAnalyzer enclosingInstance, TokenStream in_Renamed):base(in_Renamed)
			{
				InitBlock(enclosingInstance);
				termAtt = (TermAttribute) AddAttribute(typeof(TermAttribute));
				posIncrAtt = (PositionIncrementAttribute) AddAttribute(typeof(PositionIncrementAttribute));
				offsetAtt = (OffsetAttribute) AddAttribute(typeof(OffsetAttribute));
				typeAtt = (TypeAttribute) AddAttribute(typeof(TypeAttribute));
			}
Example #6
0
 private void InitBlock()
 {
     termAtt = (TermAttribute) AddAttribute(typeof(TermAttribute));
     typeAtt = (TypeAttribute) AddAttribute(typeof(TypeAttribute));
     posIncrAtt = (PositionIncrementAttribute) AddAttribute(typeof(PositionIncrementAttribute));
 }