You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by di...@apache.org on 2009/11/11 19:02:19 UTC

svn commit: r834987 - in /incubator/lucene.net/trunk/C#/src: Lucene.Net/Index/TermVectorsReader.cs Lucene.Net/Index/TermsHashPerField.cs Lucene.Net/Store/IndexInput.cs Test/Index/TestAtomicUpdate.cs Test/Index/TestBackwardsCompatibility.cs

Author: digy
Date: Wed Nov 11 18:02:19 2009
New Revision: 834987

URL: http://svn.apache.org/viewvc?rev=834987&view=rev
Log:
LUCENENET-224 TestBackwardsCompatibility
LUCENENET-223 TestAtomicUpdate bug
LUCENENET-220 TestAddIndexesNoOptimize

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/TermVectorsReader.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/TermsHashPerField.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/IndexInput.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestAtomicUpdate.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestBackwardsCompatibility.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/TermVectorsReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/TermVectorsReader.cs?rev=834987&r1=834986&r2=834987&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/TermVectorsReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/TermVectorsReader.cs Wed Nov 11 18:02:19 2009
@@ -574,9 +574,7 @@
 						byteBuffer = newByteBuffer;
 					}
 					tvf.ReadBytes(byteBuffer, start, deltaLength);
-					System.String tempStr;
-					tempStr = System.Text.Encoding.GetEncoding("UTF-8").GetString(byteBuffer);
-					term = new System.String(tempStr.ToCharArray(), 0, totalLength);
+                    term = System.Text.Encoding.UTF8.GetString(byteBuffer, 0, totalLength);
 				}
 				int freq = tvf.ReadVInt();
 				int[] positions = null;

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/TermsHashPerField.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/TermsHashPerField.cs?rev=834987&r1=834986&r2=834987&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/TermsHashPerField.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/TermsHashPerField.cs Wed Nov 11 18:02:19 2009
@@ -106,10 +106,7 @@
 			if (numPostings > 0)
 			{
 				perThread.termsHash.RecyclePostings(postingsHash, numPostings);
-                for (int i = 0; i < numPostingInt; i++)
-                {
-                    postingsHash[i] = null;
-                }
+                Array.Clear(postingsHash, 0, numPostings);
 				numPostings = 0;
 			}
 			postingsCompacted = false;

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/IndexInput.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/IndexInput.cs?rev=834987&r1=834986&r2=834987&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/IndexInput.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/IndexInput.cs Wed Nov 11 18:02:19 2009
@@ -143,9 +143,7 @@
 				bytes = new byte[(int) (length * 1.25)];
 			}
 			ReadBytes(bytes, 0, length);
-			System.String tempStr;
-			tempStr = System.Text.Encoding.GetEncoding("UTF-8").GetString(bytes);
-			return new System.String(tempStr.ToCharArray(), 0, length);
+            return System.Text.Encoding.UTF8.GetString(bytes, 0, length);
 		}
 		
 		private System.String ReadModifiedUTF8String()

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestAtomicUpdate.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestAtomicUpdate.cs?rev=834987&r1=834986&r2=834987&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestAtomicUpdate.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestAtomicUpdate.cs Wed Nov 11 18:02:19 2009
@@ -81,28 +81,33 @@
 			{
 				this.allThreads = threads;
 			}
-			
-			override public void  Run()
-			{
-				long stopTime = System.DateTime.Now.Millisecond + 1000 * RUN_TIME_SEC;
-				
-				count = 0;
-				
-				try
-				{
-					while (System.DateTime.Now.Millisecond < stopTime && !AnyErrors())
-					{
-						DoWork();
-						count++;
-					}
-				}
-				catch (System.Exception e)
-				{
-					System.Console.Out.WriteLine(SupportClass.ThreadClass.Current().Name + ": exc");
-					System.Console.Out.WriteLine(e.StackTrace);
-					failed = true;
-				}
-			}
+
+            long Millisecond()
+            {
+                return System.DateTime.Now.Ticks / 10000;
+            }
+
+            override public void Run()
+            {
+                long stopTime = Millisecond() + 1000 * RUN_TIME_SEC;
+
+                count = 0;
+
+                try
+                {
+                    while (Millisecond() < stopTime && !AnyErrors())
+                    {
+                        DoWork();
+                        count++;
+                    }
+                }
+                catch (System.Exception e)
+                {
+                    System.Console.Out.WriteLine(SupportClass.ThreadClass.Current().Name + ": exc");
+                    System.Console.Out.WriteLine(e.StackTrace);
+                    failed = true;
+                }
+            }
 			
 			private bool AnyErrors()
 			{

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestBackwardsCompatibility.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestBackwardsCompatibility.cs?rev=834987&r1=834986&r2=834987&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestBackwardsCompatibility.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestBackwardsCompatibility.cs Wed Nov 11 18:02:19 2009
@@ -122,7 +122,7 @@
 		{
 			for (int i = 0; i < oldNames.Length; i++)
 			{
-				System.String dirName = "src/test/org/apache/lucene/index/index." + oldNames[i];
+				System.String dirName = "../../index/index." + oldNames[i];
 				Unzip(dirName, oldNames[i]);
 				System.String fullPath = FullDir(oldNames[i]);
 				Directory dir = FSDirectory.Open(new System.IO.FileInfo(fullPath));
@@ -141,7 +141,7 @@
 		{
 			for (int i = 0; i < oldNames.Length; i++)
 			{
-				System.String dirName = "src/test/org/apache/lucene/index/index." + oldNames[i];
+                System.String dirName = "../../index/index." + oldNames[i];
 				Unzip(dirName, oldNames[i]);
 				searchIndex(oldNames[i], oldNames[i]);
 				RmDir(oldNames[i]);
@@ -153,7 +153,7 @@
 		{
 			for (int i = 0; i < oldNames.Length; i++)
 			{
-				System.String dirName = "src/test/org/apache/lucene/index/index." + oldNames[i];
+                System.String dirName = "../../index/index." + oldNames[i];
 				Unzip(dirName, oldNames[i]);
 				ChangeIndexNoAdds(oldNames[i], true);
 				RmDir(oldNames[i]);
@@ -169,7 +169,7 @@
 		{
 			for (int i = 0; i < oldNames.Length; i++)
 			{
-				System.String dirName = "src/test/org/apache/lucene/index/index." + oldNames[i];
+                System.String dirName = "../../index/index." + oldNames[i];
 				Unzip(dirName, oldNames[i]);
 				ChangeIndexWithAdds(oldNames[i], true);
 				RmDir(oldNames[i]);