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


C# SegmentReader.LoadDeletedDocs方法代码示例

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


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

示例1: ReopenSegment

		internal virtual SegmentReader ReopenSegment(SegmentInfo si)
		{
			lock (this)
			{
				bool deletionsUpToDate = (this.si.HasDeletions() == si.HasDeletions()) && (!si.HasDeletions() || this.si.GetDelFileName().Equals(si.GetDelFileName()));
				bool normsUpToDate = true;
				
				
				bool[] fieldNormsChanged = new bool[fieldInfos.Size()];
				if (normsUpToDate)
				{
					for (int i = 0; i < fieldInfos.Size(); i++)
					{
						if (!this.si.GetNormFileName(i).Equals(si.GetNormFileName(i)))
						{
							normsUpToDate = false;
							fieldNormsChanged[i] = true;
						}
					}
				}
				
				if (normsUpToDate && deletionsUpToDate)
				{
					return this;
				}
				
				
				// clone reader
				SegmentReader clone = new SegmentReader();
				bool success = false;
				try
				{
					clone.directory = directory;
					clone.si = si;
					clone.segment = segment;
					clone.readBufferSize = readBufferSize;
					clone.cfsReader = cfsReader;
					clone.storeCFSReader = storeCFSReader;
					
					clone.fieldInfos = fieldInfos;
					clone.tis = tis;
					clone.freqStream = freqStream;
					clone.proxStream = proxStream;
					clone.termVectorsReaderOrig = termVectorsReaderOrig;
					
					
					// we have to open a new FieldsReader, because it is not thread-safe
					// and can thus not be shared among multiple SegmentReaders
					// TODO: Change this in case FieldsReader becomes thread-safe in the future
					System.String fieldsSegment;
					
					Directory storeDir = Directory();
					
					if (si.GetDocStoreOffset() != - 1)
					{
						fieldsSegment = si.GetDocStoreSegment();
						if (storeCFSReader != null)
						{
							storeDir = storeCFSReader;
						}
					}
					else
					{
						fieldsSegment = segment;
						if (cfsReader != null)
						{
							storeDir = cfsReader;
						}
					}
					
					if (fieldsReader != null)
					{
						clone.fieldsReader = new FieldsReader(storeDir, fieldsSegment, fieldInfos, readBufferSize, si.GetDocStoreOffset(), si.docCount);
					}
					
					
					if (!deletionsUpToDate)
					{
						// load deleted docs
						clone.deletedDocs = null;
						clone.LoadDeletedDocs();
					}
					else
					{
						clone.deletedDocs = this.deletedDocs;
					}
					
					clone.norms = new System.Collections.Hashtable();
					if (!normsUpToDate)
					{
						// load norms
						for (int i = 0; i < fieldNormsChanged.Length; i++)
						{
							// copy unchanged norms to the cloned reader and incRef those norms
							if (!fieldNormsChanged[i])
							{
								System.String curField = fieldInfos.FieldInfo(i).name;
								Norm norm = (Norm) this.norms[curField];
								norm.IncRef();
								clone.norms[curField] = norm;
//.........这里部分代码省略.........
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:101,代码来源:SegmentReader.cs


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