Lucene.Net.Index.DocumentsWriter.SetInfoStream C# (CSharp) Method

SetInfoStream() private method

If non-null, various details of indexing are printed here.
private SetInfoStream ( System infoStream ) : void
infoStream System
return void
		internal void  SetInfoStream(System.IO.StreamWriter infoStream)
		{
			lock (this)
			{
				this.infoStream = infoStream;
				for (int i = 0; i < threadStates.Length; i++)
					threadStates[i].docState.infoStream = infoStream;
			}
		}
		

Usage Example

        private void Init(Directory d, Analyzer a, bool create, bool closeDir, IndexDeletionPolicy deletionPolicy, bool autoCommit, int maxFieldLength)
        {
            this.closeDir = closeDir;
            directory = d;
            analyzer = a;
            SetMessageID(defaultInfoStream);
            this.maxFieldLength = maxFieldLength;

            if (create)
            {
                // Clear the write lock in case it's leftover:
                directory.ClearLock(WRITE_LOCK_NAME);
            }

            Lock writeLock = directory.MakeLock(WRITE_LOCK_NAME);
            if (!writeLock.Obtain(writeLockTimeout))
            // obtain write lock
            {
                throw new LockObtainFailedException("Index locked for write: " + writeLock);
            }
            this.writeLock = writeLock; // save it

            try
            {
                if (create)
                {
                    // Try to read first.  This is to allow create
                    // against an index that's currently open for
                    // searching.  In this case we write the next
                    // segments_N file with no segments:
                    try
                    {
                        segmentInfos.Read(directory);
                        segmentInfos.Clear();
                    }
                    catch (System.IO.IOException)
                    {
                        // Likely this means it's a fresh directory
                    }
                    segmentInfos.Commit(directory);
                }
                else
                {
                    segmentInfos.Read(directory);

                    // We assume that this segments_N was previously
                    // properly sync'd:
                    for (int i = 0; i < segmentInfos.Count; i++)
                    {
                        SegmentInfo info = segmentInfos.Info(i);
                        List<string> files = info.Files();
                        for (int j = 0; j < files.Count; j++)
                            synced[files[j]] = files[j];
                    }
                }

                this.autoCommit = autoCommit;
                SetRollbackSegmentInfos(segmentInfos);

                docWriter = new DocumentsWriter(directory, this);
                docWriter.SetInfoStream(infoStream);
                docWriter.SetMaxFieldLength(maxFieldLength);

                // Default deleter (for backwards compatibility) is
                // KeepOnlyLastCommitDeleter:
                deleter = new IndexFileDeleter(directory, deletionPolicy == null ? new KeepOnlyLastCommitDeletionPolicy() : deletionPolicy, segmentInfos, infoStream, docWriter);

                PushMaxBufferedDocs();

                if (infoStream != null)
                {
                    Message("init: create=" + create);
                    MessageState();
                }
            }
            catch (System.IO.IOException e)
            {
                this.writeLock.Release();
                this.writeLock = null;
                throw e;
            }
        }
All Usage Examples Of Lucene.Net.Index.DocumentsWriter::SetInfoStream