lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r881405 - in /incubator/lucene.net/trunk/C#/src/Lucene.Net/Search: BooleanQuery.cs Similarity.cs Spans/SpanNearQuery.cs Spans/SpanWeight.cs
Date Tue, 17 Nov 2009 17:41:19 GMT
Author: aroush
Date: Tue Nov 17 17:41:18 2009
New Revision: 881405

URL: http://svn.apache.org/viewvc?rev=881405&view=rev
Log:
Fixed NUnit test-cases for: TestComplexExplanations

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Similarity.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanNearQuery.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanWeight.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=881405&r1=881404&r2=881405&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 Tue Nov 17 17:41:18
2009
@@ -31,6 +31,7 @@
 	[Serializable]
 	public class BooleanQuery:Query, System.ICloneable
 	{
+		[Serializable]
 		private class AnonymousClassSimilarityDelegator:SimilarityDelegator
 		{
 			private void  InitBlock(BooleanQuery enclosingInstance)

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Similarity.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/Similarity.cs?rev=881405&r1=881404&r2=881405&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Similarity.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Similarity.cs Tue Nov 17 17:41:18
2009
@@ -748,10 +748,8 @@
 			int max = searcher.MaxDoc();
 			float idf2 = 0.0f;
 			System.Text.StringBuilder exp = new System.Text.StringBuilder();
-			System.Collections.IEnumerator i = terms.GetEnumerator();
-			while (i.MoveNext())
+            foreach (Term term in terms)
 			{
-				Term term = (Term) i.Current;
 				int df = searcher.DocFreq(term);
 				idf2 += Idf(df, max);
 				exp.Append(" ");

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanNearQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/Spans/SpanNearQuery.cs?rev=881405&r1=881404&r2=881405&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanNearQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanNearQuery.cs Tue Nov 17
17:41:18 2009
@@ -113,12 +113,10 @@
 		
 		public override void  ExtractTerms(System.Collections.Hashtable terms)
 		{
-			System.Collections.IEnumerator i = clauses.GetEnumerator();
-			while (i.MoveNext())
-			{
-				SpanQuery clause = (SpanQuery) i.Current;
-				clause.ExtractTerms(terms);
-			}
+            foreach (SpanQuery clause in clauses)
+            {
+                clause.ExtractTerms(terms);
+            }
 		}
 		
 		
@@ -227,8 +225,13 @@
 		
 		public override int GetHashCode()
 		{
-			long result;
-			result = clauses.GetHashCode();
+			long result = 0;
+            //mgarski .NET uses the arraylist's location, not contents to calculate the hash
+            // need to start with result being the hash of the contents.
+            foreach (SpanQuery sq in clauses)
+            {
+                result += sq.GetHashCode();
+            }
 			// Mix bits before folding in things like boost, since it could cancel the
 			// last element of clauses.  This particular mix also serves to
 			// differentiate SpanNearQuery hashcodes from others.

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanWeight.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/Spans/SpanWeight.cs?rev=881405&r1=881404&r2=881405&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanWeight.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanWeight.cs Tue Nov 17 17:41:18
2009
@@ -44,7 +44,7 @@
 			this.query = query;
 			terms = new System.Collections.Hashtable();
 			query.ExtractTerms(terms);
-			idfExp = similarity.idfExplain(terms, searcher);
+			idfExp = similarity.idfExplain(new System.Collections.ArrayList(terms.Values), searcher);
 			idf = idfExp.GetIdf();
 		}
 		



Mime
View raw message