lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [04/10] lucenenet git commit: API: Lucene.Net.QueryParser.Flexible: Added an overload of type StringBuilder for all ICharSequence-based methods and constructors (closes LUCENENET-592).
Date Fri, 20 Oct 2017 10:55:31 GMT
API: Lucene.Net.QueryParser.Flexible: Added an overload of type StringBuilder for all ICharSequence-based
methods and constructors (closes LUCENENET-592).


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

Branch: refs/heads/master
Commit: 5b2480a440c1037825ab2caae5fe16e22cc6e7ba
Parents: 6719968
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Thu Oct 19 22:37:59 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Thu Oct 19 23:16:58 2017 +0700

----------------------------------------------------------------------
 .../Flexible/Core/Nodes/FieldQueryNode.cs       | 17 ++++++++++-
 .../Flexible/Core/Nodes/FuzzyQueryNode.cs       | 16 +++++++++++
 .../Flexible/Core/Nodes/QuotedFieldQueryNode.cs | 17 ++++++++++-
 .../Flexible/Core/Util/UnescapedCharSequence.cs | 30 +++++++++++++++-----
 .../Standard/Nodes/PrefixWildcardQueryNode.cs   | 17 ++++++++++-
 .../Flexible/Standard/Nodes/RegexpQueryNode.cs  | 17 ++++++++++-
 .../Standard/Nodes/WildcardQueryNode.cs         | 17 ++++++++++-
 7 files changed, 119 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5b2480a4/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/FieldQueryNode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/FieldQueryNode.cs b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/FieldQueryNode.cs
index 5e1731f..c819a05 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/FieldQueryNode.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/FieldQueryNode.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.QueryParsers.Flexible.Core.Parser;
 using Lucene.Net.Support;
 using System.Globalization;
+using System.Text;
 
 namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes
 {
@@ -61,7 +62,21 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes
          // LUCENENET specific overload for passing text as string
         public FieldQueryNode(string field, string text, int begin,
             int end)
-            : this(field, new StringCharSequenceWrapper(text), begin, end)
+            : this(field, text.ToCharSequence(), begin, end)
+        {
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="field">field name</param>
+        /// <param name="text">value</param>
+        /// <param name="begin">position in the query string</param>
+        /// <param name="end">position in the query string</param>
+         // LUCENENET specific overload for passing text as StringBuilder
+        public FieldQueryNode(string field, StringBuilder text, int begin,
+            int end)
+            : this(field, text.ToCharSequence(), begin, end)
         {
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5b2480a4/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/FuzzyQueryNode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/FuzzyQueryNode.cs b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/FuzzyQueryNode.cs
index fb4ba7f..2618ee3 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/FuzzyQueryNode.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/FuzzyQueryNode.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.QueryParsers.Flexible.Core.Parser;
 using Lucene.Net.Support;
+using System.Text;
 
 namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes
 {
@@ -53,6 +54,21 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes
         /// <param name="minSimilarity">similarity value</param>
         /// <param name="begin">position in the query string</param>
         /// <param name="end">position in the query string</param>
+         // LUCENENET specific overload for StringBuilder term
+        public FuzzyQueryNode(string field, StringBuilder term,
+            float minSimilarity, int begin, int end)
+            : this(field, term.ToCharSequence(), minSimilarity, begin, end)
+        {
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="field">Name of the field query will use.</param>
+        /// <param name="term">Term token to use for building term for the query</param>
+        /// <param name="minSimilarity">similarity value</param>
+        /// <param name="begin">position in the query string</param>
+        /// <param name="end">position in the query string</param>
         public FuzzyQueryNode(string field, ICharSequence term,
             float minSimilarity, int begin, int end)
             : base(field, term, begin, end)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5b2480a4/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QuotedFieldQueryNode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QuotedFieldQueryNode.cs b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QuotedFieldQueryNode.cs
index 2217b66..0e37fde 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QuotedFieldQueryNode.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QuotedFieldQueryNode.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.QueryParsers.Flexible.Core.Parser;
 using Lucene.Net.Support;
+using System.Text;
 
 namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes
 {
@@ -33,7 +34,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes
         /// <param name="text">value</param>
         /// <param name="begin">position in the query string</param>
         /// <param name="end">position in the query string</param>
-        // LUCENENET specific overload for text string
+        // LUCENENET specific overload for string text
         public QuotedFieldQueryNode(string field, string text, int begin,
             int end)
             : this(field, text.ToCharSequence(), begin, end)
@@ -47,6 +48,20 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes
         /// <param name="text">value</param>
         /// <param name="begin">position in the query string</param>
         /// <param name="end">position in the query string</param>
+        // LUCENENET specific overload for StringBuilder text
+        public QuotedFieldQueryNode(string field, StringBuilder text, int begin,
+            int end)
+            : this(field, text.ToCharSequence(), begin, end)
+        {
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="field">field name</param>
+        /// <param name="text">value</param>
+        /// <param name="begin">position in the query string</param>
+        /// <param name="end">position in the query string</param>
         public QuotedFieldQueryNode(string field, ICharSequence text, int begin,
             int end)
             : base(field, text, begin, end)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5b2480a4/src/Lucene.Net.QueryParser/Flexible/Core/Util/UnescapedCharSequence.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/Util/UnescapedCharSequence.cs b/src/Lucene.Net.QueryParser/Flexible/Core/Util/UnescapedCharSequence.cs
index cf5d2be..a13f9bf 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Core/Util/UnescapedCharSequence.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Core/Util/UnescapedCharSequence.cs
@@ -57,9 +57,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Util
         }
 
         /// <summary>
-        /// Create a non-escaped <see cref="ICharSequence"/>
+        /// Create a non-escaped <see cref="string"/>
         /// </summary>
-         // LUCENENET specific overload for text as string
+        // LUCENENET specific overload for text as string
         public UnescapedCharSequence(string text)
         {
             this.chars = new char[text.Length];
@@ -72,19 +72,35 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Util
         }
 
         /// <summary>
-        /// Create a copy of an existent <see cref="UnescapedCharSequence"/>
+        /// Create a non-escaped <see cref="StringBuilder"/>
         /// </summary>
-        private UnescapedCharSequence(UnescapedCharSequence text)
+        // LUCENENET specific overload for text as StringBuilder
+        public UnescapedCharSequence(StringBuilder text)
         {
             this.chars = new char[text.Length];
             this.wasEscaped = new bool[text.Length];
-            for (int i = 0; i <= text.Length; i++)
+            for (int i = 0; i < text.Length; i++)
             {
-                this.chars[i] = text.chars[i];
-                this.wasEscaped[i] = text.wasEscaped[i];
+                this.chars[i] = text[i];
+                this.wasEscaped[i] = false;
             }
         }
 
+        // LUCENENET specific - not needed (see LUCENENET-592)
+        ///// <summary>
+        ///// Create a copy of an existent <see cref="UnescapedCharSequence"/>
+        ///// </summary>
+        //private UnescapedCharSequence(UnescapedCharSequence text)
+        //{
+        //    this.chars = new char[text.Length];
+        //    this.wasEscaped = new bool[text.Length];
+        //    for (int i = 0; i <= text.Length; i++)
+        //    {
+        //        this.chars[i] = text.chars[i];
+        //        this.wasEscaped[i] = text.wasEscaped[i];
+        //    }
+        //}
+
         //public char CharAt(int index) // LUCENENET specific - replaced with this[index]
         //{
         //    return this.chars[index];

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5b2480a4/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/PrefixWildcardQueryNode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/PrefixWildcardQueryNode.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/PrefixWildcardQueryNode.cs
index 99da6a9..c512efc 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/PrefixWildcardQueryNode.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/PrefixWildcardQueryNode.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
 using Lucene.Net.Support;
+using System.Text;
 
 namespace Lucene.Net.QueryParsers.Flexible.Standard.Nodes
 {
@@ -38,7 +39,21 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Nodes
         // LUCENENET specific overload for passing text as string
         public PrefixWildcardQueryNode(string field, string text,
             int begin, int end)
-            : this(field, new StringCharSequenceWrapper(text), begin, end)
+            : this(field, text.ToCharSequence(), begin, end)
+        {
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="field">field name</param>
+        /// <param name="text">value including the wildcard</param>
+        /// <param name="begin">position in the query string</param>
+        /// <param name="end">position in the query string</param>
+        // LUCENENET specific overload for passing text as StringBuilder
+        public PrefixWildcardQueryNode(string field, StringBuilder text,
+            int begin, int end)
+            : this(field, text.ToCharSequence(), begin, end)
         {
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5b2480a4/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/RegexpQueryNode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/RegexpQueryNode.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/RegexpQueryNode.cs
index bd434c4..e81b948 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/RegexpQueryNode.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/RegexpQueryNode.cs
@@ -2,6 +2,7 @@
 using Lucene.Net.QueryParsers.Flexible.Core.Parser;
 using Lucene.Net.Support;
 using Lucene.Net.Util;
+using System.Text;
 
 namespace Lucene.Net.QueryParsers.Flexible.Standard.Nodes
 {
@@ -40,7 +41,21 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Nodes
         // LUCENENET specific overload for passing text as string
         public RegexpQueryNode(string field, string text, int begin,
             int end)
-            : this(field, new StringCharSequenceWrapper(text), begin, end)
+            : this(field, text.ToCharSequence(), begin, end)
+        {
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="field">field name</param>
+        /// <param name="text">value that contains a regular expression</param>
+        /// <param name="begin">position in the query string</param>
+        /// <param name="end">position in the query string</param>
+        // LUCENENET specific overload for passing text as StringBuilder
+        public RegexpQueryNode(string field, StringBuilder text, int begin,
+            int end)
+            : this(field, text.ToCharSequence(), begin, end)
         {
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5b2480a4/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/WildcardQueryNode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/WildcardQueryNode.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/WildcardQueryNode.cs
index 5cb764d..b1bb957 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/WildcardQueryNode.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/WildcardQueryNode.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
 using Lucene.Net.QueryParsers.Flexible.Core.Parser;
 using Lucene.Net.Support;
+using System.Text;
 
 namespace Lucene.Net.QueryParsers.Flexible.Standard.Nodes
 {
@@ -37,7 +38,21 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Nodes
         // LUCENENET specific overload for passing text as string
         public WildcardQueryNode(string field, string text, int begin,
             int end)
-            : this(field, new StringCharSequenceWrapper(text), begin, end)
+            : this(field, text.ToCharSequence(), begin, end)
+        {
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="field">field name</param>
+        /// <param name="text">value that contains one or more wild card characters
(? or *)</param>
+        /// <param name="begin">position in the query string</param>
+        /// <param name="end">position in the query string</param>
+        // LUCENENET specific overload for passing text as StringBuilder
+        public WildcardQueryNode(string field, StringBuilder text, int begin,
+            int end)
+            : this(field, text.ToCharSequence(), begin, end)
         {
         }
 


Mime
View raw message