lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r718034 - in /incubator/lucene.net/trunk/C#/src: Lucene.Net/Index/ Test/Index/
Date Sun, 16 Nov 2008 14:15:38 GMT
Author: digy
Date: Sun Nov 16 06:15:38 2008
New Revision: 718034

URL: http://svn.apache.org/viewvc?rev=718034&view=rev
Log:
LUCENENET-157 (SegmentMerger.AddIndexed expects *Reader.GetFieldNames to return a 1-dimensional
ICollection)

GetFieldNames.patch + FieldInfos.patch

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/CheckIndex.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfos.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/MultiSegmentReader.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/ParallelReader.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentReader.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexReader.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestParallelReader.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentReader.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/CheckIndex.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/CheckIndex.cs?rev=718034&r1=718033&r2=718034&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/CheckIndex.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/CheckIndex.cs Sun Nov 16 06:15:38 2008
@@ -179,8 +179,8 @@
 						out_Renamed.WriteLine("OK");
 					
 					out_Renamed.Write("    test: fields, norms.......");
-					System.Collections.IDictionary fieldNames = (System.Collections.IDictionary) reader.GetFieldNames(IndexReader.FieldOption.ALL);
-					System.Collections.IEnumerator it = fieldNames.Keys.GetEnumerator();
+                    System.Collections.ICollection fieldNames = reader.GetFieldNames(IndexReader.FieldOption.ALL);
+                    System.Collections.IEnumerator it = fieldNames.GetEnumerator();
 					while (it.MoveNext())
 					{
 						System.String fieldName = (System.String) it.Current;
@@ -426,4 +426,4 @@
 			out_Renamed = temp_writer;
 		}
 	}
-}
\ No newline at end of file
+}

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfos.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/FieldInfos.cs?rev=718034&r1=718033&r2=718034&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfos.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfos.cs Sun Nov 16 06:15:38 2008
@@ -132,8 +132,7 @@
 			System.Collections.IEnumerator i = names.GetEnumerator();
 			while (i.MoveNext())
 			{
-				System.Collections.DictionaryEntry t = (System.Collections.DictionaryEntry) i.Current;
-				Add((System.String) t.Key, isIndexed);
+				Add((System.String) i.Current, isIndexed);
 			}
 		}
 		
@@ -385,4 +384,4 @@
 			}
 		}
 	}
-}
\ No newline at end of file
+}

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/MultiSegmentReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/MultiSegmentReader.cs?rev=718034&r1=718033&r2=718034&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/MultiSegmentReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/MultiSegmentReader.cs Sun Nov 16 06:15:38
2008
@@ -516,14 +516,14 @@
 			for (int i = 0; i < subReaders.Length; i++)
 			{
 				IndexReader reader = subReaders[i];
-				System.Collections.IEnumerator names = ((System.Collections.IDictionary)reader.GetFieldNames(fieldNames)).Keys.GetEnumerator();
-				while (names.MoveNext())
+                System.Collections.IEnumerator names = reader.GetFieldNames(fieldNames).GetEnumerator();
+                while (names.MoveNext())
 				{
 					if (!fieldSet.ContainsKey(names.Current))
 						fieldSet.Add(names.Current, names.Current);
 				}
 			}
-			return fieldSet;
+			return fieldSet.Keys;
 		}
 		
 		// for testing
@@ -800,4 +800,4 @@
 			}
 		}
 	}
-}
\ No newline at end of file
+}

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/ParallelReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/ParallelReader.cs?rev=718034&r1=718033&r2=718034&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/ParallelReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/ParallelReader.cs Sun Nov 16 06:15:38
2008
@@ -114,10 +114,11 @@
 			System.Collections.IEnumerator i = fields.GetEnumerator();
 			while (i.MoveNext())
 			{
-				System.Collections.DictionaryEntry fi = (System.Collections.DictionaryEntry) i.Current;
+                //System.Collections.DictionaryEntry fi = (System.Collections.DictionaryEntry)
i.Current;
 
-				// update fieldToReader map
-				System.String field = fi.Key.ToString();
+                //// update fieldToReader map
+                //System.String field = fi.Key.ToString();
+                System.String field = (String) i.Current;
 				if (fieldToReader[field] == null)
 					fieldToReader[field] = reader;
 			}
@@ -302,7 +303,7 @@
 					System.Collections.IEnumerator it = ((System.Collections.ICollection) readerToFields[reader]).GetEnumerator();
 					while (it.MoveNext())
 					{
-						if (fieldSelector.Accept((System.String)((System.Collections.DictionaryEntry)it.Current).Value)
!= FieldSelectorResult.NO_LOAD)
+						if (fieldSelector.Accept((System.String)it.Current) != FieldSelectorResult.NO_LOAD)
 						{
 							include = true;
 							break;
@@ -522,15 +523,14 @@
 				System.Collections.ICollection names = reader.GetFieldNames(fieldNames);
 				for (System.Collections.IEnumerator iterator = names.GetEnumerator(); iterator.MoveNext();
)
 				{
-					System.Collections.DictionaryEntry fi = (System.Collections.DictionaryEntry) iterator.Current;
-					System.String s = fi.Key.ToString();
+                    System.String s = (System.String)iterator.Current;
 					if (fieldSet.ContainsKey(s) == false)
 					{
 						fieldSet.Add(s, s);
 					}
 				}
 			}
-			return fieldSet;
+			return fieldSet.Keys;
 		}
 		
 		private class ParallelTermEnum : TermEnum
@@ -758,4 +758,4 @@
 			}
 		}
 	}
-}
\ No newline at end of file
+}

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/SegmentReader.cs?rev=718034&r1=718033&r2=718034&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentReader.cs Sun Nov 16 06:15:38
2008
@@ -872,7 +872,7 @@
                     fieldSet.Add(fi.name, fi.name);
 				}
 			}
-			return fieldSet;
+			return fieldSet.Keys;
 		}
 		
 		
@@ -1234,4 +1234,4 @@
 			}
 		}
 	}
-}
\ No newline at end of file
+}

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestIndexReader.cs?rev=718034&r1=718033&r2=718034&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexReader.cs Sun Nov 16 06:15:38 2008
@@ -1373,17 +1373,17 @@
 			System.Collections.ICollection fields1 = index1.GetFieldNames(FieldOption.ALL);
 			System.Collections.ICollection fields2 = index2.GetFieldNames(FieldOption.ALL);
 			Assert.AreEqual(fields1.Count, fields2.Count, "IndexReaders have different numbers of
fields.");
-			System.Collections.IEnumerator it1 = ((System.Collections.IDictionary) fields1).Keys.GetEnumerator();
-			System.Collections.IEnumerator it2 = ((System.Collections.IDictionary) fields2).Keys.GetEnumerator();
-			while (it1.MoveNext())
+            System.Collections.IEnumerator it1 = fields1.GetEnumerator();
+            System.Collections.IEnumerator it2 = fields2.GetEnumerator();
+            while (it1.MoveNext())
 			{
 				Assert.IsTrue(it2.MoveNext());
 				Assert.AreEqual((System.String) it1.Current, (System.String) it2.Current, "Different
field names.");
 			}
 			
 			// check norms
-			it1 = ((System.Collections.IDictionary) fields1).Keys.GetEnumerator();
-			while (it1.MoveNext())
+            it1 = fields1.GetEnumerator();
+            while (it1.MoveNext())
 			{
 				System.String curField = (System.String) it1.Current;
 				byte[] norms1 = index1.Norms(curField);
@@ -1460,4 +1460,4 @@
 			return false;
 		}
 	}
-}
\ No newline at end of file
+}

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestParallelReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestParallelReader.cs?rev=718034&r1=718033&r2=718034&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestParallelReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestParallelReader.cs Sun Nov 16 06:15:38
2008
@@ -299,12 +299,11 @@
 		{
 			for (System.Collections.IEnumerator iterator = col.GetEnumerator(); iterator.MoveNext();
)
 			{
-				System.Collections.DictionaryEntry fi = (System.Collections.DictionaryEntry) iterator.Current;
-				System.String s = fi.Key.ToString();
-				if (s == val)
+                System.String s = (System.String)iterator.Current;
+                if (s == val)
 					return true;
 			}
 			return false;
 		}
 	}
-}
\ No newline at end of file
+}

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestSegmentReader.cs?rev=718034&r1=718033&r2=718034&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentReader.cs Sun Nov 16 06:15:38
2008
@@ -129,24 +129,23 @@
 			Assert.IsTrue(result.Count == DocHelper.all.Count);
 			for (System.Collections.IEnumerator iter = result.GetEnumerator(); iter.MoveNext(); )
 			{
-				System.Collections.DictionaryEntry fi = (System.Collections.DictionaryEntry) iter.Current;
-				System.String s = fi.Key.ToString();
-				//System.out.println("Name: " + s);
-				Assert.IsTrue(DocHelper.nameValues.Contains(s) == true || s.Equals(""));
+                System.String s = (System.String)iter.Current;
+                Assert.IsTrue(DocHelper.nameValues.Contains(s) == true || s.Equals(""));
 			}
+
 			result = reader.GetFieldNames(IndexReader.FieldOption.INDEXED);
 			Assert.IsTrue(result != null);
 			Assert.IsTrue(result.Count == DocHelper.indexed.Count);
 			for (System.Collections.IEnumerator iter = result.GetEnumerator(); iter.MoveNext(); )
 			{
-				System.Collections.DictionaryEntry fi = (System.Collections.DictionaryEntry) iter.Current;
-				System.String s = fi.Key.ToString();
-				Assert.IsTrue(DocHelper.indexed.Contains(s) == true || s.Equals(""));
+                System.String s = (System.String)iter.Current;
+                Assert.IsTrue(DocHelper.indexed.Contains(s) == true || s.Equals(""));
 			}
 			
 			result = reader.GetFieldNames(IndexReader.FieldOption.UNINDEXED);
 			Assert.IsTrue(result != null);
 			Assert.IsTrue(result.Count == DocHelper.unindexed.Count);
+
 			//Get all indexed fields that are storing term vectors
 			result = reader.GetFieldNames(IndexReader.FieldOption.INDEXED_WITH_TERMVECTOR);
 			Assert.IsTrue(result != null);
@@ -272,4 +271,4 @@
 			TestTermVectors();
 		}
 	}
-}
\ No newline at end of file
+}



Mime
View raw message