|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.index.SegmentInfo
public final class SegmentInfo
Information about a segment such as it's name, directory, and files related to the segment.
Field Summary | |
---|---|
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 Summary | |
---|---|
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. |
|
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 | |
---|---|
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. |
Map<String,String> |
attributes()
Deprecated. no longer supported |
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. |
String |
getAttribute(String key)
Deprecated. no longer supported |
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()
|
String |
putAttribute(String key,
String value)
Deprecated. no longer supported |
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. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int NO
public static final int YES
public final String name
public final Directory dir
Constructor Detail |
---|
public SegmentInfo(Directory dir, String version, String name, int docCount, boolean isCompoundFile, Codec codec, Map<String,String> diagnostics)
Note: this is public only to allow access from the codecs package.
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.
Method Detail |
---|
public Map<String,String> getDiagnostics()
public boolean getUseCompoundFile()
public void setCodec(Codec codec)
public Codec getCodec()
Codec
that wrote this segment.
public int getDocCount()
public Set<String> files()
public String toString()
toString
in class Object
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)
equals
in class Object
public int hashCode()
hashCode
in class Object
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 setFiles(Set<String> files)
public void addFiles(Collection<String> files)
public void addFile(String file)
@Deprecated public String getAttribute(String key)
@Deprecated 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.
@Deprecated public Map<String,String> attributes()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |