Class LuceneIndexHelper
java.lang.Object
com.atlassian.confluence.internal.index.lucene.LuceneIndexHelper
Helper methods to deal with Lucene index in Confluence
- Since:
- 7.6.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetIndexVersion(Path indexDirectory) static voidreplaceIndexDirectory(Path destination, Path source) Delete existing index files indestinationthen move all index files fromsourcetodestinationstatic longsizeOfIndex(Path indexDirectory) Calculate (approximately) current size of a Lucene index.static longsizeOfIndexMB(Path indexDirectory) Calculate the total size in megabytes of the index located in the specified directory
-
Constructor Details
-
LuceneIndexHelper
public LuceneIndexHelper()
-
-
Method Details
-
sizeOfIndex
Calculate (approximately) current size of a Lucene index. This is done by adding up size of all regular files directly under the index directory. This cannot simply be done by normal File utils e.g. common-ios FileUtils#sizeOfDirectory because Confluence put indices inside main index directory.- Parameters:
indexDirectory- The index directory- Returns:
- size in bytes of the index stored in specified directory
- Throws:
IOException- if there is any error sizing index files
-
sizeOfIndexMB
Calculate the total size in megabytes of the index located in the specified directory- Returns:
- index size in MB, else 0 If the size of the index cannot be calculated
-
getIndexVersion
- Parameters:
indexDirectory- directory of the index- Returns:
- current version of an index, or empty if the index cannot be read.
-
replaceIndexDirectory
Delete existing index files indestinationthen move all index files fromsourcetodestination- Parameters:
destination- Index directory whose content is to be replacedsource- Index directory whose content is to be moved todestination- Throws:
IOException- if there is any exception moving the files around
-