Exemplo n.º 1
0
		public TermsHash(DocumentsWriter docWriter, bool trackAllocations, TermsHashConsumer consumer, TermsHash nextTermsHash)
		{
			this.docWriter = docWriter;
			this.consumer = consumer;
			this.nextTermsHash = nextTermsHash;
			this.trackAllocations = trackAllocations;
			
			// Why + 4*POINTER_NUM_BYTE below?
			//   +1: Posting is referenced by postingsFreeList array
			//   +3: Posting is referenced by hash, which
			//       targets 25-50% fill factor; approximate this
			//       as 3X # pointers
			bytesPerPosting = consumer.BytesPerPosting() + 4 * DocumentsWriter.POINTER_NUM_BYTE;
			postingsFreeChunk = (int) (DocumentsWriter.BYTE_BLOCK_SIZE / bytesPerPosting);
		}
Exemplo n.º 2
0
        public TermsHash(DocumentsWriter docWriter, bool trackAllocations, TermsHashConsumer consumer, TermsHash nextTermsHash)
        {
            this.docWriter        = docWriter;
            this.consumer         = consumer;
            this.nextTermsHash    = nextTermsHash;
            this.trackAllocations = trackAllocations;

            // Why + 4*POINTER_NUM_BYTE below?
            //   +1: Posting is referenced by postingsFreeList array
            //   +3: Posting is referenced by hash, which
            //       targets 25-50% fill factor; approximate this
            //       as 3X # pointers
            bytesPerPosting   = consumer.BytesPerPosting() + 4 * DocumentsWriter.POINTER_NUM_BYTE;
            postingsFreeChunk = (int)(DocumentsWriter.BYTE_BLOCK_SIZE / bytesPerPosting);
        }
Exemplo n.º 3
0
        public TermsHash(DocumentsWriterPerThread docWriter, TermsHashConsumer consumer, bool trackAllocations, TermsHash nextTermsHash)
        {
            this.docState         = docWriter.docState;
            this.consumer         = consumer;
            this.trackAllocations = trackAllocations;
            this.nextTermsHash    = nextTermsHash;
            this.bytesUsed        = trackAllocations ? docWriter.bytesUsed : Counter.NewCounter();
            intPool  = new Int32BlockPool(docWriter.intBlockAllocator);
            bytePool = new ByteBlockPool(docWriter.byteBlockAllocator);

            if (nextTermsHash != null)
            {
                // We are primary
                primary      = true;
                termBytePool = bytePool;
                nextTermsHash.termBytePool = bytePool;
            }
            else
            {
                primary = false;
            }
        }
Exemplo n.º 4
0
        public TermsHash(DocumentsWriterPerThread docWriter, TermsHashConsumer consumer, bool trackAllocations, TermsHash nextTermsHash)
        {
            this.DocState = docWriter.docState;
            this.Consumer = consumer;
            this.TrackAllocations = trackAllocations;
            this.NextTermsHash = nextTermsHash;
            this.BytesUsed = trackAllocations ? docWriter.bytesUsed : Counter.NewCounter();
            IntPool = new IntBlockPool(docWriter.intBlockAllocator);
            BytePool = new ByteBlockPool(docWriter.ByteBlockAllocator);

            if (nextTermsHash != null)
            {
                // We are primary
                Primary = true;
                TermBytePool = BytePool;
                nextTermsHash.TermBytePool = BytePool;
            }
            else
            {
                Primary = false;
            }
        }