lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [05/12] lucenenet git commit: Fixed bug in the Core.Search.Query class. We cannot set the Boost property in the constructor, since subclasses can override it and throw exceptions.
Date Sun, 02 Oct 2016 10:22:16 GMT
Fixed bug in the Core.Search.Query class. We cannot set the Boost property in the constructor,
since subclasses can override it and throw exceptions.


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

Branch: refs/heads/master
Commit: 834d91e7b8e0aa7ff169c1d44c2b9a3eec14f23e
Parents: 5daf702
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Thu Sep 22 12:31:16 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Thu Sep 22 12:31:16 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Search/Query.cs | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/834d91e7/src/Lucene.Net.Core/Search/Query.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Query.cs b/src/Lucene.Net.Core/Search/Query.cs
index affbdc5..c765dab 100644
--- a/src/Lucene.Net.Core/Search/Query.cs
+++ b/src/Lucene.Net.Core/Search/Query.cs
@@ -48,17 +48,21 @@ namespace Lucene.Net.Search
     /// </summary>
     public abstract class Query : ICloneable
     {
-        protected Query()
-        {
-            Boost = 1.0f; // query boost factor
-        }
+        // LUCENENET NOTE: We can't set the default boost in the constructor because the
+        // Boost property can be overridden by subclasses (and possibly throw exceptions).
+        private float boost = 1.0f; // query boost factor
+
 
         /// <summary>
         /// Sets the boost for this query clause to <code>b</code>.  Documents
         /// matching this clause will (in addition to the normal weightings) have
         /// their score multiplied by <code>b</code>.
         /// </summary>
-        public virtual float Boost { get; set; }
+        public virtual float Boost
+        {
+            get { return boost; }
+            set { boost = value; }
+        }
 
         /// <summary>
         /// Prints a query to a string, with <code>field</code> assumed to be
the


Mime
View raw message