lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [Lucene.Net] svn commit: r1099968 - in /incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index: BufferedDeletes.cs DocFieldConsumers.cs FieldInfos.cs FieldsWriter.cs IndexFileDeleter.cs IndexWriter.cs ParallelReader.cs
Date Thu, 05 May 2011 21:05:35 GMT
Author: digy
Date: Thu May  5 21:05:35 2011
New Revision: 1099968

URL: http://svn.apache.org/viewvc?rev=1099968&view=rev
Log:
[LUCENENET-412]

Modified:
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/BufferedDeletes.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocFieldConsumers.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldInfos.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldsWriter.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/IndexFileDeleter.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/IndexWriter.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/ParallelReader.cs

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/BufferedDeletes.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/BufferedDeletes.cs?rev=1099968&r1=1099967&r2=1099968&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/BufferedDeletes.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/BufferedDeletes.cs Thu
May  5 21:05:35 2011
@@ -163,10 +163,8 @@ namespace Lucene.Net.Index
 				if (docIDs.Count > 0)
 				{
 					newDeleteDocIDs = new List<int>(docIDs.Count);
-					System.Collections.Generic.IEnumerator<int> iter = docIDs.GetEnumerator();
-					while (iter.MoveNext())
+                    foreach(int num in docIDs)
 					{
-						int num = iter.Current;
 						newDeleteDocIDs.Add(mapper.Remap(num));
 					}
 				}

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocFieldConsumers.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocFieldConsumers.cs?rev=1099968&r1=1099967&r2=1099968&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocFieldConsumers.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocFieldConsumers.cs Thu
May  5 21:05:35 2011
@@ -61,8 +61,8 @@ namespace Lucene.Net.Index
             	DocFieldConsumersPerThread perThread = (DocFieldConsumersPerThread) entry.Key;
 				
 				IList<DocFieldConsumerPerField> fields = entry.Value;
-				
-				System.Collections.IEnumerator fieldsIt = fields.GetEnumerator();
+
+                //IEnumerator<DocFieldConsumerPerField> fieldsIt = fields.GetEnumerator();
                 IList<DocFieldConsumerPerField> oneFields = new List<DocFieldConsumerPerField>();
                 IList<DocFieldConsumerPerField> twoFields = new List<DocFieldConsumerPerField>();
                 foreach (DocFieldConsumersPerField perField in fields)

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldInfos.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldInfos.cs?rev=1099968&r1=1099967&r2=1099968&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldInfos.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldInfos.cs Thu May 
5 21:05:35 2011
@@ -136,10 +136,8 @@ namespace Lucene.Net.Index
 			lock (this)
 			{
 				IList<Fieldable> fields = doc.GetFields();
-				System.Collections.IEnumerator fieldIterator = fields.GetEnumerator();
-				while (fieldIterator.MoveNext())
-				{
-					Fieldable field = (Fieldable) fieldIterator.Current;
+                foreach (Fieldable field in fields)
+                { 
 					Add(field.Name(), field.IsIndexed(), field.IsTermVectorStored(), field.IsStorePositionWithTermVector(),
field.IsStoreOffsetWithTermVector(), field.GetOmitNorms(), false, field.GetOmitTf());
 				}
 			}
@@ -171,14 +169,13 @@ namespace Lucene.Net.Index
 		/// </param>
 		/// <param name="storeOffsetWithTermVector">true if offsets should be stored
 		/// </param>
-		public void  AddIndexed(System.Collections.ICollection names, bool storeTermVectors, bool
storePositionWithTermVector, bool storeOffsetWithTermVector)
+		public void  AddIndexed(IList<string> names, bool storeTermVectors, bool storePositionWithTermVector,
bool storeOffsetWithTermVector)
 		{
 			lock (this)
 			{
-				System.Collections.IEnumerator i = names.GetEnumerator();
-				while (i.MoveNext())
+                foreach(string name in names)
 				{
-					Add((System.String) i.Current, true, storeTermVectors, storePositionWithTermVector,
storeOffsetWithTermVector);
+					Add(name, true, storeTermVectors, storePositionWithTermVector, storeOffsetWithTermVector);
 				}
 			}
 		}
@@ -197,10 +194,9 @@ namespace Lucene.Net.Index
 		{
 			lock (this)
 			{
-				System.Collections.IEnumerator i = names.GetEnumerator();
-				while (i.MoveNext())
+                foreach(string name  in names)
 				{
-					Add((System.String) i.Current, isIndexed);
+					Add(name, isIndexed);
 				}
 			}
 		}

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldsWriter.cs?rev=1099968&r1=1099967&r2=1099968&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldsWriter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FieldsWriter.cs Thu May
 5 21:05:35 2011
@@ -326,19 +326,15 @@ namespace Lucene.Net.Index
 			indexStream.WriteLong(fieldsStream.GetFilePointer());
 			
 			int storedCount = 0;
-			System.Collections.IEnumerator fieldIterator = doc.GetFields().GetEnumerator();
-			while (fieldIterator.MoveNext())
-			{
-				Fieldable field = (Fieldable) fieldIterator.Current;
+            foreach(Fieldable field in doc.GetFields())
+            {			
 				if (field.IsStored())
 					storedCount++;
 			}
 			fieldsStream.WriteVInt(storedCount);
 			
-			fieldIterator = doc.GetFields().GetEnumerator();
-			while (fieldIterator.MoveNext())
-			{
-				Fieldable field = (Fieldable) fieldIterator.Current;
+			foreach(Fieldable field in doc.GetFields())
+            {
 				if (field.IsStored())
 					WriteField(fieldInfos.FieldInfo(field.Name()), field);
 			}

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/IndexFileDeleter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/IndexFileDeleter.cs?rev=1099968&r1=1099967&r2=1099968&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/IndexFileDeleter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/IndexFileDeleter.cs Thu
May  5 21:05:35 2011
@@ -618,10 +618,8 @@ namespace Lucene.Net.Index
 		/// </summary>
         internal void DeleteNewFiles(ICollection<string> files)
 		{
-			System.Collections.IEnumerator it = files.GetEnumerator();
-			while (it.MoveNext())
+            foreach(string fileName in files)
 			{
-				System.String fileName = (System.String) it.Current;
                 if (!refCounts.ContainsKey(fileName))
                 {
                     if (infoStream != null)

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/IndexWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/IndexWriter.cs?rev=1099968&r1=1099967&r2=1099968&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/IndexWriter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/IndexWriter.cs Thu May
 5 21:05:35 2011
@@ -2684,10 +2684,9 @@ namespace Lucene.Net.Index
 					try
 					{
 						CompoundFileWriter cfsWriter = new CompoundFileWriter(directory, compoundFileName);
-						System.Collections.IEnumerator it = docWriter.ClosedFiles().GetEnumerator();
-						while (it.MoveNext())
+                        foreach(string cf in docWriter.ClosedFiles())
 						{
-							cfsWriter.AddFile((System.String) it.Current);
+							cfsWriter.AddFile(cf);
 						}
 						
 						// Perform the merge
@@ -3316,18 +3315,14 @@ namespace Lucene.Net.Index
 				
 				// Now mark all pending & running merges as optimize
 				// merge:
-				System.Collections.IEnumerator it = pendingMerges.GetEnumerator();
-				while (it.MoveNext())
+                foreach(MergePolicy.OneMerge merge in pendingMerges)
 				{
-					MergePolicy.OneMerge merge = (MergePolicy.OneMerge) it.Current;
 					merge.optimize = true;
 					merge.maxNumSegmentsOptimize = maxNumSegments;
 				}
-				
-				it = runningMerges.GetEnumerator();
-				while (it.MoveNext())
+
+                foreach (MergePolicy.OneMerge merge in runningMerges)
 				{
-					MergePolicy.OneMerge merge = (MergePolicy.OneMerge) it.Current;
 					merge.optimize = true;
 					merge.maxNumSegmentsOptimize = maxNumSegments;
 				}
@@ -4027,21 +4022,17 @@ namespace Lucene.Net.Index
 					stopMerges = true;
 					
 					// Abort all pending & running merges:
-					System.Collections.IEnumerator it = pendingMerges.GetEnumerator();
-					while (it.MoveNext())
+                    foreach(MergePolicy.OneMerge merge in pendingMerges)
 					{
-						MergePolicy.OneMerge merge = (MergePolicy.OneMerge) it.Current;
 						if (infoStream != null)
 							Message("now abort pending merge " + merge.SegString(directory));
 						merge.Abort();
 						MergeFinish(merge);
 					}
 					pendingMerges.Clear();
-					
-					it = runningMerges.GetEnumerator();
-					while (it.MoveNext())
+
+                    foreach (MergePolicy.OneMerge merge in runningMerges)
 					{
-						MergePolicy.OneMerge merge = (MergePolicy.OneMerge) it.Current;
 						if (infoStream != null)
 							Message("now abort running merge " + merge.SegString(directory));
 						merge.Abort();

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/ParallelReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/ParallelReader.cs?rev=1099968&r1=1099967&r2=1099968&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/ParallelReader.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/ParallelReader.cs Thu May
 5 21:05:35 2011
@@ -112,11 +112,9 @@ namespace Lucene.Net.Index
 			
 			ICollection<string> fields = reader.GetFieldNames(IndexReader.FieldOption.ALL);
 			readerToFields[reader] = fields;
-			System.Collections.IEnumerator i = fields.GetEnumerator();
-			while (i.MoveNext())
+            foreach(string field in fields)
 			{
 				// update fieldToReader map
-				System.String field = (System.String) i.Current;
 				if (fieldToReader[field] == null)
 					fieldToReader[field] = reader;
 			}
@@ -328,10 +326,9 @@ namespace Lucene.Net.Index
 				}
 				if (include)
 				{
-					System.Collections.IEnumerator fieldIterator = reader.Document(n, fieldSelector).GetFields().GetEnumerator();
-					while (fieldIterator.MoveNext())
+                    foreach(Fieldable f in reader.Document(n, fieldSelector).GetFields())
 					{
-						result.Add((Fieldable) fieldIterator.Current);
+						result.Add(f);
 					}
 				}
 			}



Mime
View raw message