Lucene.Net.Index.CheckIndex.FixIndex C# (CSharp) Method

FixIndex() public method

Repairs the index using previously returned result from CheckIndex. Note that this does not remove any of the unreferenced files after it's done; you must separately open an IndexWriter, which deletes unreferenced files when it's created.

WARNING: this writes a new segments file into the index, effectively removing all documents in broken segments from the index. BE CAREFUL.

WARNING: Make sure you only call this when the index is not opened by any writer.

public FixIndex ( Status result ) : void
result Status
return void
		public virtual void  FixIndex(Status result)
		{
			if (result.partial)
				throw new System.ArgumentException("can only fix an index that was fully checked (this status checked a subset of segments)");
			result.newSegments.Commit(result.dir);
		}
		

Usage Example

Example #1
0
        public static bool Check(Directory dir, bool doFix, System.Collections.IList onlySegments)
        {
            CheckIndex checker = new CheckIndex(dir);
            Status     status  = checker.CheckIndex_Renamed_Method(onlySegments);

            if (doFix && !status.clean)
            {
                checker.FixIndex(status);
            }

            return(status.clean);
        }
All Usage Examples Of Lucene.Net.Index.CheckIndex::FixIndex