org.apache.lucene.util

Class Version



  • public final class Version
    extends Object
    Use by certain classes to match version compatibility across releases of Lucene.

    WARNING: When changing the version parameter that you supply to components in Lucene, do not simply change the version at search-time, but instead also adjust your indexing code to match, and re-index.

    • Field Detail

      • LUCENE_6_1_0

        @Deprecated
        public static final Version LUCENE_6_1_0
        Deprecated. (6.2.0) Use latest
        Match settings and bugs in Lucene's 6.1.0 release.
      • LUCENE_6_2_0

        @Deprecated
        public static final Version LUCENE_6_2_0
        Deprecated. (6.3.0) Use latest
        Match settings and bugs in Lucene's 6.2.0 release.
      • LUCENE_6_3_0

        @Deprecated
        public static final Version LUCENE_6_3_0
        Deprecated. (6.4.0) Use latest
        Match settings and bugs in Lucene's 6.3.0 release.
      • LUCENE_6_4_0

        public static final Version LUCENE_6_4_0
        Match settings and bugs in Lucene's 6.4.0 release.

        Use this to get the latest & greatest settings, bug fixes, etc, for Lucene.

      • LATEST

        public static final Version LATEST

        WARNING: if you use this setting, and then upgrade to a newer release of Lucene, sizable changes may happen. If backwards compatibility is important then you should instead explicitly specify an actual version.

        If you use this constant then you may need to re-index all of your documents when upgrading Lucene, as the way text is indexed may have changed. Additionally, you may need to re-test your entire application to ensure it behaves as expected, as some defaults may have changed and may break functionality in your application.

      • major

        public final int major
        Major version, the difference between stable and trunk
      • minor

        public final int minor
        Minor version, incremented within the stable branch
      • bugfix

        public final int bugfix
        Bugfix number, incremented on release branches
      • prerelease

        public final int prerelease
        Prerelease version, currently 0 (alpha), 1 (beta), or 2 (final)
    • Method Detail

      • parse

        public static Version parse(String version)
                             throws ParseException
        Parse a version number of the form "major.minor.bugfix.prerelease". Part ".bugfix" and part ".prerelease" are optional. Note that this is forwards compatible: the parsed version does not have to exist as a constant.
        Throws:
        ParseException
      • parseLeniently

        public static Version parseLeniently(String version)
                                      throws ParseException
        Parse the given version number as a constant or dot based version.

        This method allows to use "LUCENE_X_Y" constant names, or version numbers in the format "x.y.z".

        Throws:
        ParseException
      • fromBits

        public static Version fromBits(int major,
                                       int minor,
                                       int bugfix)
        Returns a new version based on raw numbers
      • onOrAfter

        public boolean onOrAfter(Version other)
        Returns true if this version is the same or after the version from the argument.