lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [14/15] lucenenet git commit: Lucene.Net.QueryParser.Flexible.Standard.StandardQueryParser.DefaultOperator refactor: changed to be non-nullable enum, and set the default value to OR by specifying its value as 0
Date Wed, 01 Feb 2017 05:19:13 GMT
Lucene.Net.QueryParser.Flexible.Standard.StandardQueryParser.DefaultOperator refactor: changed
to be non-nullable enum, and set the default value to OR by specifying its value as 0


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

Branch: refs/heads/api-work
Commit: a007becac5fd8786a461e476306a6932284d907a
Parents: 13db3e6
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Wed Feb 1 12:11:10 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Wed Feb 1 12:11:10 2017 +0700

----------------------------------------------------------------------
 .../Flexible/Standard/Config/StandardQueryConfigHandler.cs   | 6 +++---
 .../Standard/Processors/AnalyzerQueryNodeProcessor.cs        | 8 ++++++--
 .../Flexible/Standard/StandardQueryParser.cs                 | 2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a007beca/src/Lucene.Net.QueryParser/Flexible/Standard/Config/StandardQueryConfigHandler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/StandardQueryConfigHandler.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/StandardQueryConfigHandler.cs
index f526f36..db5b39f 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/StandardQueryConfigHandler.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/StandardQueryConfigHandler.cs
@@ -62,8 +62,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Config
         /// </summary>
         public enum Operator
         {
-            AND,
-            OR
+            AND = 1,
+            OR = 0 // LUCENENET: Default value if not set
         }
     }
 
@@ -100,7 +100,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Config
         /// Key used to set the default boolean operator
         /// </summary>
         /// <seealso cref="StandardQueryParser.DefaultOperator"/>
-        public readonly static ConfigurationKey<Operator?> DEFAULT_OPERATOR = ConfigurationKey.NewInstance<Operator?>();
+        public readonly static ConfigurationKey<Operator> DEFAULT_OPERATOR = ConfigurationKey.NewInstance<Operator>();
 
         /// <summary>
         /// Key used to set the default phrase slop

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a007beca/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs
index 15c52f8..89ce4fe 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/AnalyzerQueryNodeProcessor.cs
@@ -74,8 +74,12 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
                 this.analyzer = analyzer;
                 this.positionIncrementsEnabled = false;
                 bool? positionIncrementsEnabled = GetQueryConfigHandler().Get(ConfigurationKeys.ENABLE_POSITION_INCREMENTS);
-                var defaultOperator = GetQueryConfigHandler().Get(ConfigurationKeys.DEFAULT_OPERATOR);
-                this.defaultOperator = defaultOperator != null ? defaultOperator.Value :
Operator.OR;
+
+                // LUCENENET specific - rather than using null, we are relying on the behavior
that the default
+                // value for an enum is 0 (OR in this case).
+                //var defaultOperator = GetQueryConfigHandler().Get(ConfigurationKeys.DEFAULT_OPERATOR);
+                //this.defaultOperator = defaultOperator != null ? defaultOperator.Value
: Operator.OR;
+                this.defaultOperator = GetQueryConfigHandler().Get(ConfigurationKeys.DEFAULT_OPERATOR);
 
                 if (positionIncrementsEnabled != null)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a007beca/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs
index 48900b7..479ddb3 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs
@@ -157,7 +157,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
         /// In <see cref="Operator.AND"/> mode terms are considered to be in conjunction:
the
         /// above mentioned query is parsed as <c>capital AND of AND Hungary</c>
         /// </summary>
-        public virtual Operator? DefaultOperator
+        public virtual Operator DefaultOperator
         {
             get { return QueryConfigHandler.Get(ConfigurationKeys.DEFAULT_OPERATOR); }
             set { QueryConfigHandler.Set(ConfigurationKeys.DEFAULT_OPERATOR, value); }


Mime
View raw message