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


C# Lucene.Net.Store.IndexOutput.WriteVLong方法代码示例

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


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

示例1: WriteSkip

        /// <summary>
        /// Writes the buffered skip lists to the given output.
        /// </summary>
        /// <param name="output"> the IndexOutput the skip lists shall be written to </param>
        /// <returns> the pointer the skip list starts </returns>
        public virtual long WriteSkip(IndexOutput output)
        {
            long skipPointer = output.FilePointer;
            //System.out.println("skipper.writeSkip fp=" + skipPointer);
            if (SkipBuffer == null || SkipBuffer.Length == 0)
            {
                return skipPointer;
            }

            for (int level = NumberOfSkipLevels - 1; level > 0; level--)
            {
                long length = SkipBuffer[level].FilePointer;
                if (length > 0)
                {
                    output.WriteVLong(length);
                    SkipBuffer[level].WriteTo(output);
                }
            }
            SkipBuffer[0].WriteTo(output);

            return skipPointer;
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:27,代码来源:MultiLevelSkipListWriter.cs

示例2: WriteSkip

		/// <summary> Writes the buffered skip lists to the given output.
		/// 
		/// </summary>
		/// <param name="output">the IndexOutput the skip lists shall be written to 
		/// </param>
		/// <returns> the pointer the skip list starts
		/// </returns>
		internal virtual long WriteSkip(IndexOutput output)
		{
			long skipPointer = output.FilePointer;
			if (skipBuffer == null || skipBuffer.Length == 0)
				return skipPointer;
			
			for (int level = numberOfSkipLevels - 1; level > 0; level--)
			{
				long length = skipBuffer[level].FilePointer;
				if (length > 0)
				{
					output.WriteVLong(length);
					skipBuffer[level].WriteTo(output);
				}
			}
			skipBuffer[0].WriteTo(output);
			
			return skipPointer;
		}
开发者ID:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:26,代码来源:MultiLevelSkipListWriter.cs

示例3: AddVarStraightBytesField

        // NOTE: 4.0 file format docs are crazy/wrong here...
        private void AddVarStraightBytesField(FieldInfo field, IndexOutput data, IndexOutput index, IEnumerable<BytesRef> values)
        {
            field.PutAttribute(LegacyKey, LegacyDocValuesType.BYTES_VAR_STRAIGHT.Name);

            CodecUtil.WriteHeader(data, Lucene40DocValuesFormat.BYTES_VAR_STRAIGHT_CODEC_NAME_DAT, Lucene40DocValuesFormat.BYTES_VAR_STRAIGHT_VERSION_CURRENT);

            CodecUtil.WriteHeader(index, Lucene40DocValuesFormat.BYTES_VAR_STRAIGHT_CODEC_NAME_IDX, Lucene40DocValuesFormat.BYTES_VAR_STRAIGHT_VERSION_CURRENT);

            /* values */

            long startPos = data.FilePointer;

            foreach (BytesRef v in values)
            {
                if (v != null)
                {
                    data.WriteBytes(v.Bytes, v.Offset, v.Length);
                }
            }

            /* addresses */

            long maxAddress = data.FilePointer - startPos;
            index.WriteVLong(maxAddress);

            int maxDoc = State.SegmentInfo.DocCount;
            Debug.Assert(maxDoc != int.MaxValue); // unsupported by the 4.0 impl

            PackedInts.Writer w = PackedInts.GetWriter(index, maxDoc + 1, PackedInts.BitsRequired(maxAddress), PackedInts.DEFAULT);
            long currentPosition = 0;
            foreach (BytesRef v in values)
            {
                w.Add(currentPosition);
                if (v != null)
                {
                    currentPosition += v.Length;
                }
            }
            // write sentinel
            Debug.Assert(currentPosition == maxAddress);
            w.Add(currentPosition);
            w.Finish();
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:44,代码来源:Lucene40DocValuesWriter.cs


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