public TermVectorsTermsWriterPerField(TermsHashPerField termsHashPerField, TermVectorsTermsWriterPerThread perThread, FieldInfo fieldInfo)
		{
			this.termsHashPerField = termsHashPerField;
			this.perThread = perThread;
			this.termsWriter = perThread.termsWriter;
			this.fieldInfo = fieldInfo;
			docState = termsHashPerField.docState;
			fieldState = termsHashPerField.fieldState;
		}
Exemple #2
0
 public TermVectorsTermsWriterPerField(TermsHashPerField termsHashPerField, TermVectorsTermsWriterPerThread perThread, FieldInfo fieldInfo)
 {
     this.termsHashPerField = termsHashPerField;
     this.perThread         = perThread;
     this.termsWriter       = perThread.termsWriter;
     this.fieldInfo         = fieldInfo;
     docState   = termsHashPerField.docState;
     fieldState = termsHashPerField.fieldState;
 }
Exemple #3
0
        public override void Flush(IDictionary <TermsHashConsumerPerThread, ICollection <TermsHashConsumerPerField> > threadsAndFields, SegmentWriteState state)
        {
            lock (this)
            {
                // NOTE: it's possible that all documents seen in this segment
                // hit non-aborting exceptions, in which case we will
                // not have yet init'd the TermVectorsWriter.  This is
                // actually OK (unlike in the stored fields case)
                // because, although IieldInfos.hasVectors() will return
                // true, the TermVectorsReader gracefully handles
                // non-existence of the term vectors files.
                if (tvx != null)
                {
                    if (state.numDocsInStore > 0)
                    {
                        // In case there are some final documents that we
                        // didn't see (because they hit a non-aborting exception):
                        Fill(state.numDocsInStore - docWriter.DocStoreOffset);
                    }

                    tvx.Flush();
                    tvd.Flush();
                    tvf.Flush();
                }

                foreach (var entry in threadsAndFields)
                {
                    foreach (var field in entry.Value)
                    {
                        TermVectorsTermsWriterPerField perField = (TermVectorsTermsWriterPerField)field;
                        perField.termsHashPerField.Reset();
                        perField.ShrinkHash();
                    }

                    TermVectorsTermsWriterPerThread perThread = (TermVectorsTermsWriterPerThread)entry.Key;
                    perThread.termsHashPerThread.Reset(true);
                }
            }
        }