lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r836399 - in /incubator/lucene.net/trunk/C#/src: Lucene.Net/Search/FieldCache.cs Lucene.Net/Util/RamUsageEstimator.cs Test/Search/TestDocBoost.cs Test/Search/TestElevationComparator.cs Test/Search/TestFieldCache.cs
Date Sun, 15 Nov 2009 19:26:20 GMT
Author: digy
Date: Sun Nov 15 19:26:20 2009
New Revision: 836399

URL: http://svn.apache.org/viewvc?rev=836399&view=rev
Log:
LUCENENET-252 TestDocBoost, TestElevationComparator, TestFieldCache + RamUsageEstimator

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldCache.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/RamUsageEstimator.cs
    incubator/lucene.net/trunk/C#/src/Test/Search/TestDocBoost.cs
    incubator/lucene.net/trunk/C#/src/Test/Search/TestElevationComparator.cs
    incubator/lucene.net/trunk/C#/src/Test/Search/TestFieldCache.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldCache.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/FieldCache.cs?rev=836399&r1=836398&r2=836399&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldCache.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldCache.cs Sun Nov 15 19:26:20
2009
@@ -247,7 +247,14 @@
 	{
 		public virtual float ParseFloat(System.String value_Renamed)
 		{
-			return System.Single.Parse(value_Renamed);
+            try
+            {
+                return System.Single.Parse(value_Renamed);
+            }
+            catch (System.OverflowException)
+            {
+                return value_Renamed.StartsWith("-") ? float.PositiveInfinity : float.NegativeInfinity;
+            }
 		}
 		protected internal virtual System.Object ReadResolve()
 		{

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/RamUsageEstimator.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Util/RamUsageEstimator.cs?rev=836399&r1=836398&r2=836399&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/RamUsageEstimator.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/RamUsageEstimator.cs Sun Nov 15 19:26:20
2009
@@ -142,8 +142,7 @@
 					else
 					{
 						size += refSize;
-                        fields[i].GetType(); // {{Aroush-2.9}} how to do the following in
C#: java.lang.reflect.AccessibleObject.setAccessible(true)
-                        System.Diagnostics.Debug.Fail("Port issue:", "java.lang.reflect.AccessibleObject.setAccessible()");
+                        fields[i].GetType(); 
 						try
 						{
 							System.Object value_Renamed = fields[i].GetValue(obj);

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestDocBoost.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestDocBoost.cs?rev=836399&r1=836398&r2=836399&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestDocBoost.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestDocBoost.cs Sun Nov 15 19:26:20 2009
@@ -79,9 +79,6 @@
 				return true;
 			}
 		}
-		public TestDocBoost(System.String name):base(name)
-		{
-		}
 		
 		[Test]
 		public virtual void  TestDocBoost_Renamed()

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestElevationComparator.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestElevationComparator.cs?rev=836399&r1=836398&r2=836399&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestElevationComparator.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestElevationComparator.cs Sun Nov 15 19:26:20
2009
@@ -180,8 +180,8 @@
 			private int DocVal(int doc)
 			{
 				System.String id = idIndex.lookup[idIndex.order[doc]];
-				System.Int32 prio = (System.Int32) Enclosing_Instance.priority[id];
-				return Enclosing_Instance.priority[id] == null ? 0 : prio;
+				object prio = Enclosing_Instance.priority[id];
+                return prio == null ? 0 : (int)prio;
 			}
 			
 			public override int CompareBottom(int doc)

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestFieldCache.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestFieldCache.cs?rev=836399&r1=836398&r2=836399&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestFieldCache.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestFieldCache.cs Sun Nov 15 19:26:20 2009
@@ -36,10 +36,6 @@
 		protected internal IndexReader reader;
 		private const int NUM_DOCS = 1000;
 		
-		public TestFieldCache(System.String s):base(s)
-		{
-		}
-		
 		[SetUp]
 		public override void  SetUp()
 		{
@@ -56,11 +52,11 @@
 			{
 				Document doc = new Document();
 				doc.Add(new Field("theLong", System.Convert.ToString(theLong--), Field.Store.NO, Field.Index.NOT_ANALYZED));
-				doc.Add(new Field("theDouble", System.Convert.ToString(theDouble--), Field.Store.NO,
Field.Index.NOT_ANALYZED));
+				doc.Add(new Field("theDouble", theDouble.ToString("E16"), Field.Store.NO, Field.Index.NOT_ANALYZED));
 				doc.Add(new Field("theByte", System.Convert.ToString((byte) theByte--), Field.Store.NO,
Field.Index.NOT_ANALYZED));
 				doc.Add(new Field("theShort", System.Convert.ToString(theShort--), Field.Store.NO, Field.Index.NOT_ANALYZED));
 				doc.Add(new Field("theInt", System.Convert.ToString(theInt--), Field.Store.NO, Field.Index.NOT_ANALYZED));
-				doc.Add(new Field("theFloat", System.Convert.ToString(theFloat--), Field.Store.NO, Field.Index.NOT_ANALYZED));
+				doc.Add(new Field("theFloat", theFloat.ToString("E8"), Field.Store.NO, Field.Index.NOT_ANALYZED));
 				writer.AddDocument(doc);
 			}
 			writer.Close();
@@ -74,11 +70,13 @@
 			{
 				FieldCache cache = Lucene.Net.Search.FieldCache_Fields.DEFAULT;
 				System.IO.MemoryStream bos = new System.IO.MemoryStream(1024);
-				cache.SetInfoStream(new System.IO.StreamWriter(bos));
+                System.IO.StreamWriter writer = new System.IO.StreamWriter(bos);
+				cache.SetInfoStream(writer);
 				double[] doubles = cache.GetDoubles(reader, "theDouble");
 				float[] floats = cache.GetFloats(reader, "theDouble");
 				char[] tmpChar;
 				byte[] tmpByte;
+                writer.Flush();
 				tmpByte = bos.GetBuffer();
 				tmpChar = new char[bos.Length];
 				System.Array.Copy(tmpByte, 0, tmpChar, 0, tmpChar.Length);



Mime
View raw message