lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r583187 - in /incubator/lucene.net/trunk/C#/src/Lucene.Net: Lucene.Net-2.1.0.csproj Search/FieldDoc.cs
Date Tue, 09 Oct 2007 15:11:16 GMT
Author: aroush
Date: Tue Oct  9 08:11:16 2007
New Revision: 583187

URL: http://svn.apache.org/viewvc?rev=583187&view=rev
Log:
Fix: LUCENENET-100 "Problem with remoting of IComparable[] in FieldDoc.cs"

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Lucene.Net-2.1.0.csproj
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldDoc.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Lucene.Net-2.1.0.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Lucene.Net-2.1.0.csproj?rev=583187&r1=583186&r2=583187&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Lucene.Net-2.1.0.csproj (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Lucene.Net-2.1.0.csproj Tue Oct  9 08:11:16
2007
@@ -28,7 +28,7 @@
                     BaseAddress = "285212672"
                     CheckForOverflowUnderflow = "false"
                     ConfigurationOverrideFile = ""
-                    DefineConstants = "DEBUG;TRACE"
+                    DefineConstants = "DEBUG;TRACE;FRAMEWORK_1_1"
                     DocumentationFile = ""
                     DebugSymbols = "true"
                     FileAlignment = "4096"
@@ -48,7 +48,7 @@
                     BaseAddress = "285212672"
                     CheckForOverflowUnderflow = "false"
                     ConfigurationOverrideFile = ""
-                    DefineConstants = "TRACE"
+                    DefineConstants = "TRACE;FRAMEWORK_1_1"
                     DocumentationFile = "Lucene.Net.xml"
                     DebugSymbols = "false"
                     FileAlignment = "4096"

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldDoc.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/FieldDoc.cs?rev=583187&r1=583186&r2=583187&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldDoc.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldDoc.cs Tue Oct  9 08:11:16 2007
@@ -46,30 +46,65 @@
 	/// </seealso>
 	/// <seealso cref="TopFieldDocs">
 	/// </seealso>
-	[Serializable]
-	public class FieldDoc : ScoreDoc
-	{
+    [Serializable]
+    public class FieldDoc : ScoreDoc
+    {
 		
-		/// <summary>Expert: The values which are used to sort the referenced document.
-		/// The order of these will match the original sort criteria given by a
-		/// Sort object.  Each Object will be either an Integer, Float or String,
-		/// depending on the type of values in the terms of the original field.
-		/// </summary>
-		/// <seealso cref="Sort">
-		/// </seealso>
-		/// <seealso cref="Searcher#Search(Query,Filter,int,Sort)">
-		/// </seealso>
-		public System.IComparable[] fields;
+        /// <summary>Expert: The values which are used to sort the referenced document.
+        /// The order of these will match the original sort criteria given by a
+        /// Sort object.  Each Object will be either an Integer, Float or String,
+        /// depending on the type of values in the terms of the original field.
+        /// </summary>
+        /// <seealso cref="Sort">
+        /// </seealso>
+        /// <seealso cref="Searcher#Search(Query,Filter,int,Sort)">
+        /// </seealso>
+#if !FRAMEWORK_1_1
+        [NonSerialized]     // Do not serialize "fields". Instead serialize "fieldsClone"
+#endif
+        public System.IComparable[] fields;
 		
-		/// <summary>Expert: Creates one of these objects with empty sort information. </summary>
-		public FieldDoc(int doc, float score) : base(doc, score)
-		{
-		}
+        /// <summary>Expert: Creates one of these objects with empty sort information.
</summary>
+        public FieldDoc(int doc, float score) : base(doc, score)
+        {
+        }
 		
-		/// <summary>Expert: Creates one of these objects with the given sort information.
</summary>
-		public FieldDoc(int doc, float score, System.IComparable[] fields) : base(doc, score)
-		{
-			this.fields = fields;
-		}
-	}
+        /// <summary>Expert: Creates one of these objects with the given sort information.
</summary>
+        public FieldDoc(int doc, float score, System.IComparable[] fields) : base(doc, score)
+        {
+            this.fields = fields;
+        }
+
+#if !FRAMEWORK_1_1
+#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
+#endif
+    }
 }



Mime
View raw message