public final class SegmentInfo extends Object
| Modifier and Type | Field and Description |
|---|---|
Directory |
dir |
String |
name |
static int |
NO |
static int |
YES |
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFile(String file) |
void |
addFiles(Collection<String> files) |
Map<String,String> |
attributes() |
boolean |
equals(Object obj)
We consider another SegmentInfo instance equal if it
has the same dir and same name.
|
Set<String> |
files() |
String |
getAttribute(String key)
Get a codec attribute value, or null if it does not exist
|
Codec |
getCodec() |
Map<String,String> |
getDiagnostics() |
int |
getDocCount() |
boolean |
getUseCompoundFile()
Returns true if this segment is stored as a compound
file; else, false.
|
String |
getVersion()
Returns the version of the code which wrote the segment.
|
int |
hashCode() |
String |
putAttribute(String key,
String value)
Puts a codec attribute value.
|
void |
setCodec(Codec codec)
Can only be called once.
|
void |
setFiles(Set<String> files) |
void |
setVersion(String version)
Used by DefaultSegmentInfosReader to upgrade a 3.0 segment to record its
version is "3.0".
|
long |
sizeInBytes()
Returns total size in bytes of all of files used by
this segment.
|
String |
toString() |
String |
toString(Directory dir,
int delCount)
Used for debugging.
|
public static final int NO
public static final int YES
public final String name
public final Directory dir
public SegmentInfo(Directory dir, String version, String name, int docCount, boolean isCompoundFile, Codec codec, Map<String,String> diagnostics, Map<String,String> attributes)
Note: this is public only to allow access from the codecs package.
public long sizeInBytes()
throws IOException
SegmentInfoPerCommit.sizeInBytes() instead.IOExceptionpublic boolean getUseCompoundFile()
public void setCodec(Codec codec)
public Codec getCodec()
public int getDocCount()
public String toString(Directory dir, int delCount)
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 be C if not compound); it
has 45 documents; it has 4 deletions (this part is
left off when there are no deletions).
public boolean equals(Object obj)
public void setVersion(String version)
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.
public String getVersion()
public void addFiles(Collection<String> files)
public void addFile(String file)
public String getAttribute(String key)
public String putAttribute(String key, String 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.
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.