lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r439680 - /incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs
Date Sat, 02 Sep 2006 22:45:46 GMT
Author: aroush
Date: Sat Sep  2 15:45:45 2006
New Revision: 439680

URL: http://svn.apache.org/viewvc?rev=439680&view=rev
Log:
Unlike Java ArrayList.GetHashCode() won't do.  In C#, we must iterate over elements in the
array to sum-up the hash-code.

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

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/BooleanQuery.cs?rev=439680&r1=439679&r2=439680&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs Sat Sep  2 15:45:45
2006
@@ -590,7 +590,14 @@
 		/// <summary>Returns a hash code value for this object.</summary>
 		public override int GetHashCode()
 		{
-			return BitConverter.ToInt32(BitConverter.GetBytes(GetBoost()), 0) ^ clauses.GetHashCode()
+ GetMinimumNumberShouldMatch();
+            int hashCode = 0;
+
+            for (int i = 0; i < clauses.Count; i++)
+            {
+                hashCode += clauses[i].GetHashCode();
+            }
+
+			return BitConverter.ToInt32(BitConverter.GetBytes(GetBoost()), 0) ^ hashCode + GetMinimumNumberShouldMatch();
 		}
 	}
 }



Mime
View raw message