Esempio n. 1
0
        public override void Flush(Support.Dictionary <DocFieldConsumerPerThread, IList <DocFieldConsumerPerField> > threadsAndFields, SegmentWriteState state)
        {
            Support.Dictionary <InvertedDocConsumerPerThread, IList <InvertedDocConsumerPerField> >       childThreadsAndFields    = new Support.Dictionary <InvertedDocConsumerPerThread, IList <InvertedDocConsumerPerField> >();
            Support.Dictionary <InvertedDocEndConsumerPerThread, IList <InvertedDocEndConsumerPerField> > endChildThreadsAndFields = new Support.Dictionary <InvertedDocEndConsumerPerThread, IList <InvertedDocEndConsumerPerField> >();

            foreach (KeyValuePair <DocFieldConsumerPerThread, IList <DocFieldConsumerPerField> > entry in new Support.Dictionary <DocFieldConsumerPerThread, IList <DocFieldConsumerPerField> >(threadsAndFields))
            {
                DocInverterPerThread perThread = (DocInverterPerThread)entry.Key;

                List <InvertedDocConsumerPerField>    childFields    = new List <InvertedDocConsumerPerField>();
                List <InvertedDocEndConsumerPerField> endChildFields = new List <InvertedDocEndConsumerPerField>();
                foreach (DocFieldConsumerPerField field in entry.Value)
                {
                    DocInverterPerField perField = (DocInverterPerField)field;
                    childFields.Add(perField.consumer);
                    endChildFields.Add(perField.endConsumer);
                }

                childThreadsAndFields[perThread.consumer]       = childFields;
                endChildThreadsAndFields[perThread.endConsumer] = endChildFields;
            }

            consumer.Flush(childThreadsAndFields, state);
            endConsumer.Flush(endChildThreadsAndFields, state);
        }
		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;
		}
Esempio n. 3
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;
            }
        }
Esempio n. 4
0
        public override void  Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
        {
            System.Collections.IDictionary childThreadsAndFields    = new System.Collections.Hashtable();
            System.Collections.IDictionary endChildThreadsAndFields = new System.Collections.Hashtable();

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

                DocInverterPerThread perThread = (DocInverterPerThread)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   endChildFields = new System.Collections.Hashtable();
                while (fieldsIt.MoveNext())
                {
                    DocInverterPerField perField = (DocInverterPerField)((System.Collections.DictionaryEntry)fieldsIt.Current).Key;
                    childFields[perField.consumer]       = perField.consumer;
                    endChildFields[perField.endConsumer] = perField.endConsumer;
                }

                childThreadsAndFields[perThread.consumer]       = childFields;
                endChildThreadsAndFields[perThread.endConsumer] = endChildFields;
            }

            consumer.Flush(childThreadsAndFields, state);
            endConsumer.Flush(endChildThreadsAndFields, state);
        }
 public DocInverterPerField(DocInverterPerThread perThread, FieldInfo fieldInfo)
 {
     this.perThread   = perThread;
     this.fieldInfo   = fieldInfo;
     docState         = perThread.docState;
     fieldState       = perThread.fieldState;
     this.consumer    = perThread.consumer.AddField(this, fieldInfo);
     this.endConsumer = perThread.endConsumer.AddField(this, fieldInfo);
 }
 public DocInverterPerField(DocInverterPerThread perThread, FieldInfo fieldInfo)
 {
     this.perThread = perThread;
     this.fieldInfo = fieldInfo;
     docState = perThread.docState;
     fieldState = perThread.fieldState;
     this.consumer = perThread.consumer.addField(this, fieldInfo);
     this.endConsumer = perThread.endConsumer.addField(this, fieldInfo);
 }
Esempio n. 7
0
        //internal override void flush(IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> threadsAndFields, DocumentsWriter.FlushState state)
        internal override void flush(IDictionary <object, ICollection <object> > threadsAndFields, DocumentsWriter.FlushState state)
        {
            //IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> childThreadsAndFields = new Dictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>>();
            //IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> endChildThreadsAndFields = new Dictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>>();
            IDictionary <object, ICollection <object> > childThreadsAndFields    = new Dictionary <object, ICollection <object> >();
            IDictionary <object, ICollection <object> > endChildThreadsAndFields = new Dictionary <object, ICollection <object> >();

            //IEnumerator<KeyValuePair<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>>> it = threadsAndFields.GetEnumerator();
            IEnumerator <KeyValuePair <object, ICollection <object> > > it = threadsAndFields.GetEnumerator();

            while (it.MoveNext())
            {
                //KeyValuePair<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> entry = it.Current;
                KeyValuePair <object, ICollection <object> > entry = it.Current;

                DocInverterPerThread perThread = (DocInverterPerThread)entry.Key;

                //ICollection<DocFieldConsumerPerField> fields = entry.Value;
                ICollection <object> fields = entry.Value;
                //IEnumerator<DocFieldConsumerPerField> fieldsIt = fields.GetEnumerator();
                IEnumerator <object> fieldsIt = fields.GetEnumerator();

                //IDictionary<DocFieldConsumerPerField, DocFieldConsumerPerField> childFields = new Dictionary<DocFieldConsumerPerField, DocFieldConsumerPerField>();
                //IDictionary<DocFieldConsumerPerField, DocFieldConsumerPerField> endChildFields = new Dictionary<DocFieldConsumerPerField, DocFieldConsumerPerField>();
                IDictionary <object, object> childFields    = new Dictionary <object, object>();
                IDictionary <object, object> endChildFields = new Dictionary <object, object>();

                while (fieldsIt.MoveNext())
                {
                    DocInverterPerField perField = (DocInverterPerField)fieldsIt.Current;
                    childFields[perField.consumer]       = perField.consumer;
                    endChildFields[perField.endConsumer] = perField.endConsumer;
                }

                childThreadsAndFields[perThread.consumer] = childFields.Keys;
                // create new collection to provide for deletions in NormsWriter
                endChildThreadsAndFields[perThread.endConsumer] = new List <object>(endChildFields.Keys);
            }

            consumer.flush(childThreadsAndFields, state);
            endConsumer.flush(endChildThreadsAndFields, state);
        }
Esempio n. 8
0
 public NormsWriterPerThread(DocInverterPerThread docInverterPerThread, NormsWriter normsWriter)
 {
     this.normsWriter = normsWriter;
     docState         = docInverterPerThread.docState;
 }
Esempio n. 9
0
 public override InvertedDocEndConsumerPerThread AddThread(DocInverterPerThread docInverterPerThread)
 {
     return new NormsWriterPerThread(docInverterPerThread, this);
 }
Esempio n. 10
0
 /// <summary>Add a new thread </summary>
 internal abstract InvertedDocConsumerPerThread AddThread(DocInverterPerThread docInverterPerThread);
Esempio n. 11
0
		internal TermsHashPerThread AddThread(DocInverterPerThread docInverterPerThread, TermsHashPerThread primaryPerThread)
		{
			return new TermsHashPerThread(docInverterPerThread, this, nextTermsHash, primaryPerThread);
		}
 public abstract InvertedDocEndConsumerPerThread AddThread(DocInverterPerThread docInverterPerThread);
Esempio n. 13
0
 public override InvertedDocEndConsumerPerThread AddThread(DocInverterPerThread docInverterPerThread)
 {
     return(new NormsWriterPerThread(docInverterPerThread, this));
 }
Esempio n. 14
0
		internal override InvertedDocConsumerPerThread AddThread(DocInverterPerThread docInverterPerThread)
		{
			return new TermsHashPerThread(docInverterPerThread, this, nextTermsHash, null);
		}
Esempio n. 15
0
 internal TermsHashPerThread AddThread(DocInverterPerThread docInverterPerThread, TermsHashPerThread primaryPerThread)
 {
     return(new TermsHashPerThread(docInverterPerThread, this, nextTermsHash, primaryPerThread));
 }
Esempio n. 16
0
 internal override InvertedDocConsumerPerThread AddThread(DocInverterPerThread docInverterPerThread)
 {
     return(new TermsHashPerThread(docInverterPerThread, this, nextTermsHash, null));
 }
		/// <summary>Add a new thread </summary>
		internal abstract InvertedDocConsumerPerThread AddThread(DocInverterPerThread docInverterPerThread);
		public NormsWriterPerThread(DocInverterPerThread docInverterPerThread, NormsWriter normsWriter)
		{
			this.normsWriter = normsWriter;
			docState = docInverterPerThread.docState;
		}
Esempio n. 19
0
 public abstract InvertedDocEndConsumerPerThread AddThread(DocInverterPerThread docInverterPerThread);