public DocInverterPerThread(DocFieldProcessorPerThread docFieldProcessorPerThread, DocInverter docInverter)
 {
     this.docInverter = docInverter;
     docState = docFieldProcessorPerThread.docState;
     consumer = docInverter.consumer.addThread(this);
     endConsumer = docInverter.endConsumer.addThread(this);
 }
Exemple #2
0
 public DocFieldConsumersPerThread(DocFieldProcessorPerThread docFieldProcessorPerThread, DocFieldConsumers parent, DocFieldConsumerPerThread one, DocFieldConsumerPerThread two)
 {
     this.parent = parent;
     this.one    = one;
     this.two    = two;
     docState    = docFieldProcessorPerThread.docState;
 }
		public DocFieldConsumersPerThread(DocFieldProcessorPerThread docFieldProcessorPerThread, DocFieldConsumers parent, DocFieldConsumerPerThread one, DocFieldConsumerPerThread two)
		{
			this.parent = parent;
			this.one = one;
			this.two = two;
			docState = docFieldProcessorPerThread.docState;
		}
Exemple #4
0
 public DocInverterPerThread(DocFieldProcessorPerThread docFieldProcessorPerThread, DocInverter docInverter)
 {
     this.docInverter = docInverter;
     docState         = docFieldProcessorPerThread.docState;
     consumer         = docInverter.consumer.addThread(this);
     endConsumer      = docInverter.endConsumer.addThread(this);
 }
        internal override void Flush(ICollection <object> threads, DocumentsWriter.FlushState state)
        {
            IDictionary <object, ICollection <object> > childThreadsAndFields = new Dictionary <object, ICollection <object> >();
            IEnumerator <object> it = threads.GetEnumerator();

            while (it.MoveNext())
            {
                DocFieldProcessorPerThread perThread = (DocFieldProcessorPerThread)it.Current;
                childThreadsAndFields[perThread.consumer] = perThread.Fields();
                perThread.trimFields(state);
            }

            consumer.flush(childThreadsAndFields, state);

            // Important to save after asking consumer to flush so
            // consumer can alter the FieldInfo* if necessary.  EG,
            // FreqProxTermsWriter does this with
            // FieldInfo.storePayload.
            fieldInfos.Write(state.directory, state.segmentName + ".fnm");
        }
        public override void Flush(ICollection <DocConsumerPerThread> threads, SegmentWriteState state, IState s)
        {
            var childThreadsAndFields = new HashMap <DocFieldConsumerPerThread, ICollection <DocFieldConsumerPerField> >();

            foreach (DocConsumerPerThread thread in threads)
            {
                DocFieldProcessorPerThread perThread = (DocFieldProcessorPerThread)thread;
                childThreadsAndFields[perThread.consumer] = perThread.Fields();
                perThread.TrimFields(state);
            }
            fieldsWriter.Flush(state, s);
            consumer.Flush(childThreadsAndFields, state, s);

            // Important to save after asking consumer to flush so
            // consumer can alter the FieldInfo* if necessary.  EG,
            // FreqProxTermsWriter does this with
            // FieldInfo.storePayload.
            System.String fileName = state.SegmentFileName(IndexFileNames.FIELD_INFOS_EXTENSION);
            fieldInfos.Write(state.directory, fileName, s);
            state.flushedFiles.Add(fileName);
        }
Exemple #7
0
        public override void  Flush(System.Collections.ICollection threads, SegmentWriteState state)
        {
            System.Collections.IDictionary childThreadsAndFields = new System.Collections.Hashtable();
            System.Collections.IEnumerator it = threads.GetEnumerator();
            while (it.MoveNext())
            {
                DocFieldProcessorPerThread perThread = (DocFieldProcessorPerThread)((System.Collections.DictionaryEntry)it.Current).Key;
                childThreadsAndFields[perThread.consumer] = perThread.Fields();
                perThread.TrimFields(state);
            }
            fieldsWriter.Flush(state);
            consumer.Flush(childThreadsAndFields, state);

            // Important to save after asking consumer to flush so
            // consumer can alter the FieldInfo* if necessary.  EG,
            // FreqProxTermsWriter does this with
            // FieldInfo.storePayload.
            System.String fileName = state.SegmentFileName(IndexFileNames.FIELD_INFOS_EXTENSION);
            fieldInfos.Write(state.directory, fileName);
            SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, fileName);
        }
 internal override DocFieldConsumerPerThread addThread(DocFieldProcessorPerThread docFieldProcessorPerThread)
 {
     return(new StoredFieldsWriterPerThread(docFieldProcessorPerThread, this));
 }
Exemple #9
0
 public DocFieldProcessorPerField(DocFieldProcessorPerThread perThread, FieldInfo fieldInfo)
 {
     this.consumer  = perThread.consumer.AddField(fieldInfo);
     this.fieldInfo = fieldInfo;
 }
Exemple #10
0
 /// <summary>Add a new thread </summary>
 public abstract DocFieldConsumerPerThread AddThread(DocFieldProcessorPerThread docFieldProcessorPerThread);
		public override DocFieldConsumerPerThread AddThread(DocFieldProcessorPerThread docFieldProcessorPerThread)
		{
			return new DocInverterPerThread(docFieldProcessorPerThread, this);
		}
		public override DocFieldConsumerPerThread AddThread(DocFieldProcessorPerThread docFieldProcessorPerThread)
		{
			return new DocFieldConsumersPerThread(docFieldProcessorPerThread, this, one.AddThread(docFieldProcessorPerThread), two.AddThread(docFieldProcessorPerThread));
		}
 public StoredFieldsWriterPerThread(DocFieldProcessorPerThread docFieldProcessorPerThread, StoredFieldsWriter storedFieldsWriter)
 {
     this.storedFieldsWriter = storedFieldsWriter;
     this.docState           = docFieldProcessorPerThread.docState;
     localFieldsWriter       = new FieldsWriter((IndexOutput)null, (IndexOutput)null, storedFieldsWriter.fieldInfos);
 }
 internal override DocFieldConsumerPerThread addThread(DocFieldProcessorPerThread docFieldProcessorPerThread)
 {
     return new StoredFieldsWriterPerThread(docFieldProcessorPerThread, this);
 }
			public PerDoc(DocFieldProcessorPerThread enclosingInstance)
			{
				InitBlock(enclosingInstance);
			}
 public DocFieldProcessorPerField(DocFieldProcessorPerThread perThread, FieldInfo fieldInfo)
 {
     this.consumer = perThread.consumer.AddField(fieldInfo);
     this.fieldInfo = fieldInfo;
 }
 internal override DocFieldConsumerPerThread addThread(DocFieldProcessorPerThread docFieldProcessorPerThread)
 {
     return new DocFieldConsumersPerThread(docFieldProcessorPerThread, this, one.addThread(docFieldProcessorPerThread), two.addThread(docFieldProcessorPerThread));
 }
 public override DocFieldConsumerPerThread AddThread(DocFieldProcessorPerThread docFieldProcessorPerThread)
 {
     return(new DocInverterPerThread(docFieldProcessorPerThread, this));
 }
Exemple #19
0
 internal override DocFieldConsumerPerThread addThread(DocFieldProcessorPerThread docFieldProcessorPerThread)
 {
     return(new DocFieldConsumersPerThread(docFieldProcessorPerThread, this, one.addThread(docFieldProcessorPerThread), two.addThread(docFieldProcessorPerThread)));
 }
 public StoredFieldsWriterPerThread(DocFieldProcessorPerThread docFieldProcessorPerThread, StoredFieldsWriter storedFieldsWriter)
 {
     this.storedFieldsWriter = storedFieldsWriter;
     this.docState = docFieldProcessorPerThread.docState;
     localFieldsWriter = new FieldsWriter((IndexOutput)null, (IndexOutput)null, storedFieldsWriter.fieldInfos);
 }
Exemple #21
0
 /// <summary>Add a new thread </summary>
 public abstract DocFieldConsumerPerThread AddThread(DocFieldProcessorPerThread docFieldProcessorPerThread);
Exemple #22
0
using System.Collections.Generic;

namespace Lucene.Net.Index
{
    internal abstract class DocFieldConsumer
    {

        internal FieldInfos fieldInfos;

        /// <summary>
        /// Called when DocumentsWriter decides to create a new
        /// segment
        /// </summary>
        //internal abstract void flush(/* IDictionary */ IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> threadsAndFields, DocumentsWriter.FlushState state);
        internal abstract void flush(/* IDictionary */ IDictionary<object, ICollection<object>> threadsAndFields, DocumentsWriter.FlushState state);

        /// <summary>
        /// Called when DocumentsWriter decides to close the doc
        /// stores
        /// </summary>
        internal abstract void closeDocStore(DocumentsWriter.FlushState state);

        /// <summary>
        /// Called when an aborting exception is hit
        /// </summary>
        internal abstract void Abort();

        /// <summary>
        /// Add a new thread
        /// </summary>
        internal abstract DocFieldConsumerPerThread addThread(DocFieldProcessorPerThread docFieldProcessorPerThread);

        /// <summary>
        /// Called when DocumentsWriter is using too much RAM.
        /// The consumer should free RAM, if possible, returning
        /// true if any RAM was in fact freed.
        /// </summary>
        internal abstract bool freeRAM();

        internal virtual void setFieldInfos(FieldInfos fieldInfos)
        {
            this.fieldInfos = fieldInfos;
        }
    }
}

			private void  InitBlock(DocFieldProcessorPerThread enclosingInstance)
			{
				this.enclosingInstance = enclosingInstance;
			}
 public PerDoc(DocFieldProcessorPerThread enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Exemple #25
0
 public override DocFieldConsumerPerThread AddThread(DocFieldProcessorPerThread docFieldProcessorPerThread)
 {
     return(new DocFieldConsumersPerThread(docFieldProcessorPerThread, this, one.AddThread(docFieldProcessorPerThread), two.AddThread(docFieldProcessorPerThread)));
 }
 private void  InitBlock(DocFieldProcessorPerThread enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }