lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r454596 - in /incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net: Document/Document.cs Index/DocumentWriter.cs Index/FieldInfos.cs Index/FieldsWriter.cs Index/ParallelReader.cs
Date Tue, 10 Oct 2006 03:49:53 GMT
Author: aroush
Date: Mon Oct  9 20:49:52 2006
New Revision: 454596

URL: http://svn.apache.org/viewvc?view=rev&rev=454596
Log:
Lucene.Net.Documents.Document.Fields() -- changed from returning an IEnumerator to IEnumerable

Modified:
    incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Document/Document.cs
    incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/DocumentWriter.cs
    incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/FieldInfos.cs
    incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/FieldsWriter.cs
    incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/ParallelReader.cs

Modified: incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Document/Document.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Document/Document.cs?view=diff&rev=454596&r1=454595&r2=454596
==============================================================================
--- incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Document/Document.cs
(original)
+++ incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Document/Document.cs
Mon Oct  9 20:49:52 2006
@@ -47,8 +47,14 @@
 		{
 		}
 		
+        /// <summary>Returns the number of fields in this document</summary>
+        /// Added as a helper for Lucene.Net
+        public int GetFieldsCount()
+        {
+            return fields.Count;
+        }
 		
-		/// <summary>Sets a boost factor for hits on any field of this document.  This value
+        /// <summary>Sets a boost factor for hits on any field of this document.  This
value
 		/// will be multiplied into the score of all hits on this document.
 		/// 
 		/// <p>Values are multiplied into the value of {@link Field#GetBoost()} of
@@ -169,9 +175,9 @@
 		}
 		
 		/// <summary>Returns an Enumeration of all the fields in a document. </summary>
-		public System.Collections.IEnumerator Fields()
+		public System.Collections.IEnumerable Fields()
 		{
-			return ((System.Collections.ArrayList) fields).GetEnumerator();
+			return fields;
 		}
 		
 		/// <summary> Returns an array of {@link Field}s with the given name.

Modified: incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/DocumentWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/DocumentWriter.cs?view=diff&rev=454596&r1=454595&r2=454596
==============================================================================
--- incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/DocumentWriter.cs
(original)
+++ incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/DocumentWriter.cs
Mon Oct  9 20:49:52 2006
@@ -138,10 +138,8 @@
 		// Tokenizes the fields of a document into Postings.
 		private void  InvertDocument(Document doc)
 		{
-			System.Collections.IEnumerator fields = doc.Fields();
-			while (fields.MoveNext())
+			foreach(Field field in doc.Fields())
 			{
-				Field field = (Field) fields.Current;
 				System.String fieldName = field.Name();
 				int fieldNumber = fieldInfos.FieldNumber(fieldName);
 				

Modified: incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/FieldInfos.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/FieldInfos.cs?view=diff&rev=454596&r1=454595&r2=454596
==============================================================================
--- incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/FieldInfos.cs
(original)
+++ incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/FieldInfos.cs
Mon Oct  9 20:49:52 2006
@@ -70,10 +70,8 @@
 		/// <summary>Adds field info for a Document. </summary>
 		public void  Add(Document doc)
 		{
-			System.Collections.IEnumerator fields = doc.Fields();
-			while (fields.MoveNext())
+			foreach (Field field in doc.Fields())
 			{
-				Field field = (Field) fields.Current;
 				Add(field.Name(), field.IsIndexed(), field.IsTermVectorStored(), field.IsStorePositionWithTermVector(),
field.IsStoreOffsetWithTermVector(), field.GetOmitNorms());
 			}
 		}

Modified: incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/FieldsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/FieldsWriter.cs?view=diff&rev=454596&r1=454595&r2=454596
==============================================================================
--- incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/FieldsWriter.cs
(original)
+++ incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/FieldsWriter.cs
Mon Oct  9 20:49:52 2006
@@ -53,19 +53,15 @@
 			indexStream.WriteLong(fieldsStream.GetFilePointer());
 			
 			int storedCount = 0;
-			System.Collections.IEnumerator fields = doc.Fields();
-			while (fields.MoveNext())
-			{
-				Field field = (Field) fields.Current;
-				if (field.IsStored())
-					storedCount++;
-			}
-			fieldsStream.WriteVInt(storedCount);
+            foreach (Field field  in doc.Fields())
+            {
+                if (field.IsStored())
+                    storedCount++;
+            }
+            fieldsStream.WriteVInt(storedCount);
 			
-			fields = doc.Fields();
-			while (fields.MoveNext())
-			{
-				Field field = (Field) fields.Current;
+            foreach (Field field in doc.Fields())
+            {
 				if (field.IsStored())
 				{
 					fieldsStream.WriteVInt(fieldInfos.FieldNumber(field.Name()));

Modified: incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/ParallelReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/ParallelReader.cs?view=diff&rev=454596&r1=454595&r2=454596
==============================================================================
--- incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/ParallelReader.cs
(original)
+++ incubator/lucene.net/tags/Lucene.Net_1_9_RC1_final/src/Lucene.Net/Index/ParallelReader.cs
Mon Oct  9 20:49:52 2006
@@ -152,10 +152,9 @@
 			for (int i = 0; i < storedFieldReaders.Count; i++)
 			{
 				IndexReader reader = (IndexReader) storedFieldReaders[i];
-				System.Collections.IEnumerator fields = reader.Document(n).Fields();
-				while (fields.MoveNext())
-				{
-					result.Add((Field) fields.Current);
+                foreach(Field field in reader.Document(n).Fields())
+                {
+					result.Add(field);
 				}
 			}
 			return result;



Mime
View raw message