Class CheckIndex
Basic tool and API to check the health of an index and write a new segments file that removes reference to problematic segments.
As this tool checks every byte in the index, on a large index it can take quite a long time to run.
Please make a complete backup of your index before using this to fix your index!
Inheritance
Inherited Members
Namespace: Lucene.Net.Index
Assembly: Lucene.Net.dll
Syntax
public class CheckIndex
Constructors
| Improve this Doc View SourceCheckIndex(Directory)
Create a new Check
Declaration
public CheckIndex(Directory dir)
Parameters
Type | Name | Description |
---|---|---|
Directory | dir |
Properties
| Improve this Doc View SourceCrossCheckTermVectors
If true
, term vectors are compared against postings to
make sure they are the same. This will likely
drastically increase time it takes to run Check
Declaration
public virtual bool CrossCheckTermVectors { get; set; }
Property Value
Type | Description |
---|---|
System. |
InfoStream
Gets or Sets infoStream where messages should go. If null, no
messages are printed. If Infotrue
then more
details are printed.
Declaration
public virtual TextWriter InfoStream { get; set; }
Property Value
Type | Description |
---|---|
System. |
InfoStreamIsVerbose
If true
, prints more details to the Info
Declaration
public virtual bool InfoStreamIsVerbose { get; set; }
Property Value
Type | Description |
---|---|
System. |
Methods
| Improve this Doc View SourceDoCheckIndex()
Returns a Check
As this method checks every byte in the index, on a large index it can take quite a long time to run.
WARNING: make sure you only call this when the index is not opened by any writer.
Declaration
public virtual CheckIndex.Status DoCheckIndex()
Returns
Type | Description |
---|---|
Check |
DoCheckIndex(IList<String>)
Returns a Check
Declaration
public virtual CheckIndex.Status DoCheckIndex(IList<string> onlySegments)
Parameters
Type | Name | Description |
---|---|---|
System. |
onlySegments | list of specific segment names to check As this method checks every byte in the specified segments, on a large index it can take quite a long time to run. WARNING: make sure you only call this when the index is not opened by any writer. |
Returns
Type | Description |
---|---|
Check |
FixIndex(CheckIndex.Status)
Repairs the index using previously returned result
from Do
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.
Declaration
public virtual void FixIndex(CheckIndex.Status result)
Parameters
Type | Name | Description |
---|---|---|
Check |
result |
FlushInfoStream()
Declaration
public virtual void FlushInfoStream()
Main(String[])
Declaration
[STAThread]
public static void Main(string[] args)
Parameters
Type | Name | Description |
---|---|---|
System. |
args |
TestDocValues(AtomicReader, TextWriter)
Test docvalues.
Declaration
public static CheckIndex.Status.DocValuesStatus TestDocValues(AtomicReader reader, TextWriter infoStream)
Parameters
Type | Name | Description |
---|---|---|
Atomic |
reader | |
System. |
infoStream |
Returns
Type | Description |
---|---|
Check |
TestFieldNorms(AtomicReader, TextWriter)
Test field norms.
Declaration
public static CheckIndex.Status.FieldNormStatus TestFieldNorms(AtomicReader reader, TextWriter infoStream)
Parameters
Type | Name | Description |
---|---|---|
Atomic |
reader | |
System. |
infoStream |
Returns
Type | Description |
---|---|
Check |
TestPostings(AtomicReader, TextWriter)
Test the term index.
Declaration
public static CheckIndex.Status.TermIndexStatus TestPostings(AtomicReader reader, TextWriter infoStream)
Parameters
Type | Name | Description |
---|---|---|
Atomic |
reader | |
System. |
infoStream |
Returns
Type | Description |
---|---|
Check |
TestPostings(AtomicReader, TextWriter, Boolean)
Test the term index.
Declaration
public static CheckIndex.Status.TermIndexStatus TestPostings(AtomicReader reader, TextWriter infoStream, bool verbose)
Parameters
Type | Name | Description |
---|---|---|
Atomic |
reader | |
System. |
infoStream | |
System. |
verbose |
Returns
Type | Description |
---|---|
Check |
TestStoredFields(AtomicReader, TextWriter)
Test stored fields.
Declaration
public static CheckIndex.Status.StoredFieldStatus TestStoredFields(AtomicReader reader, TextWriter infoStream)
Parameters
Type | Name | Description |
---|---|---|
Atomic |
reader | |
System. |
infoStream |
Returns
Type | Description |
---|---|
Check |
TestTermVectors(AtomicReader, TextWriter)
Test term vectors.
Declaration
public static CheckIndex.Status.TermVectorStatus TestTermVectors(AtomicReader reader, TextWriter infoStream)
Parameters
Type | Name | Description |
---|---|---|
Atomic |
reader | |
System. |
infoStream |
Returns
Type | Description |
---|---|
Check |
TestTermVectors(AtomicReader, TextWriter, Boolean, Boolean)
Test term vectors.
Declaration
public static CheckIndex.Status.TermVectorStatus TestTermVectors(AtomicReader reader, TextWriter infoStream, bool verbose, bool crossCheckTermVectors)
Parameters
Type | Name | Description |
---|---|---|
Atomic |
reader | |
System. |
infoStream | |
System. |
verbose | |
System. |
crossCheckTermVectors |
Returns
Type | Description |
---|---|
Check |