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


C# Index.RawPostingList类代码示例

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


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

示例1: AddTerm

        internal override void AddTerm(RawPostingList p0)
        {
            System.Diagnostics.Debug.Assert(docState.TestPoint("FreqProxTermsWriterPerField.addTerm start"));

            FreqProxTermsWriter.PostingList p = (FreqProxTermsWriter.PostingList) p0;

            System.Diagnostics.Debug.Assert(omitTermFreqAndPositions || p.docFreq > 0);

            if (omitTermFreqAndPositions)
            {
                if (docState.docID != p.lastDocID)
                {
                    System.Diagnostics.Debug.Assert(docState.docID > p.lastDocID);
                    termsHashPerField.WriteVInt(0, p.lastDocCode);
                    p.lastDocCode = docState.docID - p.lastDocID;
                    p.lastDocID = docState.docID;
                }
            }
            else
            {
                if (docState.docID != p.lastDocID)
                {
                    System.Diagnostics.Debug.Assert(docState.docID > p.lastDocID);
                    // Term not yet seen in the current doc but previously
                    // seen in other doc(s) since the last flush

                    // Now that we know doc freq for previous doc,
                    // write it & lastDocCode
                    if (1 == p.docFreq)
                        termsHashPerField.WriteVInt(0, p.lastDocCode | 1);
                    else
                    {
                        termsHashPerField.WriteVInt(0, p.lastDocCode);
                        termsHashPerField.WriteVInt(0, p.docFreq);
                    }
                    p.docFreq = 1;
                    p.lastDocCode = (docState.docID - p.lastDocID) << 1;
                    p.lastDocID = docState.docID;
                    WriteProx(p, fieldState.position);
                }
                else
                {
                    p.docFreq++;
                    WriteProx(p, fieldState.position - p.lastPosition);
                }
            }
        }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:47,代码来源:FreqProxTermsWriterPerField.cs

示例2: getPostings

        public void getPostings(RawPostingList[] postings)
        {
            lock (this)
            {
                System.Diagnostics.Debug.Assert(docWriter.writer.TestPoint("TermsHash.getPostings start"));

                System.Diagnostics.Debug.Assert(postingsFreeCount <= postingsFreeList.Length);
                System.Diagnostics.Debug.Assert(postingsFreeCount <= postingsAllocCount, "postingsFreeCount=" + postingsFreeCount + " postingsAllocCount=" + postingsAllocCount);

                int numToCopy;
                if (postingsFreeCount < postings.Length)
                    numToCopy = postingsFreeCount;
                else
                    numToCopy = postings.Length;
                int start = postingsFreeCount - numToCopy;
                System.Diagnostics.Debug.Assert(start >= 0);
                System.Diagnostics.Debug.Assert(start + numToCopy <= postingsFreeList.Length);
                System.Diagnostics.Debug.Assert(numToCopy <= postings.Length);
                System.Array.Copy(postingsFreeList, start, postings, 0, numToCopy);

                // Directly allocate the remainder if any
                if (numToCopy != postings.Length)
                {
                    int extra = postings.Length - numToCopy;
                    int newPostingsAllocCount = postingsAllocCount + extra;

                    consumer.createPostings(postings, numToCopy, extra);
                    System.Diagnostics.Debug.Assert(docWriter.writer.TestPoint("TermsHash.getPostings after create"));
                    postingsAllocCount += extra;

                    if (trackAllocations)
                        docWriter.BytesAllocated(extra * bytesPerPosting);

                    if (newPostingsAllocCount > postingsFreeList.Length)
                        // Pre-allocate the postingsFreeList so it's large
                        // enough to hold all postings we've given out
                        postingsFreeList = new RawPostingList[ArrayUtil.GetNextSize(newPostingsAllocCount)];
                }

                postingsFreeCount -= numToCopy;

                if (trackAllocations)
                    docWriter.BytesUsed(postings.Length * bytesPerPosting);
            }
        }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:45,代码来源:TermsHash.cs

示例3: addTerm

        internal override void addTerm(Token t, RawPostingList p0)
        {
            System.Diagnostics.Debug.Assert(docState.TestPoint("TermVectorsTermsWriterPerField.addTerm start"));

            TermVectorsTermsWriter.PostingList p = (TermVectorsTermsWriter.PostingList)p0;
            p.freq++;

            if (doVectorOffsets)
            {
                int startOffset = fieldState.offset + t.StartOffset();
                int endOffset = fieldState.offset + t.EndOffset();
                termsHashPerField.writeVInt(1, startOffset - p.lastOffset);
                termsHashPerField.writeVInt(1, endOffset - startOffset);
                p.lastOffset = endOffset;
            }

            if (doVectorPositions)
            {
                termsHashPerField.writeVInt(0, fieldState.position - p.lastPosition);
                p.lastPosition = fieldState.position;
            }
        }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:22,代码来源:TermVectorsTermsWriterPerField.cs

示例4: CreatePostings

		internal abstract void  CreatePostings(RawPostingList[] postings, int start, int count);
开发者ID:Rationalle,项目名称:ravendb,代码行数:1,代码来源:TermsHashConsumer.cs

示例5: ShrinkFreePostings

        internal void ShrinkFreePostings(IDictionary<InvertedDocConsumerPerThread, IList<InvertedDocConsumerPerField>> threadsAndFields, SegmentWriteState state)
		{
			
			System.Diagnostics.Debug.Assert(postingsFreeCount == postingsAllocCount, "Thread.currentThread().getName()" + ": postingsFreeCount=" + postingsFreeCount + " postingsAllocCount=" + postingsAllocCount + " consumer=" + consumer);

            int newSize = 1;
			if (newSize != postingsFreeList.Length)
			{
                if (postingsFreeCount > newSize)
                {
                    if (trackAllocations)
                    {
                        docWriter.BytesAllocated(-(postingsFreeCount - newSize) * bytesPerPosting);
                    }
                    postingsFreeCount = newSize;
                    postingsAllocCount = newSize;
                }

				RawPostingList[] newArray = new RawPostingList[newSize];
				Array.Copy(postingsFreeList, 0, newArray, 0, postingsFreeCount);
				postingsFreeList = newArray;
			}
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:23,代码来源:TermsHash.cs

示例6: RehashPostings

		/// <summary>Called when postings hash is too small (> 50%
        /// occupied) or too large (&lt; 20% occupied). 
		/// </summary>
		internal void  RehashPostings(int newSize)
		{
			
			int newMask = newSize - 1;
			
			RawPostingList[] newHash = new RawPostingList[newSize];
			for (int i = 0; i < postingsHashSize; i++)
			{
				RawPostingList p0 = postingsHash[i];
				if (p0 != null)
				{
					int code;
					if (perThread.primary)
					{
						int start = p0.textStart & DocumentsWriter.CHAR_BLOCK_MASK;
						char[] text = charPool.buffers[p0.textStart >> DocumentsWriter.CHAR_BLOCK_SHIFT];
						int pos = start;
						while (text[pos] != 0xffff)
							pos++;
						code = 0;
						while (pos > start)
							code = (code * 31) + text[--pos];
					}
					else
						code = p0.textStart;
					
					int hashPos = code & newMask;
					System.Diagnostics.Debug.Assert(hashPos >= 0);
					if (newHash[hashPos] != null)
					{
						int inc = ((code >> 8) + code) | 1;
						do 
						{
							code += inc;
							hashPos = code & newMask;
						}
						while (newHash[hashPos] != null);
					}
					newHash[hashPos] = p0;
				}
			}
			
			postingsHashMask = newMask;
			postingsHash = newHash;
			postingsHashSize = newSize;
			postingsHashHalfSize = newSize >> 1;
		}
开发者ID:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:50,代码来源:TermsHashPerField.cs

示例7: quickSort

        void quickSort(RawPostingList[] postings, int lo, int hi)
        {
            if (lo >= hi)
                return;
            else if (hi == 1 + lo)
            {
                if (comparePostings(postings[lo], postings[hi]) > 0)
                {
                    RawPostingList tmp = postings[lo];
                    postings[lo] = postings[hi];
                    postings[hi] = tmp;
                }
                return;
            }

            int mid = (int)((uint)(lo + hi) >> 1);

            if (comparePostings(postings[lo], postings[mid]) > 0)
            {
                RawPostingList tmp = postings[lo];
                postings[lo] = postings[mid];
                postings[mid] = tmp;
            }

            if (comparePostings(postings[mid], postings[hi]) > 0)
            {
                RawPostingList tmp = postings[mid];
                postings[mid] = postings[hi];
                postings[hi] = tmp;

                if (comparePostings(postings[lo], postings[mid]) > 0)
                {
                    RawPostingList tmp2 = postings[lo];
                    postings[lo] = postings[mid];
                    postings[mid] = tmp2;
                }
            }

            int left = lo + 1;
            int right = hi - 1;

            if (left >= right)
                return;

            RawPostingList partition = postings[mid];

            for (; ; )
            {
                while (comparePostings(postings[right], partition) > 0)
                    --right;

                while (left < right && comparePostings(postings[left], partition) <= 0)
                    ++left;

                if (left < right)
                {
                    RawPostingList tmp = postings[left];
                    postings[left] = postings[right];
                    postings[right] = tmp;
                    --right;
                }
                else
                {
                    break;
                }
            }

            quickSort(postings, lo, left);
            quickSort(postings, left + 1, hi);
        }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:70,代码来源:TermsHashPerField.cs

示例8: ShrinkFreePostings

		internal void  ShrinkFreePostings(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
		{
			
			System.Diagnostics.Debug.Assert(postingsFreeCount == postingsAllocCount, "Thread.currentThread().getName()" + ": postingsFreeCount=" + postingsFreeCount + " postingsAllocCount=" + postingsAllocCount + " consumer=" + consumer);
			
			int newSize = ArrayUtil.GetShrinkSize(postingsFreeList.Length, postingsAllocCount);
			if (newSize != postingsFreeList.Length)
			{
				RawPostingList[] newArray = new RawPostingList[newSize];
				Array.Copy(postingsFreeList, 0, newArray, 0, postingsFreeCount);
				postingsFreeList = newArray;
			}
		}
开发者ID:Rationalle,项目名称:ravendb,代码行数:13,代码来源:TermsHash.cs

示例9: AddTerm

		internal abstract void  AddTerm(RawPostingList p);
开发者ID:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:1,代码来源:TermsHashConsumerPerField.cs

示例10: QuickSort

		internal void  QuickSort(RawPostingList[] postings, int lo, int hi)
		{
			if (lo >= hi)
				return ;
			else if (hi == 1 + lo)
			{
				if (ComparePostings(postings[lo], postings[hi]) > 0)
				{
					RawPostingList tmp = postings[lo];
					postings[lo] = postings[hi];
					postings[hi] = tmp;
				}
				return ;
			}
			
			int mid = Number.URShift((lo + hi), 1);
			
			if (ComparePostings(postings[lo], postings[mid]) > 0)
			{
				RawPostingList tmp = postings[lo];
				postings[lo] = postings[mid];
				postings[mid] = tmp;
			}
			
			if (ComparePostings(postings[mid], postings[hi]) > 0)
			{
				RawPostingList tmp = postings[mid];
				postings[mid] = postings[hi];
				postings[hi] = tmp;
				
				if (ComparePostings(postings[lo], postings[mid]) > 0)
				{
					RawPostingList tmp2 = postings[lo];
					postings[lo] = postings[mid];
					postings[mid] = tmp2;
				}
			}
			
			int left = lo + 1;
			int right = hi - 1;
			
			if (left >= right)
				return ;
			
			RawPostingList partition = postings[mid];
			
			for (; ; )
			{
				while (ComparePostings(postings[right], partition) > 0)
					--right;
				
				while (left < right && ComparePostings(postings[left], partition) <= 0)
					++left;
				
				if (left < right)
				{
					RawPostingList tmp = postings[left];
					postings[left] = postings[right];
					postings[right] = tmp;
					--right;
				}
				else
				{
					break;
				}
			}
			
			QuickSort(postings, lo, left);
			QuickSort(postings, left + 1, hi);
		}
开发者ID:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:70,代码来源:TermsHashPerField.cs

示例11: InitReader

		public void  InitReader(ByteSliceReader reader, RawPostingList p, int stream)
		{
			System.Diagnostics.Debug.Assert(stream < streamCount);
			int[] ints = intPool.buffers[p.intStart >> DocumentsWriter.INT_BLOCK_SHIFT];
			int upto = p.intStart & DocumentsWriter.INT_BLOCK_MASK;
			reader.Init(bytePool, p.byteStart + stream * ByteBlockPool.FIRST_LEVEL_SIZE, ints[upto + stream]);
		}
开发者ID:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:7,代码来源:TermsHashPerField.cs

示例12: noNullPostings

		private static bool noNullPostings(RawPostingList[] postings, int count, System.String details)
		{
			for (int i = 0; i < count; i++)
				System.Diagnostics.Debug.Assert(postings[i] != null, "postings[" + i + "] of " + count + " is null: " + details);
			return true;
		}
开发者ID:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:6,代码来源:TermsHashPerThread.cs

示例13: shrinkFreePostings

        internal void shrinkFreePostings(IDictionary<object, ICollection<object>> threadsAndFields, DocumentsWriter.FlushState state)
        {
            System.Diagnostics.Debug.Assert(postingsFreeCount == postingsAllocCount, System.Threading.Thread.CurrentThread.Name + ": postingsFreeCount=" + postingsFreeCount + " postingsAllocCount=" + postingsAllocCount + " consumer=" + consumer);

            int newSize = ArrayUtil.GetShrinkSize(postingsFreeList.Length, postingsAllocCount);
            if (newSize != postingsFreeList.Length)
            {
                RawPostingList[] newArray = new RawPostingList[newSize];
                System.Array.Copy(postingsFreeList, 0, newArray, 0, postingsFreeCount);
                postingsFreeList = newArray;
            }
        }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:12,代码来源:TermsHash.cs

示例14: newTerm

 internal abstract void newTerm(Token t, RawPostingList p);
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:1,代码来源:TermsHashConsumerPerField.cs

示例15: NewTerm

 internal override void  NewTerm(RawPostingList p0)
 {
     
     System.Diagnostics.Debug.Assert(docState.TestPoint("TermVectorsTermsWriterPerField.newTerm start"));
     
     TermVectorsTermsWriter.PostingList p = (TermVectorsTermsWriter.PostingList) p0;
     
     p.freq = 1;
     
     if (doVectorOffsets)
     {
         int startOffset = fieldState.offset + offsetAttribute.StartOffset; ;
         int endOffset = fieldState.offset + offsetAttribute.EndOffset;
         
         termsHashPerField.WriteVInt(1, startOffset);
         termsHashPerField.WriteVInt(1, endOffset - startOffset);
         p.lastOffset = endOffset;
     }
     
     if (doVectorPositions)
     {
         termsHashPerField.WriteVInt(0, fieldState.position);
         p.lastPosition = fieldState.position;
     }
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:25,代码来源:TermVectorsTermsWriterPerField.cs


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