lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [3/6] lucenenet git commit: Rename to LuceneVersion to aboid conflicting with System.Version
Date Mon, 23 Feb 2015 20:51:56 GMT
Rename to LuceneVersion to aboid conflicting with System.Version


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/3533077d
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/3533077d
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/3533077d

Branch: refs/heads/master
Commit: 3533077dc5da5e2a889a2755b02e892b9d452c52
Parents: a559648
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Mon Feb 23 20:48:31 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Mon Feb 23 20:48:31 2015 +0200

----------------------------------------------------------------------
 .../Utils/DatasetSplitter.cs                    |   6 +-
 src/Lucene.Net.Core/Index/IndexUpgrader.cs      |   8 +-
 src/Lucene.Net.Core/Index/IndexWriterConfig.cs  |   5 +-
 .../Index/LiveIndexWriterConfig.cs              |   8 +-
 src/Lucene.Net.Core/Lucene.Net.csproj           |   2 +-
 src/Lucene.Net.Core/Util/LuceneVersion.cs       | 216 +++++++++++++++++++
 src/Lucene.Net.Core/Util/Version.cs             | 216 -------------------
 .../Directory/DirectoryTaxonomyWriter.cs        |   4 +-
 .../Index/RandomIndexWriter.cs                  |   4 +-
 .../Util/LuceneTestCase.cs                      |   6 +-
 src/Lucene.Net.Tests/core/Util/TestVersion.cs   |  24 +--
 11 files changed, 249 insertions(+), 250 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3533077d/src/Lucene.Net.Classification/Utils/DatasetSplitter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Classification/Utils/DatasetSplitter.cs b/src/Lucene.Net.Classification/Utils/DatasetSplitter.cs
index e5c64e9..ba4385f 100644
--- a/src/Lucene.Net.Classification/Utils/DatasetSplitter.cs
+++ b/src/Lucene.Net.Classification/Utils/DatasetSplitter.cs
@@ -60,9 +60,9 @@ namespace Lucene.Net.Classification.Utils
         public void Split(AtomicReader originalIndex, Directory trainingIndex, Directory
testIndex, Directory crossValidationIndex, Analyzer analyzer, params string[] fieldNames)
         {
             // create IWs for train / test / cv IDXs
-            IndexWriter testWriter = new IndexWriter(testIndex, new IndexWriterConfig(Util.Version.LUCENE_CURRENT,
analyzer));
-            IndexWriter cvWriter = new IndexWriter(crossValidationIndex, new IndexWriterConfig(Util.Version.LUCENE_CURRENT,
analyzer));
-            IndexWriter trainingWriter = new IndexWriter(trainingIndex, new IndexWriterConfig(Util.Version.LUCENE_CURRENT,
analyzer));
+            IndexWriter testWriter = new IndexWriter(testIndex, new IndexWriterConfig(Util.LuceneVersion.LUCENE_CURRENT,
analyzer));
+            IndexWriter cvWriter = new IndexWriter(crossValidationIndex, new IndexWriterConfig(Util.LuceneVersion.LUCENE_CURRENT,
analyzer));
+            IndexWriter trainingWriter = new IndexWriter(trainingIndex, new IndexWriterConfig(Util.LuceneVersion.LUCENE_CURRENT,
analyzer));
 
             try
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3533077d/src/Lucene.Net.Core/Index/IndexUpgrader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexUpgrader.cs b/src/Lucene.Net.Core/Index/IndexUpgrader.cs
index 5c43aff..0e40672 100644
--- a/src/Lucene.Net.Core/Index/IndexUpgrader.cs
+++ b/src/Lucene.Net.Core/Index/IndexUpgrader.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Index
 {
@@ -27,7 +28,6 @@ namespace Lucene.Net.Index
     using Directory = Lucene.Net.Store.Directory;
     using FSDirectory = Lucene.Net.Store.FSDirectory;
     using InfoStream = Lucene.Net.Util.InfoStream;
-    using Version = Lucene.Net.Util.Version;
 
     /// <summary>
     /// this is an easy-to-use tool that upgrades all segments of an index from previous
Lucene versions
@@ -127,7 +127,7 @@ namespace Lucene.Net.Index
             {
                 dir = CommandLineUtil.NewFSDirectory(dirImpl, new DirectoryInfo(path));
             }
-            return new IndexUpgrader(dir, Version.LUCENE_CURRENT, @out, deletePriorCommits);
+            return new IndexUpgrader(dir, LuceneVersion.LUCENE_CURRENT, @out, deletePriorCommits);
         }
 
         private readonly Directory Dir;
@@ -138,7 +138,7 @@ namespace Lucene.Net.Index
         /// Creates index upgrader on the given directory, using an <seealso cref="IndexWriter"/>
using the given
         /// {@code matchVersion}. The tool refuses to upgrade indexes with multiple commit
points.
         /// </summary>
-        public IndexUpgrader(Directory dir, Version matchVersion)
+        public IndexUpgrader(Directory dir, LuceneVersion matchVersion)
             : this(dir, new IndexWriterConfig(matchVersion, null), false)
         {
         }
@@ -148,7 +148,7 @@ namespace Lucene.Net.Index
         /// {@code matchVersion}. You have the possibility to upgrade indexes with multiple
commit points by removing
         /// all older ones. If {@code infoStream} is not {@code null}, all logging output
will be sent to this stream.
         /// </summary>
-        public IndexUpgrader(Directory dir, Version matchVersion, TextWriter infoStream,
bool deletePriorCommits)
+        public IndexUpgrader(Directory dir, LuceneVersion matchVersion, TextWriter infoStream,
bool deletePriorCommits)
             : this(dir, new IndexWriterConfig(matchVersion, null), deletePriorCommits)
         {
             if (null != infoStream)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3533077d/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexWriterConfig.cs b/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
index cf13334..aaf160b 100644
--- a/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
+++ b/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
@@ -30,7 +30,6 @@ namespace Lucene.Net.Index
     using InfoStream = Lucene.Net.Util.InfoStream;
     using PrintStreamInfoStream = Lucene.Net.Util.PrintStreamInfoStream;
     using Similarity = Lucene.Net.Search.Similarities.Similarity;
-    using Version = Lucene.Net.Util.Version;
 
     /// <summary>
     /// Holds all the configuration that is used to create an <seealso cref="IndexWriter"/>.
@@ -169,7 +168,7 @@ namespace Lucene.Net.Index
 
         /// <summary>
         /// Creates a new config that with defaults that match the specified
-        /// <seealso cref="Version"/> as well as the default {@link
+        /// <seealso cref="LuceneVersion"/> as well as the default {@link
         /// Analyzer}. If matchVersion is >= {@link
         /// Version#LUCENE_32}, <seealso cref="TieredMergePolicy"/> is used
         /// for merging; else <seealso cref="LogByteSizeMergePolicy"/>.
@@ -179,7 +178,7 @@ namespace Lucene.Net.Index
         /// should switch to <seealso cref="LogByteSizeMergePolicy"/> or
         /// <seealso cref="LogDocMergePolicy"/>.
         /// </summary>
-        public IndexWriterConfig(Version matchVersion, Analyzer analyzer)
+        public IndexWriterConfig(LuceneVersion matchVersion, Analyzer analyzer)
             : base(analyzer, matchVersion)
         {
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3533077d/src/Lucene.Net.Core/Index/LiveIndexWriterConfig.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/LiveIndexWriterConfig.cs b/src/Lucene.Net.Core/Index/LiveIndexWriterConfig.cs
index 22ffff8..7d90819 100644
--- a/src/Lucene.Net.Core/Index/LiveIndexWriterConfig.cs
+++ b/src/Lucene.Net.Core/Index/LiveIndexWriterConfig.cs
@@ -1,4 +1,5 @@
 using System.Text;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Index
 {
@@ -31,7 +32,6 @@ namespace Lucene.Net.Index
     using InfoStream = Lucene.Net.Util.InfoStream;
     using OpenMode_e = Lucene.Net.Index.IndexWriterConfig.OpenMode_e;
     using Similarity = Lucene.Net.Search.Similarities.Similarity;
-    using Version = Lucene.Net.Util.Version;
 
     /// <summary>
     /// Holds all the configuration used by <seealso cref="IndexWriter"/> with few
setters for
@@ -122,8 +122,8 @@ namespace Lucene.Net.Index
         protected internal volatile int PerThreadHardLimitMB;
 
         /// <summary>
-        /// <seealso cref="Version"/> that <seealso cref="IndexWriter"/> should
emulate. </summary>
-        protected internal readonly Version MatchVersion;
+        /// <seealso cref="LuceneVersion"/> that <seealso cref="IndexWriter"/>
should emulate. </summary>
+        protected internal readonly LuceneVersion MatchVersion;
 
         /// <summary>
         /// True if segment flushes should use compound file format </summary>
@@ -134,7 +134,7 @@ namespace Lucene.Net.Index
         protected internal volatile bool checkIntegrityAtMerge = IndexWriterConfig.DEFAULT_CHECK_INTEGRITY_AT_MERGE;
 
         // used by IndexWriterConfig
-        internal LiveIndexWriterConfig(Analyzer analyzer, Version matchVersion)
+        internal LiveIndexWriterConfig(Analyzer analyzer, LuceneVersion matchVersion)
         {
             this.analyzer = analyzer;
             this.MatchVersion = matchVersion;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3533077d/src/Lucene.Net.Core/Lucene.Net.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.csproj b/src/Lucene.Net.Core/Lucene.Net.csproj
index 2f26274..141edbe 100644
--- a/src/Lucene.Net.Core/Lucene.Net.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.csproj
@@ -854,7 +854,7 @@
     <Compile Include="Util\TimSorter.cs" />
     <Compile Include="Util\ToStringUtils.cs" />
     <Compile Include="Util\UnicodeUtil.cs" />
-    <Compile Include="Util\Version.cs" />
+    <Compile Include="Util\LuceneVersion.cs" />
     <Compile Include="Util\VirtualMethod.cs" />
     <Compile Include="Util\WAH8DocIdSet.cs" />
     <Compile Include="Util\WeakIdentityMap.cs" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3533077d/src/Lucene.Net.Core/Util/LuceneVersion.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/LuceneVersion.cs b/src/Lucene.Net.Core/Util/LuceneVersion.cs
new file mode 100644
index 0000000..6c4647f
--- /dev/null
+++ b/src/Lucene.Net.Core/Util/LuceneVersion.cs
@@ -0,0 +1,216 @@
+using System.Collections.Generic;
+
+namespace Lucene.Net.Util
+{
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+
+    /// <summary>
+    /// Use by certain classes to match version compatibility
+    /// across releases of Lucene.
+    ///
+    /// <p><b>WARNING</b>: 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.</p>
+    /// </summary>
+    public enum LuceneVersion
+    {
+        /// <summary>
+        /// Match settings and bugs in Lucene's 3.0 release. </summary>
+        /// @deprecated (4.0) Use latest
+        [System.Obsolete("(4.0) Use latest")]
+        LUCENE_30,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 3.1 release. </summary>
+        /// @deprecated (4.0) Use latest
+        [System.Obsolete("(4.0) Use latest")]
+        LUCENE_31,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 3.2 release. </summary>
+        /// @deprecated (4.0) Use latest
+        [System.Obsolete("(4.0) Use latest")]
+        LUCENE_32,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 3.3 release. </summary>
+        /// @deprecated (4.0) Use latest
+        [System.Obsolete("(4.0) Use latest")]
+        LUCENE_33,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 3.4 release. </summary>
+        /// @deprecated (4.0) Use latest
+        [System.Obsolete("(4.0) Use latest")]
+        LUCENE_34,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 3.5 release. </summary>
+        /// @deprecated (4.0) Use latest
+        [System.Obsolete("(4.0) Use latest")]
+        LUCENE_35,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 3.6 release. </summary>
+        /// @deprecated (4.0) Use latest
+        [System.Obsolete("(4.0) Use latest")]
+        LUCENE_36,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 3.6 release. </summary>
+        /// @deprecated (4.1) Use latest
+        [System.Obsolete("(4.1) Use latest")]
+        LUCENE_40,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 4.1 release. </summary>
+        /// @deprecated (4.2) Use latest
+        [System.Obsolete("(4.2) Use latest")]
+        LUCENE_41,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 4.2 release. </summary>
+        /// @deprecated (4.3) Use latest
+        [System.Obsolete("(4.3) Use latest")]
+        LUCENE_42,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 4.3 release. </summary>
+        /// @deprecated (4.4) Use latest
+        [System.Obsolete("(4.4) Use latest")]
+        LUCENE_43,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 4.4 release. </summary>
+        /// @deprecated (4.5) Use latest
+        [System.Obsolete("(4.5) Use latest")]
+        LUCENE_44,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 4.5 release. </summary>
+        /// @deprecated (4.6) Use latest
+        [System.Obsolete("(4.6) Use latest")]
+        LUCENE_45,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 4.6 release. </summary>
+        /// @deprecated (4.7) Use latest
+        [System.Obsolete("(4.7) Use latest")]
+        LUCENE_46,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 4.7 release. </summary>
+        /// @deprecated (4.8) Use latest
+        [System.Obsolete("(4.8) Use latest")]
+        LUCENE_47,
+
+        /// <summary>
+        /// Match settings and bugs in Lucene's 4.8 release.
+        ///  <p>
+        ///  Use this to get the latest &amp; greatest settings, bug
+        ///  fixes, etc, for Lucene.
+        /// </summary>
+        LUCENE_48,
+
+        /* Add new constants for later versions **here** to respect order! */
+
+        /// <summary>
+        /// <p><b>WARNING</b>: 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.
+        /// <p>
+        /// If you use this constant then you  may need to
+        /// <b>re-index all of your documents</b> when upgrading
+        /// Lucene, as the way text is indexed may have changed.
+        /// Additionally, you may need to <b>re-test your entire
+        /// application</b> to ensure it behaves as expected, as
+        /// some defaults may have changed and may break functionality
+        /// in your application. </summary>
+        /// @deprecated Use an actual version instead.
+        [System.Obsolete("Use an actual version instead.")]
+        LUCENE_CURRENT
+    }
+
+    public static class LuceneVersionHelpers
+    {
+        private static readonly Dictionary<string, LuceneVersion> stringToEnum = new
Dictionary<string, LuceneVersion>()
+        {
+            {"LUCENE_30", LuceneVersion.LUCENE_30},
+            {"LUCENE_31", LuceneVersion.LUCENE_31},
+            {"LUCENE_32", LuceneVersion.LUCENE_32},
+            {"LUCENE_33", LuceneVersion.LUCENE_33},
+            {"LUCENE_34", LuceneVersion.LUCENE_34},
+            {"LUCENE_35", LuceneVersion.LUCENE_35},
+            {"LUCENE_36", LuceneVersion.LUCENE_36},
+            {"LUCENE_40", LuceneVersion.LUCENE_40},
+            {"LUCENE_41", LuceneVersion.LUCENE_41},
+            {"LUCENE_42", LuceneVersion.LUCENE_42},
+            {"LUCENE_43", LuceneVersion.LUCENE_43},
+            {"LUCENE_44", LuceneVersion.LUCENE_44},
+            {"LUCENE_45", LuceneVersion.LUCENE_45},
+            {"LUCENE_46", LuceneVersion.LUCENE_46},
+            {"LUCENE_47", LuceneVersion.LUCENE_47},
+            {"LUCENE_48", LuceneVersion.LUCENE_48},
+            {"LUCENE_CURRENT", LuceneVersion.LUCENE_CURRENT}
+        };
+
+        private static readonly Dictionary<string, LuceneVersion> longToEnum = new
Dictionary<string, LuceneVersion>()
+        {
+            {"3.0", LuceneVersion.LUCENE_30},
+            {"3.1", LuceneVersion.LUCENE_31},
+            {"3.2", LuceneVersion.LUCENE_32},
+            {"3.3", LuceneVersion.LUCENE_33},
+            {"3.4", LuceneVersion.LUCENE_34},
+            {"3.5", LuceneVersion.LUCENE_35},
+            {"3.6", LuceneVersion.LUCENE_36},
+            {"4.0", LuceneVersion.LUCENE_40},
+            {"4.1", LuceneVersion.LUCENE_41},
+            {"4.2", LuceneVersion.LUCENE_42},
+            {"4.3", LuceneVersion.LUCENE_43},
+            {"4.4", LuceneVersion.LUCENE_44},
+            {"4.5", LuceneVersion.LUCENE_45},
+            {"4.6", LuceneVersion.LUCENE_46},
+            {"4.7", LuceneVersion.LUCENE_47},
+            {"4.8", LuceneVersion.LUCENE_48}
+        };
+
+        public static bool OnOrAfter(this LuceneVersion instance, LuceneVersion other)
+        {
+            return other <= instance;
+            //return other >= 0; //LUCENENET TODO
+        }
+
+        public static LuceneVersion ParseLeniently(string version)
+        {
+            string upperVersionString = version.ToUpper();
+            LuceneVersion ret;
+            if (stringToEnum.TryGetValue(upperVersionString, out ret))
+            {
+                return ret;
+            }
+            else if (longToEnum.TryGetValue(upperVersionString, out ret))
+            {
+                return ret;
+            }
+            return ret;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3533077d/src/Lucene.Net.Core/Util/Version.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Version.cs b/src/Lucene.Net.Core/Util/Version.cs
deleted file mode 100644
index 59abd4f..0000000
--- a/src/Lucene.Net.Core/Util/Version.cs
+++ /dev/null
@@ -1,216 +0,0 @@
-using System.Collections.Generic;
-
-namespace Lucene.Net.Util
-{
-    /*
-     * Licensed to the Apache Software Foundation (ASF) under one or more
-     * contributor license agreements.  See the NOTICE file distributed with
-     * this work for additional information regarding copyright ownership.
-     * The ASF licenses this file to You under the Apache License, Version 2.0
-     * (the "License"); you may not use this file except in compliance with
-     * the License.  You may obtain a copy of the License at
-     *
-     *     http://www.apache.org/licenses/LICENSE-2.0
-     *
-     * Unless required by applicable law or agreed to in writing, software
-     * distributed under the License is distributed on an "AS IS" BASIS,
-     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     * See the License for the specific language governing permissions and
-     * limitations under the License.
-     */
-
-    /// <summary>
-    /// Use by certain classes to match version compatibility
-    /// across releases of Lucene.
-    ///
-    /// <p><b>WARNING</b>: 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.</p>
-    /// </summary>
-    public enum Version
-    {
-        /// <summary>
-        /// Match settings and bugs in Lucene's 3.0 release. </summary>
-        /// @deprecated (4.0) Use latest
-        [System.Obsolete("(4.0) Use latest")]
-        LUCENE_30,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 3.1 release. </summary>
-        /// @deprecated (4.0) Use latest
-        [System.Obsolete("(4.0) Use latest")]
-        LUCENE_31,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 3.2 release. </summary>
-        /// @deprecated (4.0) Use latest
-        [System.Obsolete("(4.0) Use latest")]
-        LUCENE_32,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 3.3 release. </summary>
-        /// @deprecated (4.0) Use latest
-        [System.Obsolete("(4.0) Use latest")]
-        LUCENE_33,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 3.4 release. </summary>
-        /// @deprecated (4.0) Use latest
-        [System.Obsolete("(4.0) Use latest")]
-        LUCENE_34,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 3.5 release. </summary>
-        /// @deprecated (4.0) Use latest
-        [System.Obsolete("(4.0) Use latest")]
-        LUCENE_35,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 3.6 release. </summary>
-        /// @deprecated (4.0) Use latest
-        [System.Obsolete("(4.0) Use latest")]
-        LUCENE_36,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 3.6 release. </summary>
-        /// @deprecated (4.1) Use latest
-        [System.Obsolete("(4.1) Use latest")]
-        LUCENE_40,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 4.1 release. </summary>
-        /// @deprecated (4.2) Use latest
-        [System.Obsolete("(4.2) Use latest")]
-        LUCENE_41,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 4.2 release. </summary>
-        /// @deprecated (4.3) Use latest
-        [System.Obsolete("(4.3) Use latest")]
-        LUCENE_42,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 4.3 release. </summary>
-        /// @deprecated (4.4) Use latest
-        [System.Obsolete("(4.4) Use latest")]
-        LUCENE_43,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 4.4 release. </summary>
-        /// @deprecated (4.5) Use latest
-        [System.Obsolete("(4.5) Use latest")]
-        LUCENE_44,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 4.5 release. </summary>
-        /// @deprecated (4.6) Use latest
-        [System.Obsolete("(4.6) Use latest")]
-        LUCENE_45,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 4.6 release. </summary>
-        /// @deprecated (4.7) Use latest
-        [System.Obsolete("(4.7) Use latest")]
-        LUCENE_46,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 4.7 release. </summary>
-        /// @deprecated (4.8) Use latest
-        [System.Obsolete("(4.8) Use latest")]
-        LUCENE_47,
-
-        /// <summary>
-        /// Match settings and bugs in Lucene's 4.8 release.
-        ///  <p>
-        ///  Use this to get the latest &amp; greatest settings, bug
-        ///  fixes, etc, for Lucene.
-        /// </summary>
-        LUCENE_48,
-
-        /* Add new constants for later versions **here** to respect order! */
-
-        /// <summary>
-        /// <p><b>WARNING</b>: 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.
-        /// <p>
-        /// If you use this constant then you  may need to
-        /// <b>re-index all of your documents</b> when upgrading
-        /// Lucene, as the way text is indexed may have changed.
-        /// Additionally, you may need to <b>re-test your entire
-        /// application</b> to ensure it behaves as expected, as
-        /// some defaults may have changed and may break functionality
-        /// in your application. </summary>
-        /// @deprecated Use an actual version instead.
-        [System.Obsolete("Use an actual version instead.")]
-        LUCENE_CURRENT
-    }
-
-    public static class VersionEnumExtensionMethods
-    {
-        private static Dictionary<string, Version> stringToEnum = new Dictionary<string,
Version>()
-        {
-            {"LUCENE_30", Version.LUCENE_30},
-            {"LUCENE_31", Version.LUCENE_31},
-            {"LUCENE_32", Version.LUCENE_32},
-            {"LUCENE_33", Version.LUCENE_33},
-            {"LUCENE_34", Version.LUCENE_34},
-            {"LUCENE_35", Version.LUCENE_35},
-            {"LUCENE_36", Version.LUCENE_36},
-            {"LUCENE_40", Version.LUCENE_40},
-            {"LUCENE_41", Version.LUCENE_41},
-            {"LUCENE_42", Version.LUCENE_42},
-            {"LUCENE_43", Version.LUCENE_43},
-            {"LUCENE_44", Version.LUCENE_44},
-            {"LUCENE_45", Version.LUCENE_45},
-            {"LUCENE_46", Version.LUCENE_46},
-            {"LUCENE_47", Version.LUCENE_47},
-            {"LUCENE_48", Version.LUCENE_48},
-            {"LUCENE_CURRENT", Version.LUCENE_CURRENT}
-        };
-
-        private static Dictionary<string, Version> longToEnum = new Dictionary<string,
Version>()
-        {
-            {"3.0", Version.LUCENE_30},
-            {"3.1", Version.LUCENE_31},
-            {"3.2", Version.LUCENE_32},
-            {"3.3", Version.LUCENE_33},
-            {"3.4", Version.LUCENE_34},
-            {"3.5", Version.LUCENE_35},
-            {"3.6", Version.LUCENE_36},
-            {"4.0", Version.LUCENE_40},
-            {"4.1", Version.LUCENE_41},
-            {"4.2", Version.LUCENE_42},
-            {"4.3", Version.LUCENE_43},
-            {"4.4", Version.LUCENE_44},
-            {"4.5", Version.LUCENE_45},
-            {"4.6", Version.LUCENE_46},
-            {"4.7", Version.LUCENE_47},
-            {"4.8", Version.LUCENE_48}
-        };
-
-        public static bool OnOrAfter(this Version instance, Version other)
-        {
-            return other <= instance;
-            //return other >= 0; //LUCENE TODO
-        }
-
-        public static Version ParseLeniently(string version)
-        {
-            string upperVersionString = version.ToUpper();
-            Version ret;
-            if (stringToEnum.TryGetValue(upperVersionString, out ret))
-            {
-                return ret;
-            }
-            else if (longToEnum.TryGetValue(upperVersionString, out ret))
-            {
-                return ret;
-            }
-            return ret;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3533077d/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
index 63967ee..7cbe885 100644
--- a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
@@ -7,6 +7,7 @@ using System.IO;
 using Lucene.Net.Analysis.Tokenattributes;
 using Lucene.Net.Store;
 using Lucene.Net.Support;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Facet.Taxonomy.Directory
 {
@@ -43,7 +44,6 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
     using NativeFSLockFactory = Lucene.Net.Store.NativeFSLockFactory;
     using SimpleFSLockFactory = Lucene.Net.Store.SimpleFSLockFactory;
     using BytesRef = Lucene.Net.Util.BytesRef;
-    using Version = Lucene.Net.Util.Version;
 
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -301,7 +301,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
             // :Post-Release-Update-Version.LUCENE_XY:
             // Make sure we use a MergePolicy which always merges adjacent segments and thus
             // keeps the doc IDs ordered as well (this is crucial for the taxonomy index).
-            return (new IndexWriterConfig(Version.LUCENE_48, null)).SetOpenMode(openMode).SetMergePolicy(new
LogByteSizeMergePolicy());
+            return (new IndexWriterConfig(LuceneVersion.LUCENE_48, null)).SetOpenMode(openMode).SetMergePolicy(new
LogByteSizeMergePolicy());
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3533077d/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs b/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
index b4d4370..a2f7751 100644
--- a/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
+++ b/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
@@ -3,6 +3,7 @@ using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Threading;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Index
 {
@@ -33,7 +34,6 @@ namespace Lucene.Net.Index
     using NullInfoStream = Lucene.Net.Util.NullInfoStream;
     using Query = Lucene.Net.Search.Query;
     using TestUtil = Lucene.Net.Util.TestUtil;
-    using Version = Lucene.Net.Util.Version;
 
     /// <summary>
     /// Silly class that randomizes the indexing experience.  EG
@@ -99,7 +99,7 @@ namespace Lucene.Net.Index
 
         /// <summary>
         /// create a RandomIndexWriter with a random config </summary>
-        public RandomIndexWriter(Random r, Directory dir, Version v, Analyzer a)
+        public RandomIndexWriter(Random r, Directory dir, LuceneVersion v, Analyzer a)
             : this(r, dir, LuceneTestCase.NewIndexWriterConfig(r, v, a))
         {
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3533077d/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 92b07d9..5bbe13b 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -286,7 +286,7 @@ namespace Lucene.Net.Util
         /// Use this constant when creating Analyzers and any other version-dependent stuff.
         /// <p><b>NOTE:</b> Change this when development starts for new
Lucene version:
         /// </summary>
-        public static Version TEST_VERSION_CURRENT = Version.LUCENE_48;
+        public static LuceneVersion TEST_VERSION_CURRENT = LuceneVersion.LUCENE_48;
 
         /// <summary>
         /// True if and only if tests are run in verbose mode. If this flag is false
@@ -842,14 +842,14 @@ namespace Lucene.Net.Util
 
         /// <summary>
         /// create a new index writer config with random defaults </summary>
-        public static IndexWriterConfig NewIndexWriterConfig(Version v, Analyzer a)
+        public static IndexWriterConfig NewIndexWriterConfig(LuceneVersion v, Analyzer a)
         {
             return NewIndexWriterConfig(Random(), v, a);
         }
 
         /// <summary>
         /// create a new index writer config with random defaults using the specified random
</summary>
-        public static IndexWriterConfig NewIndexWriterConfig(Random r, Version v, Analyzer
a)
+        public static IndexWriterConfig NewIndexWriterConfig(Random r, LuceneVersion v, Analyzer
a)
         {
             IndexWriterConfig c = new IndexWriterConfig(v, a);
             c.SetSimilarity(ClassEnvRule.Similarity);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3533077d/src/Lucene.Net.Tests/core/Util/TestVersion.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestVersion.cs b/src/Lucene.Net.Tests/core/Util/TestVersion.cs
index f003b4d..1510007 100644
--- a/src/Lucene.Net.Tests/core/Util/TestVersion.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestVersion.cs
@@ -27,33 +27,33 @@ namespace Lucene.Net.Util
         [Test]
         public virtual void Test()
         {
-            foreach (Version v in Enum.GetValues(typeof(Version)))
+            foreach (LuceneVersion v in Enum.GetValues(typeof(LuceneVersion)))
             {
-                Assert.IsTrue(Version.LUCENE_CURRENT.OnOrAfter(v), "LUCENE_CURRENT must be
always onOrAfter(" + v + ")");
+                Assert.IsTrue(LuceneVersion.LUCENE_CURRENT.OnOrAfter(v), "LUCENE_CURRENT
must be always onOrAfter(" + v + ")");
             }
-            Assert.IsTrue(Version.LUCENE_40.OnOrAfter(Version.LUCENE_31));
-            Assert.IsTrue(Version.LUCENE_40.OnOrAfter(Version.LUCENE_40));
-            Assert.IsFalse(Version.LUCENE_30.OnOrAfter(Version.LUCENE_31));
+            Assert.IsTrue(LuceneVersion.LUCENE_40.OnOrAfter(LuceneVersion.LUCENE_31));
+            Assert.IsTrue(LuceneVersion.LUCENE_40.OnOrAfter(LuceneVersion.LUCENE_40));
+            Assert.IsFalse(LuceneVersion.LUCENE_30.OnOrAfter(LuceneVersion.LUCENE_31));
         }
 
         [Test]
         public virtual void TestParseLeniently()
         {
-            Assert.AreEqual(Version.LUCENE_40, VersionEnumExtensionMethods.ParseLeniently("4.0"));
-            Assert.AreEqual(Version.LUCENE_40, VersionEnumExtensionMethods.ParseLeniently("LUCENE_40"));
-            Assert.AreEqual(Version.LUCENE_CURRENT, VersionEnumExtensionMethods.ParseLeniently("LUCENE_CURRENT"));
+            Assert.AreEqual(LuceneVersion.LUCENE_40, LuceneVersionHelpers.ParseLeniently("4.0"));
+            Assert.AreEqual(LuceneVersion.LUCENE_40, LuceneVersionHelpers.ParseLeniently("LUCENE_40"));
+            Assert.AreEqual(LuceneVersion.LUCENE_CURRENT, LuceneVersionHelpers.ParseLeniently("LUCENE_CURRENT"));
         }
 
         [Test]
         public virtual void TestDeprecations()
         {
-            Version[] values = Enum.GetValues(typeof(Version)).Cast<Version>().ToArray();
+            LuceneVersion[] values = Enum.GetValues(typeof(LuceneVersion)).Cast<LuceneVersion>().ToArray();
             // all but the latest version should be deprecated
             for (int i = 0; i < values.Length; i++)
             {
                 if (i + 1 == values.Length)
                 {
-                    Assert.AreEqual(Version.LUCENE_CURRENT, values[i], "Last constant must
be LUCENE_CURRENT");
+                    Assert.AreEqual(LuceneVersion.LUCENE_CURRENT, values[i], "Last constant
must be LUCENE_CURRENT");
                 }
                 /*bool dep = typeof(Version).GetField(values[i].Name()).isAnnotationPresent(typeof(Deprecated));
                 if (i + 2 != values.Length)
@@ -70,10 +70,10 @@ namespace Lucene.Net.Util
         [Test]
         public virtual void TestAgainstMainVersionConstant()
         {
-            Version[] values = Enum.GetValues(typeof(Version)).Cast<Version>().ToArray();
+            LuceneVersion[] values = Enum.GetValues(typeof(LuceneVersion)).Cast<LuceneVersion>().ToArray();
             Assert.IsTrue(values.Length >= 2);
             string mainVersionWithoutAlphaBeta = Constants.MainVersionWithoutAlphaBeta();
-            Version mainVersionParsed = VersionEnumExtensionMethods.ParseLeniently(mainVersionWithoutAlphaBeta);
+            LuceneVersion mainVersionParsed = LuceneVersionHelpers.ParseLeniently(mainVersionWithoutAlphaBeta);
             Assert.AreEqual(mainVersionParsed, values[values.Length - 2], "Constant one before
last must be the same as the parsed LUCENE_MAIN_VERSION (without alpha/beta) constant: " +
mainVersionWithoutAlphaBeta);
         }
     }


Mime
View raw message