Plugin Lucene version checker: use `Lucene.parseVersionLenient`

With commit 07c632a2d4dbefe44e8f25dc4ded6cf143d60e41, we now have a new Lucene.parseVersionLenient(String, Version) method which tries to find an existing Lucene version based on the two first digits X.Y of X.Y.Z String.
This commit is contained in:
David Pilato 2014-07-28 14:24:29 +02:00
parent e543a4dc60
commit 264d59c3e2
1 changed files with 1 additions and 5 deletions

View File

@ -568,12 +568,8 @@ public class PluginsService extends AbstractComponent {
}
if (luceneVersion != null) {
// We only keep the first two parts
String parts[] = luceneVersion.split("\\.");
// Should fail if the running node is too old!
org.apache.lucene.util.Version luceneExpectedVersion = Lucene.parseVersionLenient(parts[0] + "." + parts[1], null);
org.apache.lucene.util.Version luceneExpectedVersion = Lucene.parseVersionLenient(luceneVersion, null);
if (Version.CURRENT.luceneVersion.equals(luceneExpectedVersion)) {
logger.debug("starting analysis plugin for Lucene [{}].", luceneExpectedVersion);
return true;