Beispiel #1
0
        public override void  Flush(System.Collections.IDictionary 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.GetDocStoreOffset());
                    }

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

                System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
                while (it.MoveNext())
                {
                    System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry)it.Current;
                    System.Collections.IEnumerator     it2   = ((System.Collections.ICollection)entry.Value).GetEnumerator();
                    while (it2.MoveNext())
                    {
                        TermVectorsTermsWriterPerField perField = (TermVectorsTermsWriterPerField)((System.Collections.DictionaryEntry)it2.Current).Key;
                        perField.termsHashPerField.Reset();
                        perField.ShrinkHash();
                    }

                    TermVectorsTermsWriterPerThread perThread = (TermVectorsTermsWriterPerThread)entry.Key;
                    perThread.termsHashPerThread.Reset(true);
                }
            }
        }
Beispiel #2
0
 internal void  Flush()
 {
     indexStream.Flush();
     fieldsStream.Flush();
 }