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


C# Token.SetPayload方法代码示例

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


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

示例1: GetNextInputToken

        private Token GetNextInputToken(Token token)
        {
            if (!_input.IncrementToken()) return null;

            token.SetTermBuffer(_inTermAtt.TermBuffer(), 0, _inTermAtt.TermLength());
            token.SetPositionIncrement(_inPosIncrAtt.GetPositionIncrement());
            token.SetFlags(_inFlagsAtt.GetFlags());
            token.SetOffset(_inOffsetAtt.StartOffset(), _inOffsetAtt.EndOffset());
            token.SetType(_inTypeAtt.Type());
            token.SetPayload(_inPayloadAtt.GetPayload());
            return token;
        }
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:12,代码来源:ShingleMatrixFilter.cs

示例2: SetWeight

 /// <summary>
 /// Stores a 32 bit float in the payload, or set it to null if 1f;
 /// </summary>
 /// <param name="token"></param>
 /// <param name="weight"></param>
 public override void SetWeight(Token token, float weight)
 {
     token.SetPayload(
         weight == 1f
             ? null
             : new Payload(PayloadHelper.EncodeFloat(weight))
         );
 }
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:13,代码来源:SimpleThreeDimensionalTokenSettingsCodec.cs

示例3: TestCopyTo

		public virtual void  TestCopyTo()
		{
			Token t = new Token();
			Token copy = (Token) TestSimpleAttributeImpls.AssertCopyIsEqual(t);
			Assert.AreEqual("", t.Term());
			Assert.AreEqual("", copy.Term());
			
			t = new Token(0, 5);
			char[] content = "hello".ToCharArray();
			t.SetTermBuffer(content, 0, 5);
			char[] buf = t.TermBuffer();
			copy = (Token) TestSimpleAttributeImpls.AssertCopyIsEqual(t);
			Assert.AreEqual(t.Term(), copy.Term());
			Assert.AreNotSame(buf, copy.TermBuffer());
			
			Payload pl = new Payload(new byte[]{1, 2, 3, 4});
			t.SetPayload(pl);
			copy = (Token) TestSimpleAttributeImpls.AssertCopyIsEqual(t);
			Assert.AreEqual(pl, copy.GetPayload());
            Assert.AreNotSame(pl, copy.GetPayload());
		}
开发者ID:Rationalle,项目名称:ravendb,代码行数:21,代码来源:TestToken.cs

示例4: GetNextSuffixInputToken

 private Token GetNextSuffixInputToken(Token token)
 {
     if (!Suffix.IncrementToken()) return null;
     token.SetTermBuffer(_termAtt.TermBuffer(), 0, _termAtt.TermLength());
     token.SetPositionIncrement(_posIncrAtt.GetPositionIncrement());
     token.SetFlags(_flagsAtt.GetFlags());
     token.SetOffset(_offsetAtt.StartOffset(), _offsetAtt.EndOffset());
     token.SetType(_typeAtt.Type());
     token.SetPayload(_payloadAtt.GetPayload());
     return token;
 }
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:11,代码来源:PrefixAwareTokenStream.cs

示例5: Next

		public override Token Next(Token target)
		{
			target = input.Next(target);
			if (target == null)
				return null;
			target.SetPayload(p); // reuse the payload / byte[]
			data[0]++;
			return target;
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:9,代码来源:TestAnalyzers.cs

示例6: Next

				public override Token Next(Token result)
				{
					if (buffered != null)
					{
						Token t = buffered;
						buffered = null;
						return t;
					}
					Token t2 = input.Next(result);
					if (t2 == null)
						return null;
					if (System.Char.IsDigit(t2.TermBuffer()[0]))
					{
						t2.SetPositionIncrement(t2.TermBuffer()[0] - '0');
					}
					if (first)
					{
						// set payload on first position only
						t2.SetPayload(new Payload(new byte[]{100}));
						first = false;
					}
					
					// index a "synonym" for every token
					buffered = (Token) t2.Clone();
					buffered.SetPayload(null);
					buffered.SetPositionIncrement(0);
					buffered.SetTermBuffer(new char[]{'b'}, 0, 1);
					
					return t2;
				}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:30,代码来源:TestDocumentWriter.cs


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