You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2014/12/31 09:39:44 UTC

[1/5] lucenenet git commit: use GetTryValue for dictionary lookups

Repository: lucenenet
Updated Branches:
  refs/heads/master aa1f8b4f0 -> 971b6a320


use GetTryValue for dictionary lookups


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

Branch: refs/heads/master
Commit: 0a03242e5f104c55e11a632ea8307e47d05bd0d4
Parents: 6f88e8a
Author: Laimonas Simutis <la...@gmail.com>
Authored: Tue Dec 30 20:53:55 2014 -0500
Committer: Laimonas Simutis <la...@gmail.com>
Committed: Tue Dec 30 20:53:55 2014 -0500

----------------------------------------------------------------------
 .../Codecs/Lucene42/Lucene42DocValuesProducer.cs          | 10 ++++------
 src/Lucene.Net.Core/Search/LiveFieldValues.cs             |  5 +++--
 2 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0a03242e/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
index 2648940..b635128 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
@@ -356,8 +356,8 @@ namespace Lucene.Net.Codecs.Lucene42
         {
             lock (this)
             {
-                BinaryDocValues instance = BinaryInstances[field.Number];
-                if (instance == null)
+                BinaryDocValues instance;
+                if (!BinaryInstances.TryGetValue(field.Number, out instance))
                 {
                     instance = LoadBinary(field);
                     BinaryInstances[field.Number] = instance;
@@ -435,8 +435,7 @@ namespace Lucene.Net.Codecs.Lucene42
             FST<long> instance;
             lock (this)
             {
-                instance = FstInstances[field.Number];
-                if (instance == null)
+                if (!FstInstances.TryGetValue(field.Number, out instance))
                 {
                     Data.Seek(entry.Offset);
                     instance = new FST<long>(Data, PositiveIntOutputs.Singleton);
@@ -554,8 +553,7 @@ namespace Lucene.Net.Codecs.Lucene42
             FST<long> instance;
             lock (this)
             {
-                instance = FstInstances[field.Number];
-                if (instance == null)
+                if (!FstInstances.TryGetValue(field.Number, out instance))
                 {
                     Data.Seek(entry.Offset);
                     instance = new FST<long>((DataInput)Data, Lucene.Net.Util.Fst.PositiveIntOutputs.Singleton);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0a03242e/src/Lucene.Net.Core/Search/LiveFieldValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/LiveFieldValues.cs b/src/Lucene.Net.Core/Search/LiveFieldValues.cs
index a46e1f1..1e3920d 100644
--- a/src/Lucene.Net.Core/Search/LiveFieldValues.cs
+++ b/src/Lucene.Net.Core/Search/LiveFieldValues.cs
@@ -111,7 +111,8 @@ namespace Lucene.Net.Search
         public virtual T Get(string id)
         {
             // First try to get the "live" value:
-            T value = Current[id];
+            T value;
+            Current.TryGetValue(id, out value);
             if ((object)value == (object)MissingValue)
             {
                 // Deleted but the deletion is not yet reflected in
@@ -124,7 +125,7 @@ namespace Lucene.Net.Search
             }
             else
             {
-                value = Old[id];
+                Old.TryGetValue(id, out value);
                 if ((object)value == (object)MissingValue)
                 {
                     // Deleted but the deletion is not yet reflected in


[5/5] lucenenet git commit: Merge remote-tracking branch 'laimis/unicode_issues'

Posted by sy...@apache.org.
Merge remote-tracking branch 'laimis/unicode_issues'


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

Branch: refs/heads/master
Commit: 971b6a3201bf21732ba2c1e56e9e368212e72787
Parents: 644f101 645b21d
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Wed Dec 31 10:39:20 2014 +0200
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Wed Dec 31 10:39:20 2014 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Core/Support/Character.cs | 18 +++++++++++-------
 src/Lucene.Net.Core/Util/UnicodeUtil.cs  | 18 +++++++++++++++++-
 2 files changed, 28 insertions(+), 8 deletions(-)
----------------------------------------------------------------------



[4/5] lucenenet git commit: Merge remote-tracking branch 'laimis/dictionary_fixes'

Posted by sy...@apache.org.
Merge remote-tracking branch 'laimis/dictionary_fixes'


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

Branch: refs/heads/master
Commit: 644f10169185efe27b49c11b0a4bbff303005380
Parents: aa1f8b4 80e1f92
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Wed Dec 31 10:39:14 2014 +0200
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Wed Dec 31 10:39:14 2014 +0200

----------------------------------------------------------------------
 .../Codecs/Lucene42/Lucene42DocValuesProducer.cs          | 10 ++++------
 src/Lucene.Net.Core/Search/LiveFieldValues.cs             |  5 +++--
 src/Lucene.Net.Tests/core/Index/TestIndexWriterUnicode.cs |  2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------



[2/5] lucenenet git commit: make sure to use offset / length when comparing uft8 buffer

Posted by sy...@apache.org.
make sure to use offset / length when comparing uft8 buffer


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

Branch: refs/heads/master
Commit: 80e1f9226bcd026abd747de702f85721173cc36d
Parents: 0a03242
Author: Laimonas Simutis <la...@gmail.com>
Authored: Tue Dec 30 20:55:10 2014 -0500
Committer: Laimonas Simutis <la...@gmail.com>
Committed: Tue Dec 30 20:55:10 2014 -0500

----------------------------------------------------------------------
 src/Lucene.Net.Tests/core/Index/TestIndexWriterUnicode.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/80e1f922/src/Lucene.Net.Tests/core/Index/TestIndexWriterUnicode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterUnicode.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterUnicode.cs
index 5263810..c639f37 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterUnicode.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterUnicode.cs
@@ -248,7 +248,7 @@ namespace Lucene.Net.Index
                 UnicodeUtil.UTF16toUTF8(chars, 0, len, utf8);
 
                 string s1 = new string(chars, 0, len);
-                string s2 = Encoding.UTF8.GetString((byte[])(Array)utf8.Bytes);
+                string s2 = Encoding.UTF8.GetString(utf8.Bytes, utf8.Offset, utf8.Length);
                 Assert.AreEqual(s1, s2, "codepoint " + ch);
 
                 UnicodeUtil.UTF8toUTF16(utf8.Bytes, 0, utf8.Length, utf16);


[3/5] lucenenet git commit: fixes for handling surrogate chars properly

Posted by sy...@apache.org.
fixes for handling surrogate chars properly


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

Branch: refs/heads/master
Commit: 645b21d198523f984c71da307beab445285dd879
Parents: aa1f8b4
Author: Laimonas Simutis <la...@gmail.com>
Authored: Tue Dec 30 22:03:10 2014 -0500
Committer: Laimonas Simutis <la...@gmail.com>
Committed: Tue Dec 30 22:03:10 2014 -0500

----------------------------------------------------------------------
 src/Lucene.Net.Core/Support/Character.cs | 18 +++++++++++-------
 src/Lucene.Net.Core/Util/UnicodeUtil.cs  | 18 +++++++++++++++++-
 2 files changed, 28 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/645b21d1/src/Lucene.Net.Core/Support/Character.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Character.cs b/src/Lucene.Net.Core/Support/Character.cs
index 1bf1257..fc90896 100644
--- a/src/Lucene.Net.Core/Support/Character.cs
+++ b/src/Lucene.Net.Core/Support/Character.cs
@@ -80,15 +80,16 @@ namespace Lucene.Net.Support
 
         public static int ToChars(int codePoint, char[] dst, int dstIndex)
         {
-            // .NET Port: we don't have to do anything funky with surrogates here. chars are always UTF-16.
-            dst[dstIndex] = (char)codePoint;
-            return 1; // always 1 char written in .NET
+            var converted = UnicodeUtil.ToCharArray(new[] {codePoint}, 0, 1);
+
+            Array.Copy(converted, 0, dst, dstIndex, converted.Length);
+
+            return converted.Length;
         }
 
         public static char[] ToChars(int codePoint)
         {
-            // .NET Port: we don't have to do anything funky with surrogates here. chars are always UTF-16.
-            return new[] { (char)codePoint };
+            return UnicodeUtil.ToCharArray(new[] {codePoint}, 0, 1);
         }
 
         public static int ToCodePoint(char high, char low)
@@ -104,8 +105,11 @@ namespace Lucene.Net.Support
 
         public static int ToLowerCase(int codePoint)
         {
-            // .NET Port: chars are always UTF-16 in .NET
-            return (int)char.ToLower((char)codePoint);
+            var str = UnicodeUtil.NewString(new[] {codePoint}, 0, 1);
+
+            str = str.ToLower();
+
+            return CodePointAt(str, 0);
         }
 
         public static int CharCount(int codePoint)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/645b21d1/src/Lucene.Net.Core/Util/UnicodeUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/UnicodeUtil.cs b/src/Lucene.Net.Core/Util/UnicodeUtil.cs
index 931142f..8623ca4 100644
--- a/src/Lucene.Net.Core/Util/UnicodeUtil.cs
+++ b/src/Lucene.Net.Core/Util/UnicodeUtil.cs
@@ -538,6 +538,19 @@ namespace Lucene.Net.Util
         /// <exception cref="IndexOutOfBoundsException"> If the offset or count are out of bounds. </exception>
         public static string NewString(int[] codePoints, int offset, int count)
         {
+            var chars = ToCharArray(codePoints, offset, count);
+            return new string(chars);
+        }
+
+        /// <summary>
+        /// Generates char array that represents the provided input code points
+        /// </summary>
+        /// <param name="codePoints"> The code array </param>
+        /// <param name="offset"> The start of the text in the code point array </param>
+        /// <param name="count"> The number of code points </param>
+        /// <returns> a char array representing the code points between offset and count </returns>
+        public static char[] ToCharArray(int[] codePoints, int offset, int count)
+        {
             if (count < 0)
             {
                 throw new System.ArgumentException();
@@ -577,7 +590,10 @@ namespace Lucene.Net.Util
                     }
                 }
             }
-            return new string(chars, 0, w);
+
+            var result = new char[w];
+            Array.Copy(chars, result, w);
+            return result;
         }
 
         // for debugging