Class SegmentInfo
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal DirectoryWhere this segment resides.final StringUnique segment name in the directory.static final intUsed by some member fields to mean not present (e.g., norms, deletions).static final intUsed by some member fields to mean present (e.g., norms, deletions). -
Constructor Summary
ConstructorsConstructorDescriptionSegmentInfo(Directory dir, String version, String name, int docCount, boolean isCompoundFile, Codec codec, Map<String, String> diagnostics) Construct a new complete SegmentInfo instance from input.SegmentInfo(Directory dir, String version, String name, int docCount, boolean isCompoundFile, Codec codec, Map<String, String> diagnostics, Map<String, String> attributes) Construct a new complete SegmentInfo instance from input. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd this file to the set of files written for this segment.voidaddFiles(Collection<String> files) Add these files to the set of files written for this segment.Deprecated.no longer supportedbooleanWe consider another SegmentInfo instance equal if it has the same dir and same name.files()Return all files referenced by this SegmentInfo.getAttribute(String key) Deprecated.no longer supportedgetCodec()ReturnCodecthat wrote this segment.Returns diagnostics saved into the segment when it was written.intReturns number of documents in this segment (deletions are not taken into account).booleanReturns true if this segment is stored as a compound file; else, false.Returns the version of the code which wrote the segment.inthashCode()putAttribute(String key, String value) Deprecated.no longer supportedvoidCan only be called once.voidSets the files written for this segment.voidsetVersion(String version) Used by DefaultSegmentInfosReader to upgrade a 3.0 segment to record its version is "3.0".toString()Used for debugging.
-
Field Details
-
NO
public static final int NOUsed by some member fields to mean not present (e.g., norms, deletions).- See Also:
-
YES
public static final int YESUsed by some member fields to mean present (e.g., norms, deletions).- See Also:
-
name
Unique segment name in the directory. -
dir
Where this segment resides.
-
-
Constructor Details
-
SegmentInfo
public SegmentInfo(Directory dir, String version, String name, int docCount, boolean isCompoundFile, Codec codec, Map<String, String> diagnostics) Construct a new complete SegmentInfo instance from input.Note: this is public only to allow access from the codecs package.
-
SegmentInfo
public SegmentInfo(Directory dir, String version, String name, int docCount, boolean isCompoundFile, Codec codec, Map<String, String> diagnostics, Map<String, String> attributes) Construct a new complete SegmentInfo instance from input.Note: this is public only to allow access from the codecs package.
-
-
Method Details
-
getDiagnostics
Returns diagnostics saved into the segment when it was written. -
getUseCompoundFile
public boolean getUseCompoundFile()Returns true if this segment is stored as a compound file; else, false. -
setCodec
Can only be called once. -
getCodec
ReturnCodecthat wrote this segment. -
getDocCount
public int getDocCount()Returns number of documents in this segment (deletions are not taken into account). -
files
Return all files referenced by this SegmentInfo. -
toString
-
toString
Used for debugging. Format may suddenly change.Current format looks like
_a(3.1):c45/4, which means the segment's name is_a; it was created with Lucene 3.1 (or '?' if it's unknown); it's using compound file format (would beCif not compound); it has 45 documents; it has 4 deletions (this part is left off when there are no deletions). -
equals
We consider another SegmentInfo instance equal if it has the same dir and same name. -
hashCode
public int hashCode() -
setVersion
Used by DefaultSegmentInfosReader to upgrade a 3.0 segment to record its version is "3.0". This method can be removed when we're not required to support 3x indexes anymore, e.g. in 5.0.NOTE: this method is used for internal purposes only - you should not modify the version of a SegmentInfo, or it may result in unexpected exceptions thrown when you attempt to open the index.
-
getVersion
Returns the version of the code which wrote the segment. -
setFiles
Sets the files written for this segment. -
addFiles
Add these files to the set of files written for this segment. -
addFile
Add this file to the set of files written for this segment. -
getAttribute
Deprecated.no longer supportedGet a codec attribute value, or null if it does not exist -
putAttribute
Deprecated.no longer supportedPuts a codec attribute value.This is a key-value mapping for the field that the codec can use to store additional metadata, and will be available to the codec when reading the segment via
getAttribute(String)If a value already exists for the field, it will be replaced with the new value.
-
attributes
Deprecated.no longer supportedReturns the internal codec attributes map.- Returns:
- internal codec attributes map. May be null if no mappings exist.
-