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


C# TermVectorMapper.SetDocumentNumber方法代码示例

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


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

示例1: Get

		public virtual void  Get(int docNum, System.String field, TermVectorMapper mapper)
		{
			if (tvx != null)
			{
				int fieldNumber = fieldInfos.FieldNumber(field);
				//We need to account for the FORMAT_SIZE at when seeking in the tvx
				//We don't need to do this in other seeks because we already have the
				// file pointer
				//that was written in another file
				SeekTvx(docNum);
				//System.out.println("TVX Pointer: " + tvx.getFilePointer());
				long tvdPosition = tvx.ReadLong();
				
				tvd.Seek(tvdPosition);
				int fieldCount = tvd.ReadVInt();
				//System.out.println("Num Fields: " + fieldCount);
				// There are only a few fields per document. We opt for a full scan
				// rather then requiring that they be ordered. We need to read through
				// all of the fields anyway to get to the tvf pointers.
				int number = 0;
				int found = - 1;
				for (int i = 0; i < fieldCount; i++)
				{
					if (format >= FORMAT_VERSION)
						number = tvd.ReadVInt();
					else
						number += tvd.ReadVInt();
					
					if (number == fieldNumber)
						found = i;
				}
				
				// This field, although valid in the segment, was not found in this
				// document
				if (found != - 1)
				{
					// Compute position in the tvf file
					long position;
					if (format >= FORMAT_VERSION2)
						position = tvx.ReadLong();
					else
						position = tvd.ReadVLong();
					for (int i = 1; i <= found; i++)
						position += tvd.ReadVLong();
					
					mapper.SetDocumentNumber(docNum);
					ReadTermVector(field, position, mapper);
				}
				else
				{
					//System.out.println("Fieldable not found");
				}
			}
			else
			{
				//System.out.println("No tvx file");
			}
		}
开发者ID:Mpdreamz,项目名称:lucene.net,代码行数:58,代码来源:TermVectorsReader.cs

示例2: Get

		public virtual void  Get(int docNumber, TermVectorMapper mapper)
		{
			// Check if no term vectors are available for this segment at all
			if (tvx != null)
			{
				//We need to offset by
				tvx.Seek((docNumber * 8L) + FORMAT_SIZE);
				long position = tvx.ReadLong();
				
				tvd.Seek(position);
				int fieldCount = tvd.ReadVInt();
				
				// No fields are vectorized for this document
				if (fieldCount != 0)
				{
					int number = 0;
					System.String[] fields = new System.String[fieldCount];
					
					for (int i = 0; i < fieldCount; i++)
					{
						if (tvdFormat == FORMAT_VERSION)
							number = tvd.ReadVInt();
						else
							number += tvd.ReadVInt();
						
						fields[i] = fieldInfos.FieldName(number);
					}
					
					// Compute position in the tvf file
					position = 0;
					long[] tvfPointers = new long[fieldCount];
					for (int i = 0; i < fieldCount; i++)
					{
						position += tvd.ReadVLong();
						tvfPointers[i] = position;
					}
					
					mapper.SetDocumentNumber(docNumber);
					ReadTermVectors(fields, tvfPointers, mapper);
				}
			}
			else
			{
				//System.out.println("No tvx file");
			}
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:46,代码来源:TermVectorsReader.cs


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