lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r905367 - /lucene/lucene.net/trunk/C#/src/Lucene.Net/Index/Term.cs
Date Mon, 01 Feb 2010 18:58:57 GMT
Author: digy
Date: Mon Feb  1 18:58:57 2010
New Revision: 905367

URL: http://svn.apache.org/viewvc?rev=905367&view=rev
Log:
LUCENENET-338 Serialized queries function unreliably

Modified:
    lucene/lucene.net/trunk/C#/src/Lucene.Net/Index/Term.cs

Modified: lucene/lucene.net/trunk/C#/src/Lucene.Net/Index/Term.cs
URL: http://svn.apache.org/viewvc/lucene/lucene.net/trunk/C%23/src/Lucene.Net/Index/Term.cs?rev=905367&r1=905366&r2=905367&view=diff
==============================================================================
--- lucene/lucene.net/trunk/C#/src/Lucene.Net/Index/Term.cs (original)
+++ lucene/lucene.net/trunk/C#/src/Lucene.Net/Index/Term.cs Mon Feb  1 18:58:57 2010
@@ -30,7 +30,7 @@
 	/// </summary>
 	
 	[Serializable]
-	public sealed class Term : System.IComparable
+    public sealed class Term : System.IComparable, System.Runtime.Serialization.ISerializable
 	{
 		internal System.String field;
 		internal System.String text;
@@ -165,19 +165,17 @@
 //			field = StringHelper.Intern(field);
 //		}
 
-		public void  GetobjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext
context)
-		{
-			System.Type thisType = this.GetType();
-			System.Reflection.MemberInfo[] mi = System.Runtime.Serialization.FormatterServices.GetSerializableMembers(thisType,
context);
-			for (int i = 0 ; i < mi.Length; i++) 
-			{
-				info.AddValue(mi[i].Name, ((System.Reflection.FieldInfo) mi[i]).GetValue(this));
-			}
-
-            field = StringHelper.Intern(field);
+        public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext
context)
+        {
+            info.AddValue("text", text);
+            info.AddValue("field", field);
+        }
 
-            System.Diagnostics.Debug.Fail("Port issue", "This needs checking; see ReadObject()
for the non-ported Java version."); // {{Aroush-2.9}}
-		}
+        protected Term(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext
context)
+        {
+            text = (string)info.GetValue("text", typeof(string));
+            field = StringHelper.Intern((string)info.GetValue("field", typeof(string)));
+        }
 
         public System.String text_ForNUnit
         {



Mime
View raw message