lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [16/21] lucenenet git commit: Lucene.Net.Core.Index (IndexWriterConfig + LiveIndexWriterConfig) refactor: changed OpenMode properties, field, and setter methods to be non-nullable.
Date Sun, 12 Mar 2017 16:38:15 GMT
Lucene.Net.Core.Index (IndexWriterConfig + LiveIndexWriterConfig) refactor: changed OpenMode
properties, field, and setter methods to be non-nullable.


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

Branch: refs/heads/api-work
Commit: a0720cc929d9e0de10b0efc3fda25af5e1e2f5e0
Parents: 72b0baf
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Mar 12 19:02:18 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Mar 12 23:21:31 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Index/IndexWriterConfig.cs           | 11 ++++++-----
 src/Lucene.Net.Core/Index/LiveIndexWriterConfig.cs       |  4 ++--
 .../Support/IndexWriterConfigExtensions.cs               |  2 +-
 .../Taxonomy/Directory/DirectoryTaxonomyWriter.cs        |  2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a0720cc9/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 829ab7c..e357f3d 100644
--- a/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
+++ b/src/Lucene.Net.Core/Index/IndexWriterConfig.cs
@@ -207,7 +207,7 @@ namespace Lucene.Net.Index
         /// </summary>
         // LUCENENET NOTE: We cannot override a getter and add a setter, 
         // so must declare it new. See: http://stackoverflow.com/q/82437
-        new public OpenMode? OpenMode // LUCENENET TODO: Make non-nullable if possible
+        new public OpenMode OpenMode
         {
             get
             {
@@ -215,10 +215,11 @@ namespace Lucene.Net.Index
             }
             set
             {
-                if (value == null)
-                {
-                    throw new System.ArgumentException("openMode must not be null");
-                }
+                // LUCENENET specific - making non-nullable, so we don't need to worry about
this.
+                //if (value == null)
+                //{
+                //    throw new System.ArgumentException("openMode must not be null");
+                //}
                 this.openMode = value;
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a0720cc9/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 d4ebf31..2ddf0dc 100644
--- a/src/Lucene.Net.Core/Index/LiveIndexWriterConfig.cs
+++ b/src/Lucene.Net.Core/Index/LiveIndexWriterConfig.cs
@@ -68,7 +68,7 @@ namespace Lucene.Net.Index
         /// <see cref="Index.OpenMode"/> that <see cref="IndexWriter"/> is opened
         /// with.
         /// </summary>
-        internal OpenMode? openMode; // LUCENENET TODO: Can we eliminate the nullable? If
so, make volatile again.
+        internal volatile OpenMode openMode;
 
         /// <summary>
         /// <see cref="Search.Similarities.Similarity"/> to use when encoding norms.
</summary>
@@ -471,7 +471,7 @@ namespace Lucene.Net.Index
 
         /// <summary>
         /// Gets the <see cref="Index.OpenMode"/> set by <see cref="IndexWriterConfig.OpenMode"/>
setter. </summary>
-        public virtual OpenMode? OpenMode
+        public virtual OpenMode OpenMode
         {
             get
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a0720cc9/src/Lucene.Net.Core/Support/IndexWriterConfigExtensions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/IndexWriterConfigExtensions.cs b/src/Lucene.Net.Core/Support/IndexWriterConfigExtensions.cs
index 52cb371..7cd2eb9 100644
--- a/src/Lucene.Net.Core/Support/IndexWriterConfigExtensions.cs
+++ b/src/Lucene.Net.Core/Support/IndexWriterConfigExtensions.cs
@@ -227,7 +227,7 @@ namespace Lucene.Net.Support
         /// <param name="config">this <see cref="IndexWriterConfig"/> instance</param>
         /// <param name="openMode"></param>
         /// <returns>this <see cref="IndexWriterConfig"/> instance</returns>
-        public static IndexWriterConfig SetOpenMode(this IndexWriterConfig config, OpenMode?
openMode)
+        public static IndexWriterConfig SetOpenMode(this IndexWriterConfig config, OpenMode
openMode)
         {
             config.OpenMode = openMode;
             return config;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a0720cc9/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 b3fa581..df819fb 100644
--- a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs
@@ -191,7 +191,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
 
             // after we opened the writer, and the index is locked, it's safe to check
             // the commit data and read the index epoch
-            openMode = config.OpenMode.HasValue ? config.OpenMode.Value : OpenMode.CREATE_OR_APPEND;
+            openMode = config.OpenMode;
             if (!DirectoryReader.IndexExists(directory))
             {
                 indexEpoch = 1;


Mime
View raw message