public final class SegmentInfo extends Object
| Modifier and Type | Field and Description |
|---|---|
Directory |
dir
Where this segment resides.
|
String |
name
Unique segment name in the directory.
|
static int |
NO
Used by some member fields to mean not present (e.g.,
norms, deletions).
|
static int |
YES
Used by some member fields to mean present (e.g.,
norms, deletions).
|
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFile(String file)
Add this file to the set of files written for this
segment.
|
void |
addFiles(Collection<String> files)
Add these files to the set of files written for this
segment.
|
boolean |
equals(Object obj)
We consider another SegmentInfo instance equal if it
has the same dir and same name.
|
Set<String> |
files()
Return all files referenced by this SegmentInfo.
|
Codec |
getCodec()
Return
Codec that wrote this segment. |
Map<String,String> |
getDiagnostics()
Returns diagnostics saved into the segment when it was
written.
|
int |
getDocCount()
Returns number of documents in this segment (deletions
are not taken into account).
|
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() |
void |
setCodec(Codec codec)
Can only be called once.
|
void |
setFiles(Set<String> files)
Sets the files written for this segment.
|
void |
setVersion(String version)
Used by DefaultSegmentInfosReader to upgrade a 3.0 segment to record its
version is "3.0".
|
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 Map<String,String> getDiagnostics()
public boolean getUseCompoundFile()
public void setCodec(Codec codec)
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)
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.