예제 #1
0
        public TermsHashPerField(DocInverterPerField docInverterPerField, TermsHashPerThread perThread, TermsHashPerThread nextPerThread, FieldInfo fieldInfo)
        {
            InitBlock();
            this.perThread = perThread;

            intPool    = perThread.intPool;
            charPool   = perThread.charPool;
            bytePool   = perThread.bytePool;
            docState   = perThread.docState;
            fieldState = docInverterPerField.fieldState;

            // Sorter requires the char pool.
            _sorter = new Sorter <RawPostingList, PostingComparer>(new PostingComparer(this));

            this.consumer  = perThread.consumer.AddField(this, fieldInfo);
            streamCount    = consumer.GetStreamCount();
            numPostingInt  = 2 * streamCount;
            this.fieldInfo = fieldInfo;

            if (nextPerThread != null)
            {
                nextPerField = (TermsHashPerField)nextPerThread.AddField(docInverterPerField, fieldInfo);
            }
            else
            {
                nextPerField = null;
            }
        }
예제 #2
0
        public TermsHashPerThread(DocInverterPerThread docInverterPerThread, TermsHash termsHash, TermsHash nextTermsHash, TermsHashPerThread primaryPerThread)
        {
            docState = docInverterPerThread.docState;

            this.termsHash = termsHash;
            this.consumer  = termsHash.consumer.AddThread(this);

            if (nextTermsHash != null)
            {
                // We are primary
                charPool = new CharBlockPool(termsHash.docWriter);
                primary  = true;
            }
            else
            {
                charPool = primaryPerThread.charPool;
                primary  = false;
            }

            intPool  = new IntBlockPool(termsHash.docWriter, termsHash.trackAllocations);
            bytePool = new ByteBlockPool(termsHash.docWriter.byteBlockAllocator, termsHash.trackAllocations);

            if (nextTermsHash != null)
            {
                nextPerThread = nextTermsHash.AddThread(docInverterPerThread, this);
            }
            else
            {
                nextPerThread = null;
            }
        }
		public TermsHashPerThread(DocInverterPerThread docInverterPerThread, TermsHash termsHash, TermsHash nextTermsHash, TermsHashPerThread primaryPerThread)
		{
			docState = docInverterPerThread.docState;
			
			this.termsHash = termsHash;
			this.consumer = termsHash.consumer.AddThread(this);
			
			if (nextTermsHash != null)
			{
				// We are primary
				charPool = new CharBlockPool(termsHash.docWriter);
				primary = true;
			}
			else
			{
				charPool = primaryPerThread.charPool;
				primary = false;
			}
			
			intPool = new IntBlockPool(termsHash.docWriter, termsHash.trackAllocations);
			bytePool = new ByteBlockPool(termsHash.docWriter.byteBlockAllocator, termsHash.trackAllocations);
			
			if (nextTermsHash != null)
				nextPerThread = nextTermsHash.AddThread(docInverterPerThread, this);
			else
				nextPerThread = null;
		}
 public TermsHashPerField(DocInverterPerField docInverterPerField, TermsHashPerThread perThread, TermsHashPerThread nextPerThread, FieldInfo fieldInfo)
 {
     this.perThread = perThread;
     intPool = perThread.intPool;
     charPool = perThread.charPool;
     bytePool = perThread.bytePool;
     docState = perThread.docState;
     fieldState = docInverterPerField.fieldState;
     this.consumer = perThread.consumer.addField(this, fieldInfo);
     streamCount = consumer.getStreamCount();
     numPostingInt = 2 * streamCount;
     this.fieldInfo = fieldInfo;
     if (nextPerThread != null)
         nextPerField = (TermsHashPerField)nextPerThread.addField(docInverterPerField, fieldInfo);
     else
         nextPerField = null;
 }
 public TermsHashPerField(DocInverterPerField docInverterPerField, TermsHashPerThread perThread, TermsHashPerThread nextPerThread, FieldInfo fieldInfo)
 {
     this.perThread = perThread;
     intPool        = perThread.intPool;
     charPool       = perThread.charPool;
     bytePool       = perThread.bytePool;
     docState       = perThread.docState;
     fieldState     = docInverterPerField.fieldState;
     this.consumer  = perThread.consumer.addField(this, fieldInfo);
     streamCount    = consumer.getStreamCount();
     numPostingInt  = 2 * streamCount;
     this.fieldInfo = fieldInfo;
     if (nextPerThread != null)
     {
         nextPerField = (TermsHashPerField)nextPerThread.addField(docInverterPerField, fieldInfo);
     }
     else
     {
         nextPerField = null;
     }
 }
 public TermVectorsTermsWriterPerThread(TermsHashPerThread termsHashPerThread, TermVectorsTermsWriter termsWriter)
 {
     this.termsWriter        = termsWriter;
     this.termsHashPerThread = termsHashPerThread;
     docState = termsHashPerThread.docState;
 }
 public FreqProxTermsWriterPerThread(TermsHashPerThread perThread)
 {
     docState           = perThread.docState;
     termsHashPerThread = perThread;
 }
예제 #8
0
		internal TermsHashPerThread AddThread(DocInverterPerThread docInverterPerThread, TermsHashPerThread primaryPerThread)
		{
			return new TermsHashPerThread(docInverterPerThread, this, nextTermsHash, primaryPerThread);
		}
예제 #9
0
 internal TermsHashPerThread AddThread(DocInverterPerThread docInverterPerThread, TermsHashPerThread primaryPerThread)
 {
     return(new TermsHashPerThread(docInverterPerThread, this, nextTermsHash, primaryPerThread));
 }
예제 #10
0
		public override TermsHashConsumerPerThread AddThread(TermsHashPerThread termsHashPerThread)
		{
			return new TermVectorsTermsWriterPerThread(termsHashPerThread, this);
		}
예제 #11
0
 public override TermsHashConsumerPerThread AddThread(TermsHashPerThread termsHashPerThread)
 {
     return(new TermVectorsTermsWriterPerThread(termsHashPerThread, this));
 }
 public TermVectorsTermsWriterPerThread(TermsHashPerThread termsHashPerThread, TermVectorsTermsWriter termsWriter)
 {
     this.termsWriter = termsWriter;
     this.termsHashPerThread = termsHashPerThread;
     docState = termsHashPerThread.docState;
 }
 internal override TermsHashConsumerPerThread addThread(TermsHashPerThread perThread)
 {
     return new FreqProxTermsWriterPerThread(perThread);
 }
		public FreqProxTermsWriterPerThread(TermsHashPerThread perThread)
		{
			docState = perThread.docState;
			termsHashPerThread = perThread;
		}
예제 #15
0
        internal override void  Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
        {
            lock (this)
            {
                System.Collections.IDictionary childThreadsAndFields = new System.Collections.Hashtable();
                System.Collections.IDictionary nextThreadsAndFields;

                if (nextTermsHash != null)
                {
                    nextThreadsAndFields = new System.Collections.Hashtable();
                }
                else
                {
                    nextThreadsAndFields = null;
                }

                System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
                while (it.MoveNext())
                {
                    System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry)it.Current;

                    TermsHashPerThread perThread = (TermsHashPerThread)entry.Key;

                    System.Collections.ICollection fields = (System.Collections.ICollection)entry.Value;

                    System.Collections.IEnumerator fieldsIt    = fields.GetEnumerator();
                    System.Collections.Hashtable   childFields = new System.Collections.Hashtable();
                    System.Collections.Hashtable   nextChildFields;

                    if (nextTermsHash != null)
                    {
                        nextChildFields = new System.Collections.Hashtable();
                    }
                    else
                    {
                        nextChildFields = null;
                    }

                    while (fieldsIt.MoveNext())
                    {
                        TermsHashPerField perField = (TermsHashPerField)((System.Collections.DictionaryEntry)fieldsIt.Current).Key;
                        childFields[perField.consumer] = perField.consumer;
                        if (nextTermsHash != null)
                        {
                            nextChildFields[perField.nextPerField] = perField.nextPerField;
                        }
                    }

                    childThreadsAndFields[perThread.consumer] = childFields;
                    if (nextTermsHash != null)
                    {
                        nextThreadsAndFields[perThread.nextPerThread] = nextChildFields;
                    }
                }

                consumer.Flush(childThreadsAndFields, state);

                ShrinkFreePostings(threadsAndFields, state);

                if (nextTermsHash != null)
                {
                    nextTermsHash.Flush(nextThreadsAndFields, state);
                }
            }
        }
예제 #16
0
        internal override void flush(IDictionary <object, ICollection <object> > threadsAndFields, DocumentsWriter.FlushState state)
        {
            lock (this)
            {
                IDictionary <object, object> childThreadsAndFields = new Dictionary <object, object>();
                IDictionary <object, ICollection <object> > nextThreadsAndFields;

                if (nextTermsHash != null)
                {
                    nextThreadsAndFields = new Dictionary <object, ICollection <object> >();
                }
                else
                {
                    nextThreadsAndFields = null;
                }

                IEnumerator <KeyValuePair <object, ICollection <object> > > it = threadsAndFields.GetEnumerator();
                while (it.MoveNext())
                {
                    KeyValuePair <object, ICollection <object> > entry = it.Current;

                    TermsHashPerThread perThread = (TermsHashPerThread)entry.Key;

                    ICollection <object> fields = entry.Value;

                    IEnumerator <object>         fieldsIt    = fields.GetEnumerator();
                    IDictionary <object, object> childFields = new Dictionary <object, object>();
                    IDictionary <object, object> nextChildFields;

                    if (nextTermsHash != null)
                    {
                        nextChildFields = new Dictionary <object, object>();
                    }
                    else
                    {
                        nextChildFields = null;
                    }

                    while (fieldsIt.MoveNext())
                    {
                        TermsHashPerField perField = (TermsHashPerField)fieldsIt.Current;
                        childFields[perField.consumer] = perField.consumer;
                        if (nextTermsHash != null)
                        {
                            nextChildFields[perField.nextPerField] = perField.nextPerField;
                        }
                    }

                    childThreadsAndFields[perThread.consumer] = childFields.Keys;
                    if (nextTermsHash != null)
                    {
                        nextThreadsAndFields[perThread.nextPerThread] = nextChildFields.Keys;
                    }
                }

                consumer.flush(childThreadsAndFields, state);

                shrinkFreePostings(threadsAndFields, state);

                if (nextTermsHash != null)
                {
                    nextTermsHash.flush(nextThreadsAndFields, state);
                }
            }
        }
 internal override TermsHashConsumerPerThread addThread(TermsHashPerThread perThread)
 {
     return(new FreqProxTermsWriterPerThread(perThread));
 }
 internal abstract TermsHashConsumerPerThread addThread(TermsHashPerThread perThread);
예제 #19
0
 public abstract TermsHashConsumerPerThread AddThread(TermsHashPerThread perThread);
예제 #20
0
		public abstract TermsHashConsumerPerThread AddThread(TermsHashPerThread perThread);
예제 #21
0
 public override TermsHashConsumerPerThread AddThread(TermsHashPerThread perThread)
 {
     return(new FreqProxTermsWriterPerThread(perThread));
 }
예제 #22
0
        internal override void  Flush(IDictionary <InvertedDocConsumerPerThread, ICollection <InvertedDocConsumerPerField> > threadsAndFields, SegmentWriteState state)
        {
            lock (this)
            {
                var childThreadsAndFields = new Dictionary <TermsHashConsumerPerThread, ICollection <TermsHashConsumerPerField> >();
                Dictionary <InvertedDocConsumerPerThread, ICollection <InvertedDocConsumerPerField> > nextThreadsAndFields;

                if (nextTermsHash != null)
                {
                    nextThreadsAndFields = new Dictionary <InvertedDocConsumerPerThread, ICollection <InvertedDocConsumerPerField> >();
                }
                else
                {
                    nextThreadsAndFields = null;
                }

                foreach (var entry in threadsAndFields)
                {
                    TermsHashPerThread perThread = (TermsHashPerThread)entry.Key;

                    ICollection <InvertedDocConsumerPerField> fields = entry.Value;

                    var fieldsIt = fields.GetEnumerator();
                    ICollection <TermsHashConsumerPerField>   childFields = new HashSet <TermsHashConsumerPerField>();
                    ICollection <InvertedDocConsumerPerField> nextChildFields;

                    if (nextTermsHash != null)
                    {
                        nextChildFields = new HashSet <InvertedDocConsumerPerField>();
                    }
                    else
                    {
                        nextChildFields = null;
                    }

                    while (fieldsIt.MoveNext())
                    {
                        TermsHashPerField perField = (TermsHashPerField)fieldsIt.Current;
                        childFields.Add(perField.consumer);
                        if (nextTermsHash != null)
                        {
                            nextChildFields.Add(perField.nextPerField);
                        }
                    }

                    childThreadsAndFields[perThread.consumer] = childFields;
                    if (nextTermsHash != null)
                    {
                        nextThreadsAndFields[perThread.nextPerThread] = nextChildFields;
                    }
                }

                consumer.Flush(childThreadsAndFields, state);

                ShrinkFreePostings(threadsAndFields, state);

                if (nextTermsHash != null)
                {
                    nextTermsHash.Flush(nextThreadsAndFields, state);
                }
            }
        }
		public override TermsHashConsumerPerThread AddThread(TermsHashPerThread perThread)
		{
			return new FreqProxTermsWriterPerThread(perThread);
		}
 internal abstract TermsHashConsumerPerThread addThread(TermsHashPerThread perThread);