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


C# SegmentReader.MaxDoc方法代码示例

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


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

示例1: AllTermDocs

		protected internal AllTermDocs(SegmentReader parent) : base(parent.MaxDoc())
		{
			lock (parent)
			{
				this.deletedDocs = parent.deletedDocs;
			}
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:7,代码来源:AllTermDocs.cs

示例2: TestTermIndex

		/// <summary> Test the term index.</summary>
		private Status.TermIndexStatus TestTermIndex(SegmentInfo info, SegmentReader reader)
		{
			Status.TermIndexStatus status = new Status.TermIndexStatus();
			
			try
			{
				if (infoStream != null)
				{
					infoStream.Write("    test: terms, freq, prox...");
				}
				
				TermEnum termEnum = reader.Terms();
				TermPositions termPositions = reader.TermPositions();
				
				// Used only to count up # deleted docs for this term
				MySegmentTermDocs myTermDocs = new MySegmentTermDocs(reader);
				
				int maxDoc = reader.MaxDoc();
				
				while (termEnum.Next())
				{
					status.termCount++;
					Term term = termEnum.Term();
					int docFreq = termEnum.DocFreq();
					termPositions.Seek(term);
					int lastDoc = - 1;
					int freq0 = 0;
					status.totFreq += docFreq;
					while (termPositions.Next())
					{
						freq0++;
						int doc = termPositions.Doc();
						int freq = termPositions.Freq();
						if (doc <= lastDoc)
						{
							throw new System.SystemException("term " + term + ": doc " + doc + " <= lastDoc " + lastDoc);
						}
						if (doc >= maxDoc)
						{
							throw new System.SystemException("term " + term + ": doc " + doc + " >= maxDoc " + maxDoc);
						}
						
						lastDoc = doc;
						if (freq <= 0)
						{
							throw new System.SystemException("term " + term + ": doc " + doc + ": freq " + freq + " is out of bounds");
						}
						
						int lastPos = - 1;
						status.totPos += freq;
						for (int j = 0; j < freq; j++)
						{
							int pos = termPositions.NextPosition();
							if (pos < - 1)
							{
								throw new System.SystemException("term " + term + ": doc " + doc + ": pos " + pos + " is out of bounds");
							}
							if (pos < lastPos)
							{
								throw new System.SystemException("term " + term + ": doc " + doc + ": pos " + pos + " < lastPos " + lastPos);
							}
						}
					}
					
					// Now count how many deleted docs occurred in
					// this term:
					int delCount;
					if (reader.HasDeletions())
					{
						myTermDocs.Seek(term);
						while (myTermDocs.Next())
						{
						}
						delCount = myTermDocs.delCount;
					}
					else
					{
						delCount = 0;
					}
					
					if (freq0 + delCount != docFreq)
					{
						throw new System.SystemException("term " + term + " docFreq=" + docFreq + " != num docs seen " + freq0 + " + num docs deleted " + delCount);
					}
				}
				
				Msg("OK [" + status.termCount + " terms; " + status.totFreq + " terms/docs pairs; " + status.totPos + " tokens]");
			}
			catch (System.Exception e)
			{
				Msg("ERROR [" + System.Convert.ToString(e.Message) + "]");
				status.error = e;
				if (infoStream != null)
				{
					infoStream.WriteLine(e.StackTrace);
				}
			}
			
			return status;
//.........这里部分代码省略.........
开发者ID:Rationalle,项目名称:ravendb,代码行数:101,代码来源:CheckIndex.cs

示例3: TestFieldNorms

		/// <summary> Test field norms.</summary>
        private Status.FieldNormStatus TestFieldNorms(System.Collections.Generic.ICollection<string> fieldNames, SegmentReader reader)
		{
			Status.FieldNormStatus status = new Status.FieldNormStatus();
			
			try
			{
				// Test Field Norms
				if (infoStream != null)
				{
					infoStream.Write("    test: field norms.........");
				}
				System.Collections.IEnumerator it = fieldNames.GetEnumerator();
				byte[] b = new byte[reader.MaxDoc()];
				while (it.MoveNext())
				{
					System.String fieldName = (System.String) it.Current;
					reader.Norms(fieldName, b, 0);
					++status.totFields;
				}
				
				Msg("OK [" + status.totFields + " fields]");
			}
			catch (System.Exception e)
			{
				Msg("ERROR [" + System.Convert.ToString(e.Message) + "]");
				status.error = e;
				if (infoStream != null)
				{
					infoStream.WriteLine(e.StackTrace);
				}
			}
			
			return status;
		}
开发者ID:Rationalle,项目名称:ravendb,代码行数:35,代码来源:CheckIndex.cs

示例4: GetBytesRefEnumerable

        private IEnumerable<BytesRef> GetBytesRefEnumerable(SegmentReader reader, string field, BinaryDocValuesFieldUpdates fieldUpdates)
        {
            BinaryDocValues currentValues = reader.GetBinaryDocValues(field);
            Bits DocsWithField = reader.GetDocsWithField(field);
            int maxDoc = reader.MaxDoc();
            BinaryDocValuesFieldUpdates.Iterator iter = (BinaryDocValuesFieldUpdates.Iterator)fieldUpdates.GetIterator();
            BytesRef scratch = new BytesRef();
            int updateDoc = iter.NextDoc();

            for (int curDoc = 0; curDoc < maxDoc; ++curDoc)
            {
                if (curDoc == updateDoc) //document has an updated value
                {
                    BytesRef value = (BytesRef)iter.Value(); // either null or updated
                    updateDoc = iter.NextDoc(); //prepare for next round
                    yield return value;
                }
                else
                {   // no update for this document
                    if (currentValues != null && DocsWithField.Get(curDoc))
                    {
                        // only read the current value if the document had a value before
                        currentValues.Get(curDoc, scratch);
                        yield return scratch;
                    }
                    else
                    {
                        yield return null;
                    }
                }
            }
        }
开发者ID:joyanta,项目名称:lucene.net,代码行数:32,代码来源:ReadersAndUpdates.cs

示例5: GetLongEnumerable

        private IEnumerable<long> GetLongEnumerable(SegmentReader reader, string field, NumericDocValuesFieldUpdates fieldUpdates)
        {
            int maxDoc = reader.MaxDoc();
            Bits DocsWithField = reader.GetDocsWithField(field);
            NumericDocValues currentValues = reader.GetNumericDocValues(field);
            NumericDocValuesFieldUpdates.Iterator iter = (NumericDocValuesFieldUpdates.Iterator)fieldUpdates.GetIterator();
            int updateDoc = iter.NextDoc();

            for (int curDoc = 0; curDoc < maxDoc; ++curDoc)
            {
                if (curDoc == updateDoc) //document has an updated value
                {
                    long? value = (long?)(iter.Value()); // either null or updated
                    updateDoc = iter.NextDoc(); //prepare for next round
                    yield return value ?? default(long);
                }
                else
                {   // no update for this document
                    if (currentValues != null && DocsWithField.Get(curDoc))
                    {
                        // only read the current value if the document had a value before
                        yield return currentValues.Get(curDoc);
                    }
                    else
                    {
                        yield return default(long);
                    }
                }
            }
        }
开发者ID:joyanta,项目名称:lucene.net,代码行数:30,代码来源:ReadersAndUpdates.cs

示例6: TestFieldNorms

		/// <summary> Test field norms.</summary>
        private Status.FieldNormStatus TestFieldNorms(ICollection<string> fieldNames, SegmentReader reader)
		{
			Status.FieldNormStatus status = new Status.FieldNormStatus();
			
			try
			{
				// Test Field Norms
				if (infoStream != null)
				{
					infoStream.Write("    test: field norms.........");
				}
				byte[] b = new byte[reader.MaxDoc()];
                foreach(string fieldName in fieldNames)
				{
                    if (reader.HasNorms(fieldName))
                    {
                        reader.Norms(fieldName, b, 0);
                        ++status.totFields;
                    }
				}
				
				Msg("OK [" + status.totFields + " fields]");
			}
			catch (System.Exception e)
			{
				Msg("ERROR [" + System.Convert.ToString(e.Message) + "]");
				status.error = e;
				if (infoStream != null)
				{
					infoStream.WriteLine(e.StackTrace);
				}
			}
			
			return status;
		}
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:36,代码来源:CheckIndex.cs


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