lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r907814 - /lucene/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldDoc.cs
Date Mon, 08 Feb 2010 21:43:11 GMT
Author: digy
Date: Mon Feb  8 21:43:10 2010
New Revision: 907814

URL: http://svn.apache.org/viewvc?rev=907814&view=rev
Log:
Lost patch of LUCENENET-100

Modified:
    lucene/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldDoc.cs

Modified: lucene/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldDoc.cs
URL: http://svn.apache.org/viewvc/lucene/lucene.net/trunk/C%23/src/Lucene.Net/Search/FieldDoc.cs?rev=907814&r1=907813&r2=907814&view=diff
==============================================================================
--- lucene/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldDoc.cs (original)
+++ lucene/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldDoc.cs Mon Feb  8 21:43:10 2010
@@ -85,5 +85,35 @@
 			sb.Append("]");
 			return base.ToString();
 		}
+
+        #region SERIALIZATION
+        internal object[] fieldsClone = null;
+
+        [System.Runtime.Serialization.OnSerializing]
+        void OnSerializing(System.Runtime.Serialization.StreamingContext context)
+        {
+            if (fields == null) return;
+
+            // Copy "fields" to "fieldsClone"
+            fieldsClone = new object[fields.Length];
+            for (int i = 0; i < fields.Length; i++)
+            {
+                fieldsClone[i] = fields[i];
+            }
+        }
+
+        [System.Runtime.Serialization.OnDeserialized]
+        void OnDeserialized(System.Runtime.Serialization.StreamingContext context)
+        {
+            if (fieldsClone == null) return;
+
+            // Form "fields" from "fieldsClone"
+            fields = new IComparable[fieldsClone.Length];
+            for (int i = 0; i < fields.Length; i++)
+            {
+                fields[i] = (IComparable)fieldsClone[i];
+            }
+        }
+        #endregion
 	}
 }
\ No newline at end of file



Mime
View raw message