public class IndexMetadataImpl extends Object implements IndexMetadata, IndexMetadataWriter
Constructor and Description |
---|
IndexMetadataImpl(org.apache.lucene.index.IndexReader reader,
File indexDir,
boolean createNewIndex,
ConfigInputFormat config)
Construct an IndexMetadata object, querying the index for the available
fields and their types.
|
IndexMetadataImpl(org.apache.lucene.index.IndexReader reader,
File indexDir,
boolean createNewIndex,
File indexTemplateFile)
Construct an IndexMetadata object, querying the index for the available
fields and their types.
|
Modifier and Type | Method and Description |
---|---|
void |
addToTokenCount(long tokensProcessed)
Add some tokens to the total number of tokens in the index.
|
AnnotatedFields |
annotatedFields() |
boolean |
contentViewable()
Is the content freely viewable by all users, or is it restricted?
|
String |
description()
Get a description of the index, if specified
|
String |
displayName()
Get the display name for the index.
|
String |
documentFormat()
What format(s) is/are the documents in?
This is in the form of a format identifier as understood by the
DocumentFormats class (either an abbreviation or a (qualified) class name).
|
IndexMetadata |
freeze() |
String |
indexBlackLabBuildTime()
When was the BlackLab.jar used for indexing built?
|
String |
indexBlackLabVersion()
When was the BlackLab.jar used for indexing built?
|
String |
indexFormat()
What version of the index format is this?
|
boolean |
isFrozen() |
boolean |
isNewIndex()
Is this a new, empty index?
An empty index is one that doesn't have a main contents field yet, or has a
main contents field but no indexed tokens yet.
|
MetadataFields |
metadataFields()
Get the metadata fields.
|
AnnotatedField |
registerAnnotatedField(AnnotatedFieldWriter fieldWriter)
While indexing, check if an annotated field is already registered in the
metadata, and if not, add it now.
|
MetadataField |
registerMetadataField(String fieldName)
Register a metadata field.
|
void |
save()
Save the index structure file.
|
void |
setContentViewable(boolean contentViewable)
Used when creating an index to initialize contentViewable setting.
|
void |
setDisplayName(String displayName)
Set the display name for this index.
|
void |
setDocumentFormat(String documentFormat)
Set a document format (or formats) for this index.
|
void |
setTextDirection(TextDirection textDirection)
Used when creating an index to initialize textDirection setting.
|
boolean |
subannotationsStoredWithParent() |
TextDirection |
textDirection()
What's the text direction of this corpus?
|
String |
timeCreated()
When was this index created?
|
String |
timeModified()
When was this index last modified?
|
long |
tokenCount()
How many tokens are in the index?
|
void |
updateLastModified()
Indicate that the index was modified, so that fact will be recorded in the
metadata file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
annotatedField, mainAnnotatedField, metadataField
ensureNotFrozen
public IndexMetadataImpl(org.apache.lucene.index.IndexReader reader, File indexDir, boolean createNewIndex, ConfigInputFormat config) throws IndexTooOld
reader
- the index of which we want to know the structureindexDir
- where the index (and the metadata file) is storedcreateNewIndex
- whether we're creating a new indexconfig
- input format config to use as template for index structure /
metadata (if creating new index)IndexTooOld
- if the index is too old to be opened by this BlackLab versionpublic IndexMetadataImpl(org.apache.lucene.index.IndexReader reader, File indexDir, boolean createNewIndex, File indexTemplateFile) throws IndexTooOld
reader
- the index of which we want to know the structureindexDir
- where the index (and the metadata file) is storedcreateNewIndex
- whether we're creating a new indexindexTemplateFile
- JSON file to use as template for index structure /
metadata (if creating new index)IndexTooOld
- if the index is too old to be opened by this BlackLab versionpublic void save()
IndexMetadataWriter
save
in interface IndexMetadataWriter
public AnnotatedFields annotatedFields()
annotatedFields
in interface IndexMetadata
public MetadataFields metadataFields()
IndexMetadataWriter
metadataFields
in interface IndexMetadata
metadataFields
in interface IndexMetadataWriter
public String displayName()
displayName
in interface IndexMetadata
public String description()
description
in interface IndexMetadata
public boolean contentViewable()
contentViewable
in interface IndexMetadata
public TextDirection textDirection()
textDirection
in interface IndexMetadata
public String documentFormat()
documentFormat
in interface IndexMetadata
documentFormat
in interface IndexMetadataWriter
public String indexFormat()
indexFormat
in interface IndexMetadata
public String timeCreated()
timeCreated
in interface IndexMetadata
public String timeModified()
timeModified
in interface IndexMetadata
public String indexBlackLabBuildTime()
indexBlackLabBuildTime
in interface IndexMetadata
public String indexBlackLabVersion()
indexBlackLabVersion
in interface IndexMetadata
public boolean isNewIndex()
isNewIndex
in interface IndexMetadata
public long tokenCount()
IndexMetadata
tokenCount
in interface IndexMetadata
public void updateLastModified()
updateLastModified
in interface IndexMetadataWriter
public AnnotatedField registerAnnotatedField(AnnotatedFieldWriter fieldWriter)
registerAnnotatedField
in interface IndexMetadataWriter
fieldWriter
- field to registerpublic MetadataField registerMetadataField(String fieldName)
IndexMetadataWriter
registerMetadataField
in interface IndexMetadataWriter
fieldName
- name of the fieldpublic void setDisplayName(String displayName)
setDisplayName
in interface IndexMetadataWriter
displayName
- the display name to set.public void setDocumentFormat(String documentFormat)
setDocumentFormat
in interface IndexMetadataWriter
documentFormat
- the document format to storepublic void addToTokenCount(long tokensProcessed)
IndexMetadataWriter
addToTokenCount
in interface IndexMetadataWriter
tokensProcessed
- number of tokens to addpublic void setContentViewable(boolean contentViewable)
setContentViewable
in interface IndexMetadataWriter
contentViewable
- whether content may be freely viewedpublic void setTextDirection(TextDirection textDirection)
setTextDirection
in interface IndexMetadataWriter
textDirection
- text directionpublic IndexMetadata freeze()
freeze
in interface Freezable<IndexMetadata>
public boolean isFrozen()
isFrozen
in interface Freezable<IndexMetadata>
public boolean subannotationsStoredWithParent()
subannotationsStoredWithParent
in interface IndexMetadata
Copyright © 2020 Instituut voor Nederlandse Taal (INT). All rights reserved.