lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject lucenenet git commit: Fixing ToString tests
Date Mon, 09 Feb 2015 02:12:08 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 4ab09e4f5 -> a99c15cd4


Fixing ToString tests


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

Branch: refs/heads/master
Commit: a99c15cd4706f3a84772b56b68e5fff0bceafbaf
Parents: 4ab09e4
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Mon Feb 9 04:11:52 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Mon Feb 9 04:11:52 2015 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Core/Search/BooleanClause.cs | 61 +++++++++---------------
 src/Lucene.Net.Queries/BooleanFilter.cs     |  6 +--
 src/Lucene.Net.Queries/FilterClause.cs      |  2 +-
 3 files changed, 24 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a99c15cd/src/Lucene.Net.Core/Search/BooleanClause.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/BooleanClause.cs b/src/Lucene.Net.Core/Search/BooleanClause.cs
index 9b89dae..82256ce 100644
--- a/src/Lucene.Net.Core/Search/BooleanClause.cs
+++ b/src/Lucene.Net.Core/Search/BooleanClause.cs
@@ -1,4 +1,5 @@
 using System;
+using System.ComponentModel;
 
 namespace Lucene.Net.Search
 {
@@ -27,46 +28,28 @@ namespace Lucene.Net.Search
         /// Specifies how clauses are to occur in matching documents. </summary>
         public enum Occur
         {
-            MUST, SHOULD, MUST_NOT/*
-		/// <summary>
-		/// Use this operator for clauses that <i>must</i> appear in the matching documents.
</summary>
-		MUST
-        {
-            public string toString()
-            {
-                return "+";
-	        }
-	    },
-
-		/// <summary>
-		/// Use this operator for clauses that <i>should</i> appear in the
-		/// matching documents. For a BooleanQuery with no <code>MUST</code>
-		/// clauses one or more <code>SHOULD</code> clauses must match a document
-		/// for the BooleanQuery to match. </summary>
-		/// <seealso cref= BooleanQuery#setMinimumNumberShouldMatch </seealso>
-		SHOULD
-		{
-			public string ToString()
-			{
-				return "";
-			}
-		},
-
-		/// <summary>
-		/// Use this operator for clauses that <i>must not</i> appear in the matching
documents.
-		/// Note that it is not possible to search for queries that only consist
-		/// of a <code>MUST_NOT</code> clause.
-		/// </summary>
-		MUST_NOT
-		{
-			public string ToString()
-			{
-				return "-";
-			}
-		}*/
+            /// <summary>
+            /// Use this operator for clauses that <i>must</i> appear in the
matching documents.
+            /// </summary>
+            MUST,
+
+            /// <summary>
+            /// Use this operator for clauses that <i>should</i> appear in the
+            /// matching documents. For a BooleanQuery with no <code>MUST</code>
+            /// clauses one or more <code>SHOULD</code> clauses must match a
document
+            /// for the BooleanQuery to match. </summary>
+            /// <seealso cref= BooleanQuery#setMinimumNumberShouldMatch</seealso>
+            SHOULD,
+
+            /// <summary>
+            /// Use this operator for clauses that <i>must not</i> appear in
the matching documents.
+            /// Note that it is not possible to search for queries that only consist
+            /// of a <code>MUST_NOT</code> clause.
+            /// </summary>
+            MUST_NOT
         }
 
-        private string ToString(Occur occur)
+        public static string ToString(Occur occur)
         {
             switch (occur)
             {
@@ -80,7 +63,7 @@ namespace Lucene.Net.Search
                     return "-";
 
                 default:
-                    throw new Exception("Invalid Occur_e value");
+                    throw new Exception("Invalid Occur value");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a99c15cd/src/Lucene.Net.Queries/BooleanFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/BooleanFilter.cs b/src/Lucene.Net.Queries/BooleanFilter.cs
index 61a20bc..65979d4 100644
--- a/src/Lucene.Net.Queries/BooleanFilter.cs
+++ b/src/Lucene.Net.Queries/BooleanFilter.cs
@@ -177,11 +177,7 @@ namespace Lucene.Net.Queries
         /// Prints a user-readable version of this Filter. </summary>
         public override string ToString()
         {
-            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-            //ORIGINAL LINE: final StringBuilder buffer = new StringBuilder("BooleanFilter(");
-            StringBuilder buffer = new StringBuilder("BooleanFilter(");
-            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-            //ORIGINAL LINE: final int minLen = buffer.length();
+            var buffer = new StringBuilder("BooleanFilter(");
             int minLen = buffer.Length;
             foreach (FilterClause c in clauses)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a99c15cd/src/Lucene.Net.Queries/FilterClause.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/FilterClause.cs b/src/Lucene.Net.Queries/FilterClause.cs
index 3794102..e82f927 100644
--- a/src/Lucene.Net.Queries/FilterClause.cs
+++ b/src/Lucene.Net.Queries/FilterClause.cs
@@ -85,7 +85,7 @@ namespace Lucene.Net.Queries
 
         public override string ToString()
         {
-            return occur.ToString() + filter.ToString();
+            return BooleanClause.ToString(occur) + filter.ToString();
         }
     }
 }
\ No newline at end of file


Mime
View raw message