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: Changed IndexableField.GetBoost() to IndexableField.Boost (method into a property) for API consistency.
Date Mon, 15 Aug 2016 20:12:51 GMT
Changed IndexableField.GetBoost() to IndexableField.Boost (method into a property) for API
consistency.


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

Branch: refs/heads/master
Commit: 87aa4246960f41cf2df24e2561f2ef981f14f60d
Parents: b83de2c
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Fri Jul 29 00:46:54 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Fri Jul 29 00:46:54 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Document/Field.cs              | 17 ++++++-----------
 src/Lucene.Net.Core/Index/DocInverterPerField.cs   |  4 ++--
 src/Lucene.Net.Core/Index/IndexableField.cs        |  2 +-
 src/Lucene.Net.Tests/core/Document/TestField.cs    |  4 ++--
 .../core/Index/TestIndexWriterExceptions.cs        |  4 ++--
 .../core/Index/TestIndexableField.cs               |  4 ++--
 6 files changed, 15 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/87aa4246/src/Lucene.Net.Core/Document/Field.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Document/Field.cs b/src/Lucene.Net.Core/Document/Field.cs
index 6fcdc2e..3e6f834 100644
--- a/src/Lucene.Net.Core/Document/Field.cs
+++ b/src/Lucene.Net.Core/Document/Field.cs
@@ -486,22 +486,17 @@ namespace Lucene.Net.Documents
         }
 
         /// <summary>
-        /// {@inheritDoc}
-        /// <p>
-        /// The default value is <code>1.0f</code> (no boost). </summary>
-        /// <seealso> cref= #setBoost(float) </seealso>
-        public float GetBoost()
-        {
-            return Boost_Renamed;
-        }
-
-        /// <summary>
-        /// Sets the boost factor on this field. </summary>
+        /// Gets or sets the boost factor on this field. </summary>
+        /// <remarks>The default value is <code>1.0f</code> (no boost).</remarks>
         /// <exception cref="IllegalArgumentException"> if this field is not indexed,
         ///         or if it omits norms. </exception>
         /// <seealso> cref= #boost() </seealso>
         public virtual float Boost
         {
+            get
+            {
+                return Boost_Renamed;
+            }
             set
             {
                 if (value != 1.0f)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/87aa4246/src/Lucene.Net.Core/Index/DocInverterPerField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/DocInverterPerField.cs b/src/Lucene.Net.Core/Index/DocInverterPerField.cs
index e6c9ac4..4dab2e9 100644
--- a/src/Lucene.Net.Core/Index/DocInverterPerField.cs
+++ b/src/Lucene.Net.Core/Index/DocInverterPerField.cs
@@ -79,7 +79,7 @@ namespace Lucene.Net.Index
                     bool analyzed = fieldType.Tokenized && DocState.Analyzer != null;
 
                     // if the field omits norms, the boost cannot be indexed.
-                    if (fieldType.OmitNorms && field.GetBoost() != 1.0f)
+                    if (fieldType.OmitNorms && field.Boost != 1.0f)
                     {
                         throw new System.NotSupportedException("You cannot set an index-time
boost: norms are omitted for field '" + field.Name + "'");
                     }
@@ -234,7 +234,7 @@ namespace Lucene.Net.Index
                     }
 
                     FieldState.Offset_Renamed += analyzed ? DocState.Analyzer.GetOffsetGap(fieldInfo.Name)
: 0;
-                    FieldState.Boost_Renamed *= field.GetBoost();
+                    FieldState.Boost_Renamed *= field.Boost;
                 }
 
                 // LUCENE-2387: don't hang onto the field, so GC can

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/87aa4246/src/Lucene.Net.Core/Index/IndexableField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexableField.cs b/src/Lucene.Net.Core/Index/IndexableField.cs
index cf4005e..fbd6a85 100644
--- a/src/Lucene.Net.Core/Index/IndexableField.cs
+++ b/src/Lucene.Net.Core/Index/IndexableField.cs
@@ -70,7 +70,7 @@ namespace Lucene.Net.Index
         /// </summary>
         /// <seealso cref= Similarity#computeNorm(FieldInvertState) </seealso>
         /// <seealso cref= DefaultSimilarity#encodeNormValue(float) </seealso>
-        float GetBoost();
+        float Boost { get; }
 
         /// <summary>
         /// Non-null if this field has a binary value </summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/87aa4246/src/Lucene.Net.Tests/core/Document/TestField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Document/TestField.cs b/src/Lucene.Net.Tests/core/Document/TestField.cs
index 8a0bde7..ab1016f 100644
--- a/src/Lucene.Net.Tests/core/Document/TestField.cs
+++ b/src/Lucene.Net.Tests/core/Document/TestField.cs
@@ -280,7 +280,7 @@ namespace Lucene.Net.Document
                 field.TokenStream = new CannedTokenStream(new Token("foo", 0, 3));
 
                 Assert.AreEqual("baz", field.StringValue);
-                Assert.AreEqual(5f, field.GetBoost(), 0f);
+                Assert.AreEqual(5f, field.Boost, 0f);
             }
         }
 
@@ -303,7 +303,7 @@ namespace Lucene.Net.Document
             field.TokenStream = new CannedTokenStream(new Token("foo", 0, 3));
 
             Assert.IsNotNull(field.ReaderValue);
-            Assert.AreEqual(5f, field.GetBoost(), 0f);
+            Assert.AreEqual(5f, field.Boost, 0f);
         }
 
         /* TODO: this is pretty expert and crazy

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/87aa4246/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
index a80f4ee..cfc66b4 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
@@ -2014,9 +2014,9 @@ namespace Lucene.Net.Index
                 get { return StringField.TYPE_NOT_STORED; }
             }
 
-            public float GetBoost()
+            public float Boost
             {
-                return 5f;
+                get { return 5f; }
             }
 
             public BytesRef BinaryValue()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/87aa4246/src/Lucene.Net.Tests/core/Index/TestIndexableField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexableField.cs b/src/Lucene.Net.Tests/core/Index/TestIndexableField.cs
index 6da64d2..8790059 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexableField.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexableField.cs
@@ -157,9 +157,9 @@ namespace Lucene.Net.Index
                 get { return "f" + Counter; }
             }
 
-            public float GetBoost()
+            public float Boost
             {
-                return 1.0f + (float)Random().NextDouble();
+                get { return 1.0f + (float)Random().NextDouble(); }
             }
 
             public BytesRef BinaryValue()


Mime
View raw message