jruby/docs BETA
Navigation
org.apache.lucene.index 131
C AutomatonTermsEnum
C BaseCompositeReader
C BaseTermsEnum
C BinaryDocValues
C ByteVectorValues
C CheckIndex
C CodecReader
C CompositeReader
C CompositeReaderContext
C ConcurrentMergeScheduler
C CorruptIndexException
C DirectoryReader
C DocIDMerger
C DocValues
E DocValuesSkipIndexType
C DocValuesSkipper
E DocValuesType
C DocsWithFieldSet
C EmptyDocValuesProducer
C ExitableDirectoryReader
C FieldInfo
C FieldInfos
C FieldInvertState
C Fields
C FilterBinaryDocValues
C FilterCodecReader
C FilterDirectoryReader
C FilterLeafReader
C FilterMergePolicy
C FilterNumericDocValues
C FilterSortedDocValues
C FilterSortedNumericDocValues
C FilterSortedSetDocValues
C FilteredTermsEnum
C FloatVectorValues
C FreqAndNormBuffer
C Impacts
C ImpactsEnum
I ImpactsSource
C IndexCommit
C IndexDeletionPolicy
C IndexFileNames
C IndexFormatTooNewException
C IndexFormatTooOldException
C IndexNotFoundException
E IndexOptions
C IndexReader
C IndexReaderContext
I IndexSorter
C IndexUpgrader
C IndexWriter
C IndexWriterConfig
I IndexWriterEventListener
I IndexableField
I IndexableFieldType
C KeepLastNCommitsDeletionPolicy
C KeepOnlyLastCommitDeletionPolicy
C KnnVectorValues
C LeafReader
C LeafReaderContext
C LiveIndexWriterConfig
C LogByteSizeMergePolicy
C LogDocMergePolicy
C LogMergePolicy
C MappedMultiFields
C MergePolicy
C MergeRateLimiter
C MergeScheduler
C MergeState
E MergeTrigger
C MultiBits
C MultiDocValues
C MultiFields
C MultiLeafReader
C MultiPostingsEnum
C MultiReader
C MultiTerms
C MultiTermsEnum
C NoDeletionPolicy
C NoMergePolicy
C NoMergeScheduler
C NumericDocValues
C OneMergeWrappingMergePolicy
C OrdTermState
C OrdinalMap
C ParallelCompositeReader
C ParallelLeafReader
C PersistentSnapshotDeletionPolicy
C PointValues
C PostingsEnum
C PrefixCodedTerms
I QueryTimeout
C QueryTimeoutImpl
C ReaderManager
C ReaderUtil
C SegmentCommitInfo
C SegmentInfo
C SegmentInfos
C SegmentOrder
C SegmentReadState
C SegmentReader
C SegmentWriteState
C SerialMergeScheduler
C SimpleMergedSegmentWarmer
C SingleTermsEnum
C SlowCodecReaderWrapper
C SlowImpactsEnum
C SnapshotDeletionPolicy
C SoftDeletesDirectoryReaderWrapper
C SoftDeletesRetentionMergePolicy
C SortFieldProvider
C SortedDocValues
C SortedNumericDocValues
C SortedSetDocValues
C Sorter
C SortingCodecReader
C StandardDirectoryReader
C StoredFieldVisitor
C StoredFields
C Term
C TermState
C TermStates
C TermVectors
C Terms
C TermsEnum
C TieredMergePolicy
I TwoPhaseCommit
C TwoPhaseCommitTool
C UpgradeIndexMergePolicy
E VectorEncoding
E VectorSimilarityFunction
CheckIndex — members 30
C new(dir)
C new(dir, write_lock)
M asserts_on() boolean
M check_index() Status
M check_index(only_segments) Status
M check_index(only_segments, executor_service) Status
C close()
M do_check(opts) int
C exorcise_index(result)
M fail_fast() boolean
C fail_fast=(v)
C info_stream=(out)
M level() int
C level=(v)
C main(args)
M parse_options(args) Options
C set_info_stream(out, verbose)
M test_doc_values(reader, info_stream, fail_fast) DocValuesStatus
M test_field_infos(reader, info_stream, fail_fast) FieldInfoStatus
M test_field_norms(reader, info_stream, fail_fast) FieldNormStatus
M test_live_docs(reader, info_stream, fail_fast) LiveDocStatus
M test_points(reader, info_stream, fail_fast) PointsStatus
M test_postings(reader, info_stream) TermIndexStatus
M test_postings(reader, info_stream, verbose, level, fail_fast) TermIndexStatus
M test_sort(reader, sort, info_stream, fail_fast) IndexSortStatus
M test_stored_fields(reader, info_stream, fail_fast) StoredFieldStatus
M test_term_vectors(reader, info_stream) TermVectorStatus
M test_term_vectors(reader, info_stream, verbose, level, fail_fast) TermVectorStatus
M test_vectors(reader, info_stream, fail_fast) VectorValuesStatus
C thread_count=(tc)

org.apache.lucene.index.CheckIndex

class final implements Closeable 30 members

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.

Constructors

new

new ( Directory dir )
Java: <init>(org.apache.lucene.store.Directory dir)

Create a new CheckIndex on the directory.

new

new ( Directory dir, Lock write_lock )
Java: <init>(org.apache.lucene.store.Directory dir, org.apache.lucene.store.Lock writeLock)

Expert: create a directory with the specified lock. This should really not be used except for unit tests!!!! It exists only to support special tests (such as TestIndexWriterExceptions*), that would otherwise be more complicated to debug if they had to close the writer for each check.

Class Methods

asserts_on

boolean asserts_on ( )
Java: assertsOn()

Check whether asserts are enabled or not.

Returns: true iff asserts are enabled

main

main ( String[] args )
Java: main(String[] args)

Command-line interface to check and exorcise corrupt segments from an index.

Run it like this:

java -ea:org.apache.lucene... org.apache.lucene.index.CheckIndex pathToIndex [-exorcise] [-verbose] [-segment X] [-segment Y]
  • -exorcise: actually write a new segments_N file, removing any problematic segments. *LOSES DATA*
  • -segment X: only check the specified segment(s). This can be specified multiple times, to check more than one segment: -segment _2 * -segment _a. You can't use this with the -exorcise option.

WARNING: -exorcise should only be used on an emergency basis as it will cause documents (perhaps many) to be permanently removed from the index. Always make a backup copy of your index before running this! Do not run this tool on an index that is actively being written to. You have been warned!

Run without -exorcise, this tool will open the index, report version information and report any exceptions it hits and what action it would take if -exorcise were specified. With -exorcise, this tool will remove any segments that have issues and write a new segments_N file. This means all documents contained in the affected segments will be removed.

This tool exits with exit code 1 if the index cannot be opened or has any corruption, else 0.

parse_options

CheckIndex.Options parse_options ( String[] args )
Java: parseOptions(String[] args)

Parse command line args into fields

nametypedescription
argsString[]The command line arguments

Returns: An Options struct

Throws

IllegalArgumentException if any of the CLI args are invalid

test_doc_values

CheckIndex.Status.DocValuesStatus test_doc_values ( CodecReader reader, PrintStream info_stream, boolean fail_fast )
Java: testDocValues(org.apache.lucene.index.CodecReader reader, java.io.PrintStream infoStream, boolean failFast)

Test docvalues.

test_field_infos

CheckIndex.Status.FieldInfoStatus test_field_infos ( CodecReader reader, PrintStream info_stream, boolean fail_fast )
Java: testFieldInfos(org.apache.lucene.index.CodecReader reader, java.io.PrintStream infoStream, boolean failFast)

Test field infos.

test_field_norms

CheckIndex.Status.FieldNormStatus test_field_norms ( CodecReader reader, PrintStream info_stream, boolean fail_fast )
Java: testFieldNorms(org.apache.lucene.index.CodecReader reader, java.io.PrintStream infoStream, boolean failFast)

Test field norms.

test_live_docs

CheckIndex.Status.LiveDocStatus test_live_docs ( CodecReader reader, PrintStream info_stream, boolean fail_fast )
Java: testLiveDocs(org.apache.lucene.index.CodecReader reader, java.io.PrintStream infoStream, boolean failFast)

Test live docs.

test_points

CheckIndex.Status.PointsStatus test_points ( CodecReader reader, PrintStream info_stream, boolean fail_fast )
Java: testPoints(org.apache.lucene.index.CodecReader reader, java.io.PrintStream infoStream, boolean failFast)

Test the points index.

test_postings

CheckIndex.Status.TermIndexStatus test_postings ( CodecReader reader, PrintStream info_stream )
Java: testPostings(org.apache.lucene.index.CodecReader reader, java.io.PrintStream infoStream)

Test the term index.

test_postings

CheckIndex.Status.TermIndexStatus test_postings ( CodecReader reader, PrintStream info_stream, boolean verbose, int level, boolean fail_fast )
Java: testPostings(org.apache.lucene.index.CodecReader reader, java.io.PrintStream infoStream, boolean verbose, int level, boolean failFast)

Test the term index.

test_sort

CheckIndex.Status.IndexSortStatus test_sort ( CodecReader reader, Sort sort, PrintStream info_stream, boolean fail_fast )
Java: testSort(org.apache.lucene.index.CodecReader reader, org.apache.lucene.search.Sort sort, java.io.PrintStream infoStream, boolean failFast)

Tests index sort order.

test_stored_fields

CheckIndex.Status.StoredFieldStatus test_stored_fields ( CodecReader reader, PrintStream info_stream, boolean fail_fast )
Java: testStoredFields(org.apache.lucene.index.CodecReader reader, java.io.PrintStream infoStream, boolean failFast)

Test stored fields.

test_term_vectors

CheckIndex.Status.TermVectorStatus test_term_vectors ( CodecReader reader, PrintStream info_stream )
Java: testTermVectors(org.apache.lucene.index.CodecReader reader, java.io.PrintStream infoStream)

Test term vectors.

test_term_vectors

CheckIndex.Status.TermVectorStatus test_term_vectors ( CodecReader reader, PrintStream info_stream, boolean verbose, int level, boolean fail_fast )
Java: testTermVectors(org.apache.lucene.index.CodecReader reader, java.io.PrintStream infoStream, boolean verbose, int level, boolean failFast)

Test term vectors.

test_vectors

CheckIndex.Status.VectorValuesStatus test_vectors ( CodecReader reader, PrintStream info_stream, boolean fail_fast )
Java: testVectors(org.apache.lucene.index.CodecReader reader, java.io.PrintStream infoStream, boolean failFast)

Test the vectors index.

Instance Methods

check_index

CheckIndex.Status check_index ( )
Java: checkIndex()

Returns a Status instance detailing the state of the index.

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.

check_index

CheckIndex.Status check_index ( List<String> only_segments )
Java: checkIndex(List<String> onlySegments)

Returns a Status instance detailing the state of the index.

nametypedescription
only_segmentsList<String>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.

check_index

CheckIndex.Status check_index ( List<String> only_segments, ExecutorService executor_service )
Java: checkIndex(List<String> onlySegments, java.util.concurrent.ExecutorService executorService)

Returns a Status instance detailing the state of the index.

This method allows caller to pass in customized ExecutorService to speed up the check.

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

close

close ( )
Java: close()

do_check

int do_check ( CheckIndex.Options opts )
Java: doCheck(org.apache.lucene.index.CheckIndex.Options opts)

Actually perform the index check

nametypedescription
optsorg.apache.lucene.index.CheckIndex.OptionsThe options to use for this check

Returns: 0 iff the index is clean, 1 otherwise

exorcise_index

exorcise_index ( CheckIndex.Status result )
Java: exorciseIndex(org.apache.lucene.index.CheckIndex.Status result)

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.

fail_fast

boolean fail_fast ( )
Java: getFailFast() · also: get_fail_fast

See #setFailFast.

fail_fast=

fail_fast= ( boolean v )
Java: setFailFast(boolean v) · also: set_fail_fast

If true, just throw the original exception immediately when corruption is detected, rather than continuing to iterate to other segments looking for more corruption.

info_stream=

info_stream= ( PrintStream out )
Java: setInfoStream(java.io.PrintStream out) · also: set_info_stream

Set infoStream where messages should go. See #setInfoStream(PrintStream,boolean).

level

int level ( )
Java: getLevel() · also: get_level

See #setLevel.

level=

level= ( int v )
Java: setLevel(int v) · also: set_level

Sets Level, the higher the value, the more additional checks are performed. This will likely drastically increase time it takes to run CheckIndex! See Level

set_info_stream

set_info_stream ( PrintStream out, boolean verbose )
Java: setInfoStream(java.io.PrintStream out, boolean verbose)

Set infoStream where messages should go. If null, no messages are printed. If verbose is true then more details are printed.

thread_count=

thread_count= ( int tc )
Java: setThreadCount(int tc) · also: set_thread_count

Set threadCount used for parallelizing index integrity checking.

this work for additional information regarding copyright ownership.