public class IndexConfig extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
IndexConfig.IndexerConfig
Base class for indexer configs
|
static class |
IndexConfig.SemanticIndexerConfig
Object storing the configuration for a semantic annotation indexer.
|
static class |
IndexConfig.TokenIndexerConfig
Object storing the configuration for a Token indexer.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAXIMUM_BATCHES
The default value for
maximumBatches |
static int |
DEFAULT_TIME_BETWEEN_BATCHES
The default value for
timeBetweenBatches (1 hour). |
static String |
DOCUMENT_URI_FEATURE_DEFAULT_NAME
The default feature name for obtaining document URIs (provided as features
on documents).
|
static int |
FORMAT_VERSION
The current format version for the XML files containing serialisations of
IndexConfig instances.
|
Constructor and Description |
---|
IndexConfig(File indexDirectory,
String tokenAnnotationSetName,
String tokenAnnotationType,
String semanticAnnotationSetName,
IndexConfig.TokenIndexerConfig[] tokenIndexers,
IndexConfig.SemanticIndexerConfig[] semanticIndexers,
DocumentMetadataHelper[] docMetadataHelpers,
DocumentRenderer documentRenderer)
Constructs an index configuration object.
|
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
getContext()
Gets the map used for passing values between the various pluggable elements
in this index (such as annotation helpers).
|
DocumentMetadataHelper[] |
getDocMetadataHelpers()
Gets the array of document metadata helpers.
|
DocumentRenderer |
getDocumentRenderer()
Gets the renderer to be used for displaying documents and hits.
|
String |
getDocumentUriFeatureName() |
int |
getFormatVersion() |
File |
getIndexDirectory()
Gets the top level directory of an index.
|
int |
getMaximumBatches()
Gets the maximum number of on-disk index batches before an index compaction
is triggered.
|
Map<String,String> |
getOptions()
Gets the options map - a Map with arbitrary configuration options, which
is made available to all sub-elements of this index (e.g.
|
String |
getSemanticAnnotationSetName()
Gets the name of the annotation set containing semantic annotations.
|
IndexConfig.SemanticIndexerConfig[] |
getSemanticIndexers()
Gets the configuration for all the semantic annotation indexers used.
|
int |
getTimeBetweenBatches()
Gets the current value for the time interval (in milliseconds) between the
saving of a batch and the next.
|
String |
getTokenAnnotationSetName()
Gets the name for the annotation set where token annotations can be found.
|
String |
getTokenAnnotationType()
Gets the annotation type to be used for obtaining tokens.
|
IndexConfig.TokenIndexerConfig[] |
getTokenIndexers()
Gets the configuration for all the token indexers used.
|
static IndexConfig |
readConfigFromFile(File file)
Loads an index config object from a file.
|
static IndexConfig |
readConfigFromFile(File configFile,
File indexDir)
Loads an index config object from a file, but allows the caller to override
the index directory stored in the file.
|
static IndexConfig |
readConfigFromUrl(URL u)
Loads an index config object from a URL.
|
static IndexConfig |
readConfigFromUrl(URL configFile,
File indexDir)
Loads an index config object from a URL, but allows the caller to override
the index directory stored in the file.
|
void |
setDocumentRenderer(DocumentRenderer documentRenderer)
Sets the renderer to be used for displaying documents and hits.
|
void |
setDocumentUriFeatureName(String documentUriFeatureName) |
void |
setFormatVersion(int formatVersion)
See
FORMAT_VERSION . |
void |
setMaximumBatches(int maximumBatches)
Sets the maximum number of on-disk index batches before an index compaction
is triggered.
|
void |
setTimeBetweenBatches(int timeBetweenBatches)
Sets the current value for the time interval (in milliseconds) between the
saving of a batch and the next.
|
static void |
writeConfigToFile(IndexConfig config,
File file)
Saves an
IndexConfig object to a file via XML serialisation. |
public static final int FORMAT_VERSION
public static final String DOCUMENT_URI_FEATURE_DEFAULT_NAME
public static final int DEFAULT_TIME_BETWEEN_BATCHES
timeBetweenBatches
(1 hour).public static final int DEFAULT_MAXIMUM_BATCHES
maximumBatches
public IndexConfig(File indexDirectory, String tokenAnnotationSetName, String tokenAnnotationType, String semanticAnnotationSetName, IndexConfig.TokenIndexerConfig[] tokenIndexers, IndexConfig.SemanticIndexerConfig[] semanticIndexers, DocumentMetadataHelper[] docMetadataHelpers, DocumentRenderer documentRenderer)
indexDirectory
- indexDirectory the top level directory to be used for storing the
index.tokenAnnotationSetName
- the name for the annotation set where token annotations can be
found. Use null for the default annotation set.tokenAnnotationType
- the type of annotations used as tokens.semanticAnnotationSetName
- the name for the annotation set where semantic annotations should
be collected from.tokenIndexers
- an array of IndexConfig.TokenIndexerConfig
values, describing the
configuration for the indexing of each token feature.semanticIndexers
- an array of IndexConfig.SemanticIndexerConfig
values, describing the
the configuration for indexing semantic annotations.public Map<String,Object> getContext()
public int getFormatVersion()
FORMAT_VERSION
.public void setFormatVersion(int formatVersion)
FORMAT_VERSION
.formatVersion
- the formatVersion to setpublic File getIndexDirectory()
File
object.public String getTokenAnnotationType()
String
object.public String getTokenAnnotationSetName()
public IndexConfig.TokenIndexerConfig[] getTokenIndexers()
IndexConfig.TokenIndexerConfig
values.public String getSemanticAnnotationSetName()
public IndexConfig.SemanticIndexerConfig[] getSemanticIndexers()
IndexConfig.SemanticIndexerConfig
values.public int getTimeBetweenBatches()
public void setTimeBetweenBatches(int timeBetweenBatches)
public int getMaximumBatches()
public void setMaximumBatches(int maximumBatches)
DEFAULT_MAXIMUM_BATCHES
.maximumBatches
- public Map<String,String> getOptions()
public DocumentRenderer getDocumentRenderer()
public void setDocumentRenderer(DocumentRenderer documentRenderer)
documentRenderer
- the documentRenderer to setpublic DocumentMetadataHelper[] getDocMetadataHelpers()
public String getDocumentUriFeatureName()
public void setDocumentUriFeatureName(String documentUriFeatureName)
documentUriFeatureName
- the documentUriFeatureName to setpublic static void writeConfigToFile(IndexConfig config, File file) throws IOException
IndexConfig
object to a file via XML serialisation.config
- the object to be saved.file
- the file to write to.IOException
public static IndexConfig readConfigFromFile(File file) throws IOException, IndexException
writeConfigToFile(IndexConfig, File)
method.file
- the file to read.IndexConfig
object.IOException
- if the provided config file cannot be found.IndexException
- if the parsing of the config file fails.public static IndexConfig readConfigFromUrl(URL u) throws IOException, IndexException
writeConfigToFile(IndexConfig, File)
method.u
- the URL to read.IndexConfig
object.IOException
- if the provided config file cannot be found.IndexException
- if the parsing of the config file fails.public static IndexConfig readConfigFromFile(File configFile, File indexDir) throws IOException, IndexException
configFile
- the file to readindexDir
- the top-level index directory, which will be used instead of the
value stored in the config file.FileNotFoundException
- if the provided config file cannot be found.IndexException
- if the parsing of the config file fails.IOException
public static IndexConfig readConfigFromUrl(URL configFile, File indexDir) throws IOException, IndexException
configFile
- the file to readindexDir
- the top-level index directory, which will be used instead of the
value stored in the config file.FileNotFoundException
- if the provided config file cannot be found.IndexException
- if the parsing of the config file fails.IOException
Copyright © 2021 GATE. All rights reserved.