You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2020/02/03 16:38:58 UTC

[lucenenet] 03/08: BREAKING: Lucene.Net.Support: Factored out StringExtensions

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit a84d19bafa1c55144a83485b54b698188e31c283
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Feb 3 21:25:04 2020 +0700

    BREAKING: Lucene.Net.Support: Factored out StringExtensions
---
 src/Lucene.Net.Tests/Document/TestField.cs |  7 +++----
 src/Lucene.Net/Support/StringExtensions.cs | 31 ------------------------------
 2 files changed, 3 insertions(+), 35 deletions(-)

diff --git a/src/Lucene.Net.Tests/Document/TestField.cs b/src/Lucene.Net.Tests/Document/TestField.cs
index 4e7c91e..186d4b9 100644
--- a/src/Lucene.Net.Tests/Document/TestField.cs
+++ b/src/Lucene.Net.Tests/Document/TestField.cs
@@ -6,7 +6,6 @@ using Lucene.Net.Documents.Extensions;
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Store;
-using Lucene.Net.Support;
 using Lucene.Net.Util;
 using NUnit.Framework;
 using System.IO;
@@ -207,7 +206,7 @@ namespace Lucene.Net.Documents
 
             TrySetBoost(field);
             TrySetByteValue(field);
-            field.SetBytesValue("fubar".ToBytesRefArray(Encoding.UTF8));
+            field.SetBytesValue("fubar".GetBytes(Encoding.UTF8));
             field.SetBytesValue(new BytesRef("baz"));
             TrySetDoubleValue(field);
             TrySetIntValue(field);
@@ -228,7 +227,7 @@ namespace Lucene.Net.Documents
 
             TrySetBoost(field);
             TrySetByteValue(field);
-            field.SetBytesValue("fubar".ToBytesRefArray(Encoding.UTF8));
+            field.SetBytesValue("fubar".GetBytes(Encoding.UTF8));
             field.SetBytesValue(new BytesRef("baz"));
             TrySetDoubleValue(field);
             TrySetIntValue(field);
@@ -328,7 +327,7 @@ namespace Lucene.Net.Documents
             {
                 TrySetBoost(field);
                 TrySetByteValue(field);
-                field.SetBytesValue("baz".ToBytesRefArray(Encoding.UTF8));
+                field.SetBytesValue("baz".GetBytes(Encoding.UTF8));
                 field.SetBytesValue(new BytesRef("baz"));
                 TrySetDoubleValue(field);
                 TrySetIntValue(field);
diff --git a/src/Lucene.Net/Support/StringExtensions.cs b/src/Lucene.Net/Support/StringExtensions.cs
deleted file mode 100644
index af19f93..0000000
--- a/src/Lucene.Net/Support/StringExtensions.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using J2N.Text;
-using Lucene.Net.Util;
-using System.Text;
-
-namespace Lucene.Net.Support
-{
-    /*
-     * Licensed to the Apache Software Foundation (ASF) under one or more
-     * contributor license agreements.  See the NOTICE file distributed with
-     * this work for additional information regarding copyright ownership.
-     * The ASF licenses this file to You under the Apache License, Version 2.0
-     * (the "License"); you may not use this file except in compliance with
-     * the License.  You may obtain a copy of the License at
-     *
-     *     http://www.apache.org/licenses/LICENSE-2.0
-     *
-     * Unless required by applicable law or agreed to in writing, software
-     * distributed under the License is distributed on an "AS IS" BASIS,
-     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     * See the License for the specific language governing permissions and
-     * limitations under the License.
-     */
-
-    public static class StringExtensions
-    {
-        public static BytesRef ToBytesRefArray(this string str, Encoding enc)
-        {
-            return new BytesRef(str.GetBytes(enc));
-        }
-    }
-}
\ No newline at end of file