public class IndexVersion extends Object
You must pass it the full path of the index directory, e.g.
[dspace]/solr/statistics/data/index/
The response is simply a version number (e.g. 4.4), as this is utilized by
the ant update_solr_indexes target in [src]/dspace/src/main/config/build.xml
| Constructor and Description |
|---|
IndexVersion() |
| Modifier and Type | Method and Description |
|---|---|
static int |
compareSoftwareVersions(String firstVersion,
String secondVersion)
Compare two software version numbers to see which is greater.
|
static String |
getIndexVersion(String indexDirPath)
Determine the version of Solr/Lucene which was used to create a given index directory.
|
static String |
getLatestVersion()
Determine the version of Solr/Lucene which DSpace is currently running.
|
static void |
main(String[] argv) |
public static void main(String[] argv) throws IOException
IOExceptionpublic static String getIndexVersion(String indexDirPath) throws IOException
indexDirPath - Full path of the Solr/Lucene index directoryIOException - if IO errorpublic static int compareSoftwareVersions(String firstVersion, String secondVersion) throws IOException
This method returns -1 if firstVersion is less than secondVersion, 1 if firstVersion is greater than secondVersion, and 0 if equal.
However, since we ignore sub-minor versions, versions "4.2.1" and "4.2.5" will be seen as EQUAL (as "4.2" = "4.2").
NOTE: In case it is not obvious, software version numbering does NOT
behave like normal decimal numbers. For example, in software versions
the following statement is TRUE: 4.1 < 4.4 < 4.5 < 4.10 < 4.21 < 4.51
firstVersion - First version to compare, as a StringsecondVersion - Second version to compare as a StringIOException - if IO errorpublic static String getLatestVersion()
Copyright © 2017 DuraSpace. All rights reserved.