public virtual void UpdateDocument(IEnumerable <IIndexableField> doc, Analyzer analyzer, Term delTerm)
        {
            // LUCENENET: .NET doesn't support asserts in release mode
            if (Lucene.Net.Diagnostics.Debugging.AssertsEnabled)
            {
                TestPoint("DocumentsWriterPerThread addDocument start");
            }
            Debug.Assert(deleteQueue != null);
            docState.doc      = doc;
            docState.analyzer = analyzer;
            docState.docID    = numDocsInRAM;
            if (INFO_VERBOSE && infoStream.IsEnabled("DWPT"))
            {
                infoStream.Message("DWPT", Thread.CurrentThread.Name + " update delTerm=" + delTerm + " docID=" + docState.docID + " seg=" + segmentInfo.Name);
            }
            bool success = false;

            try
            {
                try
                {
                    consumer.ProcessDocument(fieldInfos);
                }
                finally
                {
                    docState.Clear();
                }
                success = true;
            }
            finally
            {
                if (!success)
                {
                    if (!aborting)
                    {
                        // mark document as deleted
                        DeleteDocID(docState.docID);
                        numDocsInRAM++;
                    }
                    else
                    {
                        Abort(filesToDelete);
                    }
                }
            }
            success = false;
            try
            {
                consumer.FinishDocument();
                success = true;
            }
            finally
            {
                if (!success)
                {
                    Abort(filesToDelete);
                }
            }
            FinishDocument(delTerm);
        }
Пример #2
0
        public virtual void UpdateDocument(IEnumerable <IndexableField> doc, Analyzer analyzer, Term delTerm)
        {
            Debug.Assert(TestPoint("DocumentsWriterPerThread addDocument start"));
            Debug.Assert(DeleteQueue != null);
            docState.Doc      = doc;
            docState.Analyzer = analyzer;
            docState.DocID    = numDocsInRAM;
            if (INFO_VERBOSE && InfoStream.IsEnabled("DWPT"))
            {
                InfoStream.Message("DWPT", Thread.CurrentThread.Name + " update delTerm=" + delTerm + " docID=" + docState.DocID + " seg=" + SegmentInfo_Renamed.Name);
            }
            bool success = false;

            try
            {
                try
                {
                    Consumer.ProcessDocument(FieldInfos);
                }
                finally
                {
                    docState.Clear();
                }
                success = true;
            }
            finally
            {
                if (!success)
                {
                    if (!Aborting)
                    {
                        // mark document as deleted
                        DeleteDocID(docState.DocID);
                        numDocsInRAM++;
                    }
                    else
                    {
                        Abort(FilesToDelete);
                    }
                }
            }
            success = false;
            try
            {
                Consumer.FinishDocument();
                success = true;
            }
            finally
            {
                if (!success)
                {
                    Abort(FilesToDelete);
                }
            }
            FinishDocument(delTerm);
        }