lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r534192 [5/19] - in /incubator/lucene.net/trunk/C#: ./ src/ src/Demo/ src/Demo/DeleteFiles/ src/Demo/DemoLib/ src/Demo/DemoLib/HTML/ src/Demo/IndexFiles/ src/Demo/IndexHtml/ src/Demo/SearchFiles/ src/Lucene.Net/ src/Lucene.Net/Analysis/ src...
Date Tue, 01 May 2007 18:45:35 GMT
Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/AbstractField.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/AbstractField.cs?view=auto&rev=534192
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/AbstractField.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/AbstractField.cs Tue May  1 11:45:26 2007
@@ -0,0 +1,352 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Lucene.Net.Documents
+{
+	/// <summary> 
+	/// 
+	/// 
+	/// </summary>
+	[Serializable]
+	public abstract class AbstractField : Fieldable
+	{
+		
+		protected internal System.String name = "body";
+		protected internal bool storeTermVector = false;
+		protected internal bool storeOffsetWithTermVector = false;
+		protected internal bool storePositionWithTermVector = false;
+		protected internal bool omitNorms = false;
+		protected internal bool isStored = false;
+		protected internal bool isIndexed = true;
+		protected internal bool isTokenized = true;
+		protected internal bool isBinary = false;
+		protected internal bool isCompressed = false;
+		protected internal bool lazy = false;
+		protected internal float boost = 1.0f;
+		// the one and only data object for all different kind of field values
+		protected internal System.Object fieldsData = null;
+		
+		protected internal AbstractField()
+		{
+		}
+		
+		protected internal AbstractField(System.String name, Field.Store store, Field.Index index, Field.TermVector termVector)
+		{
+			if (name == null)
+				throw new System.NullReferenceException("name cannot be null");
+			this.name = String.Intern(name); // field names are interned
+			
+			if (store == Field.Store.YES)
+			{
+				this.isStored = true;
+				this.isCompressed = false;
+			}
+			else if (store == Field.Store.COMPRESS)
+			{
+				this.isStored = true;
+				this.isCompressed = true;
+			}
+			else if (store == Field.Store.NO)
+			{
+				this.isStored = false;
+				this.isCompressed = false;
+			}
+			else
+			{
+				throw new System.ArgumentException("unknown store parameter " + store);
+			}
+			
+			if (index == Field.Index.NO)
+			{
+				this.isIndexed = false;
+				this.isTokenized = false;
+			}
+			else if (index == Field.Index.TOKENIZED)
+			{
+				this.isIndexed = true;
+				this.isTokenized = true;
+			}
+			else if (index == Field.Index.UN_TOKENIZED)
+			{
+				this.isIndexed = true;
+				this.isTokenized = false;
+			}
+			else if (index == Field.Index.NO_NORMS)
+			{
+				this.isIndexed = true;
+				this.isTokenized = false;
+				this.omitNorms = true;
+			}
+			else
+			{
+				throw new System.ArgumentException("unknown index parameter " + index);
+			}
+			
+			this.isBinary = false;
+			
+			SetStoreTermVector(termVector);
+		}
+		
+		/// <summary>Sets the boost factor hits on this field.  This value will be
+		/// multiplied into the score of all hits on this this field of this
+		/// document.
+		/// 
+		/// <p>The boost is multiplied by {@link Lucene.Net.Documents.Document#GetBoost()} of the document
+		/// containing this field.  If a document has multiple fields with the same
+		/// name, all such values are multiplied together.  This product is then
+		/// multipled by the value {@link Lucene.Net.Search.Similarity#LengthNorm(String,int)}, and
+		/// rounded by {@link Lucene.Net.Search.Similarity#EncodeNorm(float)} before it is stored in the
+		/// index.  One should attempt to ensure that this product does not overflow
+		/// the range of that encoding.
+		/// 
+		/// </summary>
+		/// <seealso cref="Lucene.Net.Documents.Document#SetBoost(float)">
+		/// </seealso>
+		/// <seealso cref="int)">
+		/// </seealso>
+		/// <seealso cref="Lucene.Net.Search.Similarity#EncodeNorm(float)">
+		/// </seealso>
+		public virtual void  SetBoost(float boost)
+		{
+			this.boost = boost;
+		}
+		
+		/// <summary>Returns the boost factor for hits for this field.
+		/// 
+		/// <p>The default value is 1.0.
+		/// 
+		/// <p>Note: this value is not stored directly with the document in the index.
+		/// Documents returned from {@link Lucene.Net.Index.IndexReader#Document(int)} and
+		/// {@link Lucene.Net.Search.Hits#Doc(int)} may thus not have the same value present as when
+		/// this field was indexed.
+		/// 
+		/// </summary>
+		/// <seealso cref="#SetBoost(float)">
+		/// </seealso>
+		public virtual float GetBoost()
+		{
+			return boost;
+		}
+		
+		/// <summary>Returns the name of the field as an interned string.
+		/// For example "date", "title", "body", ...
+		/// </summary>
+		public virtual System.String Name()
+		{
+			return name;
+		}
+		
+		protected internal virtual void  SetStoreTermVector(Field.TermVector termVector)
+		{
+			if (termVector == Field.TermVector.NO)
+			{
+				this.storeTermVector = false;
+				this.storePositionWithTermVector = false;
+				this.storeOffsetWithTermVector = false;
+			}
+			else if (termVector == Field.TermVector.YES)
+			{
+				this.storeTermVector = true;
+				this.storePositionWithTermVector = false;
+				this.storeOffsetWithTermVector = false;
+			}
+			else if (termVector == Field.TermVector.WITH_POSITIONS)
+			{
+				this.storeTermVector = true;
+				this.storePositionWithTermVector = true;
+				this.storeOffsetWithTermVector = false;
+			}
+			else if (termVector == Field.TermVector.WITH_OFFSETS)
+			{
+				this.storeTermVector = true;
+				this.storePositionWithTermVector = false;
+				this.storeOffsetWithTermVector = true;
+			}
+			else if (termVector == Field.TermVector.WITH_POSITIONS_OFFSETS)
+			{
+				this.storeTermVector = true;
+				this.storePositionWithTermVector = true;
+				this.storeOffsetWithTermVector = true;
+			}
+			else
+			{
+				throw new System.ArgumentException("unknown termVector parameter " + termVector);
+			}
+		}
+		
+		/// <summary>True iff the value of the field is to be stored in the index for return
+		/// with search hits.  It is an error for this to be true if a field is
+		/// Reader-valued. 
+		/// </summary>
+		public bool IsStored()
+		{
+			return isStored;
+		}
+		
+		/// <summary>True iff the value of the field is to be indexed, so that it may be
+		/// searched on. 
+		/// </summary>
+		public bool IsIndexed()
+		{
+			return isIndexed;
+		}
+		
+		/// <summary>True iff the value of the field should be tokenized as text prior to
+		/// indexing.  Un-tokenized fields are indexed as a single word and may not be
+		/// Reader-valued. 
+		/// </summary>
+		public bool IsTokenized()
+		{
+			return isTokenized;
+		}
+		
+		/// <summary>True if the value of the field is stored and compressed within the index </summary>
+		public bool IsCompressed()
+		{
+			return isCompressed;
+		}
+		
+		/// <summary>True iff the term or terms used to index this field are stored as a term
+		/// vector, available from {@link Lucene.Net.Index.IndexReader#GetTermFreqVector(int,String)}.
+		/// These methods do not provide access to the original content of the field,
+		/// only to terms used to index it. If the original content must be
+		/// preserved, use the <code>stored</code> attribute instead.
+		/// 
+		/// </summary>
+		/// <seealso cref="String)">
+		/// </seealso>
+		public bool IsTermVectorStored()
+		{
+			return storeTermVector;
+		}
+		
+		/// <summary> True iff terms are stored as term vector together with their offsets 
+		/// (start and end positon in source text).
+		/// </summary>
+		public virtual bool IsStoreOffsetWithTermVector()
+		{
+			return storeOffsetWithTermVector;
+		}
+		
+		/// <summary> True iff terms are stored as term vector together with their token positions.</summary>
+		public virtual bool IsStorePositionWithTermVector()
+		{
+			return storePositionWithTermVector;
+		}
+		
+		/// <summary>True iff the value of the filed is stored as binary </summary>
+		public bool IsBinary()
+		{
+			return isBinary;
+		}
+		
+		/// <summary>True if norms are omitted for this indexed field </summary>
+		public virtual bool GetOmitNorms()
+		{
+			return omitNorms;
+		}
+		
+		/// <summary>Expert:
+		/// 
+		/// If set, omit normalization factors associated with this indexed field.
+		/// This effectively disables indexing boosts and length normalization for this field.
+		/// </summary>
+		public virtual void  SetOmitNorms(bool omitNorms)
+		{
+			this.omitNorms = omitNorms;
+		}
+		
+		public virtual bool IsLazy()
+		{
+			return lazy;
+		}
+		
+		/// <summary>Prints a Field for human consumption. </summary>
+		public override System.String ToString()
+		{
+			System.Text.StringBuilder result = new System.Text.StringBuilder();
+			if (isStored)
+			{
+				result.Append("stored");
+				if (isCompressed)
+					result.Append("/compressed");
+				else
+					result.Append("/uncompressed");
+			}
+			if (isIndexed)
+			{
+				if (result.Length > 0)
+					result.Append(",");
+				result.Append("indexed");
+			}
+			if (isTokenized)
+			{
+				if (result.Length > 0)
+					result.Append(",");
+				result.Append("tokenized");
+			}
+			if (storeTermVector)
+			{
+				if (result.Length > 0)
+					result.Append(",");
+				result.Append("termVector");
+			}
+			if (storeOffsetWithTermVector)
+			{
+				if (result.Length > 0)
+					result.Append(",");
+				result.Append("termVectorOffsets");
+			}
+			if (storePositionWithTermVector)
+			{
+				if (result.Length > 0)
+					result.Append(",");
+				result.Append("termVectorPosition");
+			}
+			if (isBinary)
+			{
+				if (result.Length > 0)
+					result.Append(",");
+				result.Append("binary");
+			}
+			if (omitNorms)
+			{
+				result.Append(",omitNorms");
+			}
+			if (lazy)
+			{
+				result.Append(",lazy");
+			}
+			result.Append('<');
+			result.Append(name);
+			result.Append(':');
+			
+			if (fieldsData != null && lazy == false)
+			{
+				result.Append(fieldsData);
+			}
+			
+			result.Append('>');
+			return result.ToString();
+		}
+		public abstract byte[] BinaryValue();
+		public abstract System.String StringValue();
+		public abstract System.IO.TextReader ReaderValue();
+	}
+}
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateField.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/DateField.cs?view=diff&rev=534192&r1=534191&r2=534192
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateField.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateField.cs Tue May  1 11:45:26 2007
@@ -21,103 +21,103 @@
 
 namespace Lucene.Net.Documents
 {
-	// for javadoc
+    // for javadoc
 
-	/// <summary> Provides support for converting dates to strings and vice-versa.
-	/// The strings are structured so that lexicographic sorting orders by date,
-	/// which makes them suitable for use as field values and search terms.
-	/// 
-	/// <P>Note that this class saves dates with millisecond granularity,
-	/// which is bad for {@link RangeQuery} and {@link PrefixQuery}, as those
-	/// queries are expanded to a BooleanQuery with a potentially large number
-	/// of terms when searching. Thus you might want to use
-	/// {@link DateTools} instead.
-	/// 
-	/// <P>
-	/// Note: dates before 1970 cannot be used, and therefore cannot be
-	/// indexed when using this class. See {@link DateTools} for an
-	/// alternative without such a limitation.
-	/// 
-	/// </summary>
-	/// <deprecated> If you build a new index, use {@link DateTools} instead. This class is included for use with existing
-	/// indices and will be removed in a future release.
-	/// </deprecated>
-	public class DateField
-	{
-		
-		private DateField()
-		{
-		}
+    /// <summary> Provides support for converting dates to strings and vice-versa.
+    /// The strings are structured so that lexicographic sorting orders by date,
+    /// which makes them suitable for use as field values and search terms.
+    /// 
+    /// <P>Note that this class saves dates with millisecond granularity,
+    /// which is bad for {@link RangeQuery} and {@link PrefixQuery}, as those
+    /// queries are expanded to a BooleanQuery with a potentially large number
+    /// of terms when searching. Thus you might want to use
+    /// {@link DateTools} instead.
+    /// 
+    /// <P>
+    /// Note: dates before 1970 cannot be used, and therefore cannot be
+    /// indexed when using this class. See {@link DateTools} for an
+    /// alternative without such a limitation.
+    /// 
+    /// </summary>
+    /// <deprecated> If you build a new index, use {@link DateTools} instead. This class is included for use with existing
+    /// indices and will be removed in a future release.
+    /// </deprecated>
+    public class DateField
+    {
 		
-		// make date strings long enough to last a millenium
-		private static int DATE_LEN = SupportClass.Number.ToString(
+        private DateField()
+        {
+        }
+		
+        // make date strings long enough to last a millenium
+        private static int DATE_LEN = SupportClass.Number.ToString(
             1000L * 365 * 24 * 60 * 60 * 1000, 16).Length;
 		
-		public static System.String MIN_DATE_STRING()
-		{
-			return TimeToString(0);
-		}
-		
-		public static System.String MAX_DATE_STRING()
-		{
-			char[] buffer = new char[DATE_LEN];
-			char c = SupportClass.Character.ForDigit(36 - 1, SupportClass.Character.MAX_RADIX);
-			for (int i = 0; i < DATE_LEN; i++)
-				buffer[i] = c;
-			return new System.String(buffer);
-		}
-		
-		/// <summary> Converts a Date to a string suitable for indexing.</summary>
-		/// <throws>  RuntimeException if the date specified in the </throws>
-		/// <summary> method argument is before 1970
-		/// </summary>
-		public static System.String DateToString(System.DateTime date)
-		{
+        public static System.String MIN_DATE_STRING()
+        {
+            return TimeToString(0);
+        }
+		
+        public static System.String MAX_DATE_STRING()
+        {
+            char[] buffer = new char[DATE_LEN];
+            char c = SupportClass.Character.ForDigit(36 - 1, SupportClass.Character.MAX_RADIX);
+            for (int i = 0; i < DATE_LEN; i++)
+                buffer[i] = c;
+            return new System.String(buffer);
+        }
+		
+        /// <summary> Converts a Date to a string suitable for indexing.</summary>
+        /// <throws>  SystemException if the date specified in the </throws>
+        /// <summary> method argument is before 1970
+        /// </summary>
+        public static System.String DateToString(System.DateTime date)
+        {
             TimeSpan ts = date.Subtract(new DateTime(1970, 1, 1));
             ts = ts.Subtract(TimeZone.CurrentTimeZone.GetUtcOffset(date));
             return TimeToString(ts.Ticks / TimeSpan.TicksPerMillisecond);
         }
 
-		/// <summary> Converts a millisecond time to a string suitable for indexing.</summary>
-		/// <throws>  RuntimeException if the time specified in the </throws>
-		/// <summary> method argument is negative, that is, before 1970
-		/// </summary>
-		public static System.String TimeToString(long time)
-		{
-			if (time < 0)
-				throw new System.SystemException("time '" + time + "' is too early, must be >= 0");
+        /// <summary> Converts a millisecond time to a string suitable for indexing.</summary>
+        /// <throws>  SystemException if the time specified in the </throws>
+        /// <summary> method argument is negative, that is, before 1970
+        /// </summary>
+        public static System.String TimeToString(long time)
+        {
+            if (time < 0)
+                throw new System.SystemException("time '" + time + "' is too early, must be >= 0");
 			
-			System.String s = SupportClass.Number.ToString(time, SupportClass.Number.MAX_RADIX);
+            System.String s = SupportClass.Number.ToString(time, SupportClass.Number.MAX_RADIX);
 			
-			if (s.Length > DATE_LEN)
-				throw new System.SystemException("time '" + time + "' is too late, length of string " + "representation must be <= " + DATE_LEN);
+            if (s.Length > DATE_LEN)
+                throw new System.SystemException("time '" + time + "' is too late, length of string " + "representation must be <= " + DATE_LEN);
 			
-			// Pad with leading zeros
-			if (s.Length < DATE_LEN)
-			{
-				System.Text.StringBuilder sb = new System.Text.StringBuilder(s);
-				while (sb.Length < DATE_LEN)
-					sb.Insert(0, 0);
-				s = sb.ToString();
-			}
+            // Pad with leading zeros
+            if (s.Length < DATE_LEN)
+            {
+                System.Text.StringBuilder sb = new System.Text.StringBuilder(s);
+                while (sb.Length < DATE_LEN)
+                    sb.Insert(0, 0);
+                s = sb.ToString();
+            }
 			
-			return s;
-		}
+            return s;
+        }
 		
-		/// <summary>Converts a string-encoded date into a millisecond time. </summary>
-		public static long StringToTime(System.String s)
-		{
-			return SupportClass.Number.Parse(s, SupportClass.Number.MAX_RADIX);
-		}
-		
-		/// <summary>Converts a string-encoded date into a Date object. </summary>
-		public static System.DateTime StringToDate(System.String s)
-		{
-			long ticks = StringToTime(s) * TimeSpan.TicksPerMillisecond;
-			System.DateTime date = new System.DateTime(1970, 1, 1);
-			date = date.AddTicks(ticks);
-			date = date.Add(TimeZone.CurrentTimeZone.GetUtcOffset(date));
-			return date;
-		}
-	}
+        /// <summary>Converts a string-encoded date into a millisecond time. </summary>
+        public static long StringToTime(System.String s)
+        {
+            return SupportClass.Number.Parse(s, SupportClass.Number.MAX_RADIX);
+        }
+		
+        /// <summary>Converts a string-encoded date into a Date object. </summary>
+        public static System.DateTime StringToDate(System.String s)
+        {
+            long ticks = StringToTime(s) * TimeSpan.TicksPerMillisecond;
+            System.DateTime date = new System.DateTime(1970, 1, 1);
+            date = date.AddTicks(ticks);
+            date = date.Add(TimeZone.CurrentTimeZone.GetUtcOffset(date));
+            return date;
+        }
+    }
 }

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateTools.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/DateTools.cs?view=diff&rev=534192&r1=534191&r2=534192
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateTools.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateTools.cs Tue May  1 11:45:26 2007
@@ -36,6 +36,17 @@
 	public class DateTools
 	{
 		
+		// private static readonly System.TimeZone GMT = TimeZone.getTimeZone("GMT");   // {{Aroush-2.1}}
+		
+		private static readonly System.String YEAR_FORMAT = "yyyy";
+		private static readonly System.String MONTH_FORMAT = "yyyyMM";
+		private static readonly System.String DAY_FORMAT = "yyyyMMdd";
+		private static readonly System.String HOUR_FORMAT = "yyyyMMddHH";
+		private static readonly System.String MINUTE_FORMAT = "yyyyMMddHHmm";
+		private static readonly System.String SECOND_FORMAT = "yyyyMMddHHmmss";
+		private static readonly System.String MILLISECOND_FORMAT = "yyyyMMddHHmmssfff";
+		
+		// cannot create, the class has static methods only
 		private DateTools()
 		{
 		}
@@ -49,7 +60,7 @@
 		/// {@link #Round(Date, DateTools.Resolution)}
 		/// </param>
 		/// <returns> a string in format <code>yyyyMMddHHmmssSSS</code> or shorter,
-		/// depeding on <code>resolution</code>
+		/// depeding on <code>resolution</code>; using UTC as timezone 
 		/// </returns>
 		public static System.String DateToString(System.DateTime date, Resolution resolution)
 		{
@@ -69,53 +80,72 @@
 		/// </returns>
 		public static System.String TimeToString(long time, Resolution resolution)
 		{
-			System.Globalization.Calendar cal = new System.Globalization.GregorianCalendar(); // {{Aroush}} do we care about 'cal'
+			System.Globalization.Calendar cal = new System.Globalization.GregorianCalendar();
 			
 			//protected in JDK's prior to 1.4
 			//cal.setTimeInMillis(round(time, resolution));
 			
 			System.DateTime dt = new System.DateTime(Round(time, resolution));
-
-			System.String t = "";
-
-            if (resolution == Resolution.YEAR)
-            {
-                t = dt.ToString("yyyy");
-            }
-            else if (resolution == Resolution.MONTH)
-            {
-                t = dt.ToString("yyyyMM");
-            }
-            else if (resolution == Resolution.DAY)
-            {
-                t = dt.ToString("yyyyMMdd");
-            }
-            else if (resolution == Resolution.HOUR)
-            {
-                t = dt.ToString("yyyyMMddHH");
-            }
-            else if (resolution == Resolution.MINUTE)
-            {
-                t = dt.ToString("yyyyMMddHHmm");
-            }
-            else if (resolution == Resolution.SECOND)
-            {
-                t = dt.ToString("yyyyMMddHHmmss");
-            }
-            else if (resolution == Resolution.MILLISECOND)
-            {
-                t = dt.ToString("yyyyMMddHHmmssfff");
-            }
-            else
-            {
-                throw new System.ArgumentException("unknown resolution " + resolution);
-            }
-
-            return t;
+			
+			System.String result;
+			if (resolution == Resolution.YEAR)
+			{
+				lock (YEAR_FORMAT)
+				{
+					result = dt.ToString(YEAR_FORMAT);
+				}
+			}
+			else if (resolution == Resolution.MONTH)
+			{
+				lock (MONTH_FORMAT)
+				{
+					result = dt.ToString(MONTH_FORMAT);
+				}
+			}
+			else if (resolution == Resolution.DAY)
+			{
+				lock (DAY_FORMAT)
+				{
+					result = result = dt.ToString(DAY_FORMAT);
+				}
+			}
+			else if (resolution == Resolution.HOUR)
+			{
+				lock (HOUR_FORMAT)
+				{
+					result = result = dt.ToString(HOUR_FORMAT);
+				}
+			}
+			else if (resolution == Resolution.MINUTE)
+			{
+				lock (MINUTE_FORMAT)
+				{
+					result = result = dt.ToString(MINUTE_FORMAT);
+				}
+			}
+			else if (resolution == Resolution.SECOND)
+			{
+				lock (SECOND_FORMAT)
+				{
+					result = result = dt.ToString(SECOND_FORMAT);
+				}
+			}
+			else if (resolution == Resolution.MILLISECOND)
+			{
+				lock (MILLISECOND_FORMAT)
+				{
+					result = result = dt.ToString(MILLISECOND_FORMAT);
+				}
+			}
+			else
+			{
+				throw new System.ArgumentException("unknown resolution " + resolution);
+			}
+			return result;
 		}
 		
 		/// <summary> Converts a string produced by <code>timeToString</code> or
-		/// <code>DateToString</code> back to a time, represented as the
+		/// <code>dateToString</code> back to a time, represented as the
 		/// number of milliseconds since January 1, 1970, 00:00:00 GMT.
 		/// 
 		/// </summary>
@@ -132,7 +162,7 @@
 		}
 		
 		/// <summary> Converts a string produced by <code>timeToString</code> or
-		/// <code>DateToString</code> back to a time, represented as a
+		/// <code>dateToString</code> back to a time, represented as a
 		/// Date object.
 		/// 
 		/// </summary>
@@ -145,85 +175,89 @@
 		/// </summary>
 		public static System.DateTime StringToDate(System.String dateString)
 		{
-            System.String yyyy = "1";
-            System.String MM = "1";
-            System.String dd = "1";
-            System.String HH = "0";
-            System.String mm = "0";
-            System.String ss = "0";
-            System.String SSS = "0";
-
-            if (dateString.Length == 4)     // "yyyy"
-            {
-                yyyy = dateString.Substring(0, 4);
-            }
-            else if (dateString.Length == 6)     // "yyyyMM";
-            {
-                yyyy = dateString.Substring(0, 4);
-                MM = dateString.Substring(4, 2);
-            }
-            else if (dateString.Length == 8)     // "yyyyMMdd"
-            {
-                yyyy = dateString.Substring(0, 4);
-                MM = dateString.Substring(4, 2);
-                dd = dateString.Substring(6, 2);
-            }
-            else if (dateString.Length == 10)    // "yyyyMMddHH"
-            {
-                yyyy = dateString.Substring(0, 4);
-                MM = dateString.Substring(4, 2);
-                dd = dateString.Substring(6, 2);
-                HH = dateString.Substring(8, 2);
-            }
-            else if (dateString.Length == 12)    // "yyyyMMddHHmm";
-            {
-                yyyy = dateString.Substring(0, 4);
-                MM = dateString.Substring(4, 2);
-                dd = dateString.Substring(6, 2);
-                HH = dateString.Substring(8, 2);
-                mm = dateString.Substring(10, 2);
-            }
-            else if (dateString.Length == 14)    // "yyyyMMddHHmmss";
-            {
-                yyyy = dateString.Substring(0, 4);
-                MM = dateString.Substring(4, 2);
-                dd = dateString.Substring(6, 2);
-                HH = dateString.Substring(8, 2);
-                mm = dateString.Substring(10, 2);
-                ss = dateString.Substring(12, 2);
-            }
-            else if (dateString.Length == 17)    // "yyyyMMddHHmmssSSS";
-            {
-                yyyy = dateString.Substring(0, 4);
-                MM = dateString.Substring(4, 2);
-                dd = dateString.Substring(6, 2);
-                HH = dateString.Substring(8, 2);
-                mm = dateString.Substring(10, 2);
-                ss = dateString.Substring(12, 2);
-                SSS = dateString.Substring(14, 3);
-            }
-            else
-            {
-                throw new System.FormatException("Input is not valid date string: " + dateString);
-            }
-
-            int y, M, d, H, m, s, S;
-            y = Convert.ToInt16(yyyy);
-            M = Convert.ToInt16(MM);
-            d = Convert.ToInt16(dd);
-            H = Convert.ToInt16(HH);
-            m = Convert.ToInt16(mm);
-            s = Convert.ToInt16(ss);
-            S = Convert.ToInt16(SSS);
-
-            return new System.DateTime(y, 
-                M, d, H, 
-                m, s, S);
-
-            //return new System.DateTime(Convert.ToInt16(yyyy), 
-            //    Convert.ToInt16(MM), Convert.ToInt16(dd), Convert.ToInt16(HH), 
-            //    Convert.ToInt16(mm), Convert.ToInt16(ss), Convert.ToInt16(SSS));
-        }
+			System.DateTime date;
+			if (dateString.Length == 4)
+			{
+				lock (YEAR_FORMAT)
+				{
+					date = new System.DateTime(Convert.ToInt16(dateString.Substring(0, 4)),
+                        0, 0, 0, 0, 0, 0);
+				}
+			}
+			else if (dateString.Length == 6)
+			{
+				lock (MONTH_FORMAT)
+				{
+                    date = new System.DateTime(Convert.ToInt16(dateString.Substring(0, 4)),
+                        Convert.ToInt16(dateString.Substring(4, 2)),
+                        0, 0, 0, 0, 0);
+				}
+			}
+			else if (dateString.Length == 8)
+			{
+				lock (DAY_FORMAT)
+				{
+                    date = new System.DateTime(Convert.ToInt16(dateString.Substring(0, 4)),
+                        Convert.ToInt16(dateString.Substring(4, 2)),
+                        Convert.ToInt16(dateString.Substring(6, 2)),
+                        0, 0, 0, 0);
+                }
+			}
+			else if (dateString.Length == 10)
+			{
+				lock (HOUR_FORMAT)
+				{
+                    date = new System.DateTime(Convert.ToInt16(dateString.Substring(0, 4)),
+                        Convert.ToInt16(dateString.Substring(4, 2)),
+                        Convert.ToInt16(dateString.Substring(6, 2)),
+                        Convert.ToInt16(dateString.Substring(8, 2)),
+                        0, 0, 0);
+                }
+			}
+			else if (dateString.Length == 12)
+			{
+				lock (MINUTE_FORMAT)
+				{
+                    date = new System.DateTime(Convert.ToInt16(dateString.Substring(0, 4)),
+                        Convert.ToInt16(dateString.Substring(4, 2)),
+                        Convert.ToInt16(dateString.Substring(6, 2)),
+                        Convert.ToInt16(dateString.Substring(8, 2)),
+                        Convert.ToInt16(dateString.Substring(10, 2)),
+                        0, 0);
+                }
+			}
+			else if (dateString.Length == 14)
+			{
+				lock (SECOND_FORMAT)
+				{
+                    date = new System.DateTime(Convert.ToInt16(dateString.Substring(0, 4)),
+                        Convert.ToInt16(dateString.Substring(4, 2)),
+                        Convert.ToInt16(dateString.Substring(6, 2)),
+                        Convert.ToInt16(dateString.Substring(8, 2)),
+                        Convert.ToInt16(dateString.Substring(10, 2)),
+                        Convert.ToInt16(dateString.Substring(12, 2)),
+                        0);
+                }
+			}
+			else if (dateString.Length == 17)
+			{
+				lock (MILLISECOND_FORMAT)
+				{
+                    date = new System.DateTime(Convert.ToInt16(dateString.Substring(0, 4)),
+                        Convert.ToInt16(dateString.Substring(4, 2)),
+                        Convert.ToInt16(dateString.Substring(6, 2)),
+                        Convert.ToInt16(dateString.Substring(8, 2)),
+                        Convert.ToInt16(dateString.Substring(10, 2)),
+                        Convert.ToInt16(dateString.Substring(12, 2)),
+                        Convert.ToInt16(dateString.Substring(14, 3)));
+                }
+			}
+			else
+			{
+				throw new System.FormatException("Input is not valid date string: " + dateString);
+			}
+			return date;
+		}
 		
 		/// <summary> Limit a date's resolution. For example, the date <code>2004-09-21 13:50:11</code>
 		/// will be changed to <code>2004-09-01 00:00:00</code> when using
@@ -235,10 +269,10 @@
 		/// <returns> the date with all values more precise than <code>resolution</code>
 		/// set to 0 or 1
 		/// </returns>
-        public static System.DateTime Round(System.DateTime date, Resolution resolution)
-        {
-            return new System.DateTime(Round(date.Ticks, resolution));
-        }
+		public static System.DateTime Round(System.DateTime date, Resolution resolution)
+		{
+			return new System.DateTime(Round(date.Ticks, resolution));
+		}
 		
 		/// <summary> Limit a date's resolution. For example, the date <code>1095767411000</code>
 		/// (which represents 2004-09-21 13:50:11) will be changed to 
@@ -251,17 +285,17 @@
 		/// <returns> the date with all values more precise than <code>resolution</code>
 		/// set to 0 or 1, expressed as milliseconds since January 1, 1970, 00:00:00 GMT
 		/// </returns>
-        public static long Round(long time, Resolution resolution)
-        {
-            System.Globalization.Calendar cal = new System.Globalization.GregorianCalendar(); // {{Aroush}} do we care about 'cal'
+		public static long Round(long time, Resolution resolution)
+		{
+			System.Globalization.Calendar cal = new System.Globalization.GregorianCalendar();   // {{Aroush}} do we care about 'cal'
 			
-            // protected in JDK's prior to 1.4
-            //cal.setTimeInMillis(time);
+			// protected in JDK's prior to 1.4
+			//cal.setTimeInMillis(time);
 			
-            System.DateTime dt = new System.DateTime(time);
+			System.DateTime dt = new System.DateTime(time);
 			
-            if (resolution == Resolution.YEAR)
-            {
+			if (resolution == Resolution.YEAR)
+			{
                 dt = dt.AddMonths(1 - dt.Month);
                 dt = dt.AddDays(1 - dt.Day);
                 dt = dt.AddHours(0 - dt.Hour);
@@ -269,50 +303,51 @@
                 dt = dt.AddSeconds(0 - dt.Second);
                 dt = dt.AddMilliseconds(0 - dt.Millisecond);
             }
-            else if (resolution == Resolution.MONTH)
-            {
+			else if (resolution == Resolution.MONTH)
+			{
                 dt = dt.AddDays(1 - dt.Day);
                 dt = dt.AddHours(0 - dt.Hour);
                 dt = dt.AddMinutes(0 - dt.Minute);
                 dt = dt.AddSeconds(0 - dt.Second);
                 dt = dt.AddMilliseconds(0 - dt.Millisecond);
             }
-            else if (resolution == Resolution.DAY)
-            {
+			else if (resolution == Resolution.DAY)
+			{
                 dt = dt.AddHours(0 - dt.Hour);
                 dt = dt.AddMinutes(0 - dt.Minute);
                 dt = dt.AddSeconds(0 - dt.Second);
                 dt = dt.AddMilliseconds(0 - dt.Millisecond);
             }
-            else if (resolution == Resolution.HOUR)
-            {
+			else if (resolution == Resolution.HOUR)
+			{
                 dt = dt.AddMinutes(0 - dt.Minute);
                 dt = dt.AddSeconds(0 - dt.Second);
                 dt = dt.AddMilliseconds(0 - dt.Millisecond);
             }
-            else if (resolution == Resolution.MINUTE)
-            {
+			else if (resolution == Resolution.MINUTE)
+			{
                 dt = dt.AddSeconds(0 - dt.Second);
                 dt = dt.AddMilliseconds(0 - dt.Millisecond);
             }
-            else if (resolution == Resolution.SECOND)
-            {
+			else if (resolution == Resolution.SECOND)
+			{
                 dt = dt.AddMilliseconds(0 - dt.Millisecond);
             }
-            else if (resolution == Resolution.MILLISECOND)
-            {
-                // don't cut off anything
-            }
-            else
-            {
-                throw new System.ArgumentException("unknown resolution " + resolution);
-            }
-            return dt.Ticks;
-        }
+			else if (resolution == Resolution.MILLISECOND)
+			{
+				// don't cut off anything
+			}
+			else
+			{
+				throw new System.ArgumentException("unknown resolution " + resolution);
+			}
+			return dt.Ticks;
+		}
 		
-        /// <summary>Specifies the time granularity. </summary>
-        public class Resolution
+		/// <summary>Specifies the time granularity. </summary>
+		public class Resolution
 		{
+			
 			public static readonly Resolution YEAR = new Resolution("year");
 			public static readonly Resolution MONTH = new Resolution("month");
 			public static readonly Resolution DAY = new Resolution("day");
@@ -335,6 +370,23 @@
 			public override System.String ToString()
 			{
 				return resolution;
+			}
+		}
+		static DateTools()
+		{
+			{
+				// times need to be normalized so the value doesn't depend on the 
+				// location the index is created/used:
+                // {{Aroush-2.1}}
+                /*
+				YEAR_FORMAT.setTimeZone(GMT);
+				MONTH_FORMAT.setTimeZone(GMT);
+				DAY_FORMAT.setTimeZone(GMT);
+				HOUR_FORMAT.setTimeZone(GMT);
+				MINUTE_FORMAT.setTimeZone(GMT);
+				SECOND_FORMAT.setTimeZone(GMT);
+				MILLISECOND_FORMAT.setTimeZone(GMT);
+                */
 			}
 		}
 	}

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Document.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/Document.cs?view=diff&rev=534192&r1=534191&r2=534192
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Document.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Document.cs Tue May  1 11:45:26 2007
@@ -16,22 +16,24 @@
  */
 
 using System;
+
 using IndexReader = Lucene.Net.Index.IndexReader;
 using Hits = Lucene.Net.Search.Hits;
 using Searcher = Lucene.Net.Search.Searcher;
 
 namespace Lucene.Net.Documents
 {
+	// for javadoc
 	
 	/// <summary>Documents are the unit of indexing and search.
 	/// 
 	/// A Document is a set of fields.  Each field has a name and a textual value.
-	/// A field may be {@link Field#IsStored() stored} with the document, in which
+	/// A field may be {@link Fieldable#IsStored() stored} with the document, in which
 	/// case it is returned with search hits on the document.  Thus each document
 	/// should typically contain one or more stored fields which uniquely identify
 	/// it.
 	/// 
-	/// <p>Note that fields which are <i>not</i> {@link Field#IsStored() stored} are
+	/// <p>Note that fields which are <i>not</i> {@link Fieldable#IsStored() stored} are
 	/// <i>not</i> available in documents retrieved from the index, e.g. with {@link
 	/// Hits#Doc(int)}, {@link Searcher#Doc(int)} or {@link
 	/// IndexReader#Document(int)}.
@@ -55,15 +57,16 @@
             return fields.Count;
         }
 		
+		
 		/// <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
+		/// <p>Values are multiplied into the value of {@link Fieldable#GetBoost()} of
 		/// each field in this document.  Thus, this method in effect sets a default
 		/// boost for the fields of this document.
 		/// 
 		/// </summary>
-		/// <seealso cref="Field.SetBoost(float)">
+		/// <seealso cref="Fieldable#SetBoost(float)">
 		/// </seealso>
 		public void  SetBoost(float boost)
 		{
@@ -80,7 +83,7 @@
 		/// this document was indexed.
 		/// 
 		/// </summary>
-		/// <seealso cref="SetBoost(float)">
+		/// <seealso cref="#SetBoost(float)">
 		/// </seealso>
 		public float GetBoost()
 		{
@@ -96,7 +99,7 @@
 		/// a document has to be deleted from an index and a new changed version of that
 		/// document has to be added.</p>
 		/// </summary>
-		public void  Add(Field field)
+		public void  Add(Fieldable field)
 		{
 			fields.Add(field);
 		}
@@ -115,7 +118,7 @@
 			System.Collections.IEnumerator it = fields.GetEnumerator();
 			while (it.MoveNext())
 			{
-				Field field = (Field) it.Current;
+				Fieldable field = (Fieldable) it.Current;
 				if (field.Name().Equals(name))
 				{
 					fields.Remove(field);
@@ -142,11 +145,12 @@
                     fields.RemoveAt(i);
                 }
             }
-		}
+        }
 		
 		/// <summary>Returns a field with the given name if any exist in this document, or
 		/// null.  If multiple fields exists with this name, this method returns the
 		/// first value added.
+		/// Do not use this method with lazy loaded fields.
 		/// </summary>
 		public Field GetField(System.String name)
 		{
@@ -159,6 +163,22 @@
 			return null;
 		}
 		
+		
+		/// <summary>Returns a field with the given name if any exist in this document, or
+		/// null.  If multiple fields exists with this name, this method returns the
+		/// first value added.
+		/// </summary>
+		public Fieldable GetFieldable(System.String name)
+		{
+			for (int i = 0; i < fields.Count; i++)
+			{
+				Fieldable field = (Fieldable) fields[i];
+				if (field.Name().Equals(name))
+					return field;
+			}
+			return null;
+		}
+		
 		/// <summary>Returns the string value of the field with the given name if any exist in
 		/// this document, or null.  If multiple fields exist with this name, this
 		/// method returns the first value added. If only binary fields with this name
@@ -168,21 +188,34 @@
 		{
 			for (int i = 0; i < fields.Count; i++)
 			{
-				Field field = (Field) fields[i];
+				Fieldable field = (Fieldable) fields[i];
 				if (field.Name().Equals(name) && (!field.IsBinary()))
 					return field.StringValue();
 			}
 			return null;
 		}
 		
-		/// <summary>Returns an Enumeration of all the fields in a document. </summary>
+		/// <summary>Returns an Enumeration of all the fields in a document.</summary>
+		/// <deprecated> use {@link #GetFields()} instead
+		/// </deprecated>
 		public System.Collections.IEnumerable Fields()
 		{
-            return fields;
+			return fields;
+		}
+		
+		/// <summary>Returns a List of all the fields in a document.
+		/// <p>Note that fields which are <i>not</i> {@link Fieldable#IsStored() stored} are
+		/// <i>not</i> available in documents retrieved from the index, e.g. with {@link
+		/// Hits#Doc(int)}, {@link Searcher#Doc(int)} or {@link IndexReader#Document(int)}.
+		/// </summary>
+		public System.Collections.IList GetFields()
+		{
+			return fields;
 		}
 		
 		/// <summary> Returns an array of {@link Field}s with the given name.
 		/// This method can return <code>null</code>.
+		/// Do not use with lazy loaded fields.
 		/// 
 		/// </summary>
 		/// <param name="name">the name of the field
@@ -207,20 +240,48 @@
 			return (Field[]) result.ToArray(typeof(Field));
 		}
 		
+		
+		/// <summary> Returns an array of {@link Fieldable}s with the given name.
+		/// This method can return <code>null</code>.
+		/// 
+		/// </summary>
+		/// <param name="name">the name of the field
+		/// </param>
+		/// <returns> a <code>Fieldable[]</code> array or <code>null</code>
+		/// </returns>
+		public Fieldable[] GetFieldables(System.String name)
+		{
+			System.Collections.ArrayList result = new System.Collections.ArrayList();
+			for (int i = 0; i < fields.Count; i++)
+			{
+				Fieldable field = (Fieldable) fields[i];
+				if (field.Name().Equals(name))
+				{
+					result.Add(field);
+				}
+			}
+			
+			if (result.Count == 0)
+				return null;
+			
+			return (Fieldable[]) result.ToArray(typeof(Field));
+		}
+		
+		
 		/// <summary> Returns an array of values of the field specified as the method parameter.
 		/// This method can return <code>null</code>.
 		/// 
 		/// </summary>
 		/// <param name="name">the name of the field
 		/// </param>
-		/// <returns> a <code>String[]</code> of field values
+		/// <returns> a <code>String[]</code> of field values or <code>null</code>
 		/// </returns>
 		public System.String[] GetValues(System.String name)
 		{
 			System.Collections.ArrayList result = new System.Collections.ArrayList();
 			for (int i = 0; i < fields.Count; i++)
 			{
-				Field field = (Field) fields[i];
+				Fieldable field = (Fieldable) fields[i];
 				if (field.Name().Equals(name) && (!field.IsBinary()))
 					result.Add(field.StringValue());
 			}
@@ -238,24 +299,24 @@
 		/// </summary>
 		/// <param name="name">the name of the field
 		/// </param>
-		/// <returns> a  <code>byte[][]</code> of binary field values.
+		/// <returns> a  <code>byte[][]</code> of binary field values or <code>null</code>
 		/// </returns>
 		public byte[][] GetBinaryValues(System.String name)
 		{
 			System.Collections.IList result = new System.Collections.ArrayList();
 			for (int i = 0; i < fields.Count; i++)
 			{
-				Field field = (Field) fields[i];
+				Fieldable field = (Fieldable) fields[i];
 				if (field.Name().Equals(name) && (field.IsBinary()))
-                {
-                    byte[] byteArray = field.BinaryValue();
-                    byte[] resultByteArray = new byte[byteArray.Length];
-                    for (int index = 0; index < byteArray.Length; index++)
-                        resultByteArray[index] = (byte) byteArray[index];
+				{
+					byte[] byteArray = field.BinaryValue();
+					byte[] resultByteArray = new byte[byteArray.Length];
+					for (int index = 0; index < byteArray.Length; index++)
+						resultByteArray[index] = (byte) byteArray[index];
 
-                    result.Add(resultByteArray);
-                }
-            }
+					result.Add(resultByteArray);
+				}
+			}
 			
 			if (result.Count == 0)
 				return null;
@@ -287,13 +348,13 @@
 		/// </summary>
 		/// <param name="name">the name of the field.
 		/// </param>
-		/// <returns> a <code>byte[]</code> containing the binary field value.
+		/// <returns> a <code>byte[]</code> containing the binary field value or <code>null</code>
 		/// </returns>
 		public byte[] GetBinaryValue(System.String name)
 		{
 			for (int i = 0; i < fields.Count; i++)
 			{
-				Field field = (Field) fields[i];
+				Fieldable field = (Fieldable) fields[i];
 				if (field.Name().Equals(name) && (field.IsBinary()))
 					return field.BinaryValue();
 			}
@@ -307,7 +368,7 @@
 			buffer.Append("Document<");
 			for (int i = 0; i < fields.Count; i++)
 			{
-				Field field = (Field) fields[i];
+				Fieldable field = (Fieldable) fields[i];
 				buffer.Append(field.ToString());
 				if (i != fields.Count - 1)
 					buffer.Append(" ");

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Field.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/Field.cs?view=diff&rev=534192&r1=534191&r2=534192
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Field.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Field.cs Tue May  1 11:45:26 2007
@@ -16,9 +16,6 @@
  */
 
 using System;
-using IndexReader = Lucene.Net.Index.IndexReader;
-using Hits = Lucene.Net.Search.Hits;
-using Similarity = Lucene.Net.Search.Similarity;
 using Parameter = Lucene.Net.Util.Parameter;
 
 namespace Lucene.Net.Documents
@@ -32,31 +29,15 @@
 	/// </summary>
 	
 	[Serializable]
-	public sealed class Field
+	public sealed class Field:AbstractField, Fieldable
 	{
-		private System.String name = "body";
 		
-		// the one and only data object for all different kind of field values
-		private System.Object fieldsData = null;
-		
-		private bool storeTermVector = false;
-		private bool storeOffsetWithTermVector = false;
-		private bool storePositionWithTermVector = false;
-		private bool omitNorms = false;
-		private bool isStored = false;
-		private bool isIndexed = true;
-		private bool isTokenized = true;
-		private bool isBinary = false;
-		private bool isCompressed = false;
-		
-		private float boost = 1.0f;
-		
-        /// <summary>Specifies whether and how a field should be stored. </summary>
-        [Serializable]
-		public sealed class Store : Parameter
+		/// <summary>Specifies whether and how a field should be stored. </summary>
+		[Serializable]
+		public sealed class Store:Parameter
 		{
 			
-			internal Store(System.String name) : base(name)
+			internal Store(System.String name):base(name)
 			{
 			}
 			
@@ -68,7 +49,7 @@
 			/// <summary>Store the original field value in the index. This is useful for short texts
 			/// like a document's title which should be displayed with the results. The
 			/// value is stored in its original form, i.e. no analyzer is used before it is
-			/// stored. 
+			/// stored.
 			/// </summary>
 			public static readonly Store YES = new Store("YES");
 			
@@ -76,8 +57,8 @@
 			public static readonly Store NO = new Store("NO");
 		}
 		
-        /// <summary>Specifies whether and how a field should be indexed. </summary>
-        [Serializable]
+		/// <summary>Specifies whether and how a field should be indexed. </summary>
+		[Serializable]
 		public sealed class Index : Parameter
 		{
 			
@@ -86,7 +67,7 @@
 			}
 			
 			/// <summary>Do not index the field value. This field can thus not be searched,
-			/// but one can still access its contents provided it is 
+			/// but one can still access its contents provided it is
 			/// {@link Field.Store stored}. 
 			/// </summary>
 			public static readonly Index NO = new Index("NO");
@@ -108,12 +89,16 @@
 			/// and field length normalization will be disabled.  The benefit is
 			/// less memory usage as norms take up one byte per indexed field
 			/// for every document in the index.
+			/// Note that once you index a given field <i>with</i> norms enabled,
+			/// disabling norms will have no effect.  In other words, for NO_NORMS
+			/// to have the above described effect on a field, all instances of that
+			/// field must be indexed with NO_NORMS from the beginning.
 			/// </summary>
 			public static readonly Index NO_NORMS = new Index("NO_NORMS");
 		}
 		
-        /// <summary>Specifies whether and how a field should have term vectors. </summary>
-        [Serializable]
+		/// <summary>Specifies whether and how a field should have term vectors. </summary>
+		[Serializable]
 		public sealed class TermVector : Parameter
 		{
 			
@@ -132,83 +117,35 @@
 			/// <summary> Store the term vector + token position information
 			/// 
 			/// </summary>
-			/// <seealso cref="YES">
+			/// <seealso cref="#YES">
 			/// </seealso>
 			public static readonly TermVector WITH_POSITIONS = new TermVector("WITH_POSITIONS");
 			
 			/// <summary> Store the term vector + Token offset information
 			/// 
 			/// </summary>
-			/// <seealso cref="YES">
+			/// <seealso cref="#YES">
 			/// </seealso>
 			public static readonly TermVector WITH_OFFSETS = new TermVector("WITH_OFFSETS");
 			
 			/// <summary> Store the term vector + Token position and offset information
 			/// 
 			/// </summary>
-			/// <seealso cref="YES">
+			/// <seealso cref="#YES">
 			/// </seealso>
-			/// <seealso cref="WITH_POSITIONS">
+			/// <seealso cref="#WITH_POSITIONS">
 			/// </seealso>
-			/// <seealso cref="WITH_OFFSETS">
+			/// <seealso cref="#WITH_OFFSETS">
 			/// </seealso>
 			public static readonly TermVector WITH_POSITIONS_OFFSETS = new TermVector("WITH_POSITIONS_OFFSETS");
 		}
 		
-		/// <summary>Sets the boost factor hits on this field.  This value will be
-		/// multiplied into the score of all hits on this this field of this
-		/// document.
-		/// 
-		/// <p>The boost is multiplied by {@link Document#GetBoost()} of the document
-		/// containing this field.  If a document has multiple fields with the same
-		/// name, all such values are multiplied together.  This product is then
-		/// multipled by the value {@link Similarity#LengthNorm(String,int)}, and
-		/// rounded by {@link Similarity#EncodeNorm(float)} before it is stored in the
-		/// index.  One should attempt to ensure that this product does not overflow
-		/// the range of that encoding.
-		/// 
-		/// </summary>
-		/// <seealso cref="Document.SetBoost(float)">
-		/// </seealso>
-		/// <seealso cref="Similarity.LengthNorm(String, int)">
-		/// </seealso>
-		/// <seealso cref="Similarity.EncodeNorm(float)">
-		/// </seealso>
-		public void  SetBoost(float boost)
-		{
-			this.boost = boost;
-		}
-		
-		/// <summary>Returns the boost factor for hits for this field.
-		/// 
-		/// <p>The default value is 1.0.
-		/// 
-		/// <p>Note: this value is not stored directly with the document in the index.
-		/// Documents returned from {@link IndexReader#Document(int)} and
-		/// {@link Hits#Doc(int)} may thus not have the same value present as when
-		/// this field was indexed.
-		/// 
-		/// </summary>
-		/// <seealso cref="SetBoost(float)">
-		/// </seealso>
-		public float GetBoost()
-		{
-			return boost;
-		}
-		
-		/// <summary>Returns the name of the field as an interned string.
-		/// For example "date", "title", "body", ...
-		/// </summary>
-		public System.String Name()
-		{
-			return name;
-		}
 		
 		/// <summary>The value of the field as a String, or null.  If null, the Reader value
 		/// or binary value is used.  Exactly one of stringValue(), readerValue(), and
 		/// binaryValue() must be set. 
 		/// </summary>
-		public System.String StringValue()
+		public override System.String StringValue()
 		{
 			return fieldsData is System.String ? (System.String) fieldsData : null;
 		}
@@ -217,7 +154,7 @@
 		/// or binary value is  used.  Exactly one of stringValue(), readerValue(),
 		/// and binaryValue() must be set. 
 		/// </summary>
-		public System.IO.TextReader ReaderValue()
+		public override System.IO.TextReader ReaderValue()
 		{
 			return fieldsData is System.IO.TextReader ? (System.IO.TextReader) fieldsData : null;
 		}
@@ -226,7 +163,7 @@
 		/// String value is used.  Exactly one of stringValue(), readerValue() and
 		/// binaryValue() must be set. 
 		/// </summary>
-		public byte[] BinaryValue()
+		public override byte[] BinaryValue()
 		{
 			return fieldsData is byte[] ? (byte[]) fieldsData : null;
 		}
@@ -278,9 +215,9 @@
 				throw new System.NullReferenceException("name cannot be null");
 			if (value_Renamed == null)
 				throw new System.NullReferenceException("value cannot be null");
-            if (name.Length == 0 && value_Renamed.Length == 0)
-                throw new System.ArgumentException("name and value cannot both be empty");
-            if (index == Index.NO && store == Store.NO)
+			if (name.Length == 0 && value_Renamed.Length == 0)
+				throw new System.ArgumentException("name and value cannot both be empty");
+			if (index == Index.NO && store == Store.NO)
 				throw new System.ArgumentException("it doesn't make sense to have a field that " + "is neither indexed nor stored");
 			if (index == Index.NO && termVector != TermVector.NO)
 				throw new System.ArgumentException("cannot store term vector information " + "for a field that is not indexed");
@@ -340,7 +277,7 @@
 		}
 		
 		/// <summary> Create a tokenized and indexed field that is not stored. Term vectors will
-		/// not be stored.
+		/// not be stored.  The Reader is read only when the Document is added to the index.
 		/// 
 		/// </summary>
 		/// <param name="name">The name of the field
@@ -353,7 +290,7 @@
 		}
 		
 		/// <summary> Create a tokenized and indexed field that is not stored, optionally with 
-		/// storing term vectors.
+		/// storing term vectors.  The Reader is read only when the Document is added to the index.
 		/// 
 		/// </summary>
 		/// <param name="name">The name of the field
@@ -384,19 +321,17 @@
 			SetStoreTermVector(termVector);
 		}
 		
-		
-		
-        /// <summary> Create a stored field with binary value. Optionally the value may be compressed.
+		/// <summary> Create a stored field with binary value. Optionally the value may be compressed.
 		/// 
 		/// </summary>
 		/// <param name="name">The name of the field
 		/// </param>
 		/// <param name="value">The binary value
 		/// </param>
-		/// <param name="store">How <code>value</code> should be stored (compressed or not.)
+		/// <param name="store">How <code>value</code> should be stored (compressed or not)
 		/// </param>
-        /// <throws>  IllegalArgumentException if store is <code>Store.NO</code>  </throws>
-        public Field(System.String name, byte[] value_Renamed, Store store)
+		/// <throws>  IllegalArgumentException if store is <code>Store.NO</code>  </throws>
+		public Field(System.String name, byte[] value_Renamed, Store store)
 		{
 			if (name == null)
 				throw new System.ArgumentException("name cannot be null");
@@ -429,191 +364,6 @@
 			this.isBinary = true;
 			
 			SetStoreTermVector(TermVector.NO);
-		}
-		
-		private void  SetStoreTermVector(TermVector termVector)
-		{
-			if (termVector == TermVector.NO)
-			{
-				this.storeTermVector = false;
-				this.storePositionWithTermVector = false;
-				this.storeOffsetWithTermVector = false;
-			}
-			else if (termVector == TermVector.YES)
-			{
-				this.storeTermVector = true;
-				this.storePositionWithTermVector = false;
-				this.storeOffsetWithTermVector = false;
-			}
-			else if (termVector == TermVector.WITH_POSITIONS)
-			{
-				this.storeTermVector = true;
-				this.storePositionWithTermVector = true;
-				this.storeOffsetWithTermVector = false;
-			}
-			else if (termVector == TermVector.WITH_OFFSETS)
-			{
-				this.storeTermVector = true;
-				this.storePositionWithTermVector = false;
-				this.storeOffsetWithTermVector = true;
-			}
-			else if (termVector == TermVector.WITH_POSITIONS_OFFSETS)
-			{
-				this.storeTermVector = true;
-				this.storePositionWithTermVector = true;
-				this.storeOffsetWithTermVector = true;
-			}
-			else
-			{
-				throw new System.ArgumentException("unknown termVector parameter " + termVector);
-			}
-		}
-		
-		/// <summary>True iff the value of the field is to be stored in the index for return
-		/// with search hits.  It is an error for this to be true if a field is
-		/// Reader-valued. 
-		/// </summary>
-		public bool IsStored()
-		{
-			return isStored;
-		}
-		
-		/// <summary>True iff the value of the field is to be indexed, so that it may be
-		/// searched on. 
-		/// </summary>
-		public bool IsIndexed()
-		{
-			return isIndexed;
-		}
-		
-		/// <summary>True iff the value of the field should be tokenized as text prior to
-		/// indexing.  Un-tokenized fields are indexed as a single word and may not be
-		/// Reader-valued. 
-		/// </summary>
-		public bool IsTokenized()
-		{
-			return isTokenized;
-		}
-		
-		/// <summary>True if the value of the field is stored and compressed within the index </summary>
-		public bool IsCompressed()
-		{
-			return isCompressed;
-		}
-		
-		/// <summary>True iff the term or terms used to index this field are stored as a term
-		/// vector, available from {@link IndexReader#GetTermFreqVector(int,String)}.
-		/// These methods do not provide access to the original content of the field,
-		/// only to terms used to index it. If the original content must be
-		/// preserved, use the <code>stored</code> attribute instead.
-		/// 
-		/// </summary>
-		/// <seealso cref="IndexReader.GetTermFreqVector(int, String)">
-		/// </seealso>
-		public bool IsTermVectorStored()
-		{
-			return storeTermVector;
-		}
-		
-		/// <summary> True iff terms are stored as term vector together with their offsets 
-		/// (start and end positon in source text).
-		/// </summary>
-		public bool IsStoreOffsetWithTermVector()
-		{
-			return storeOffsetWithTermVector;
-		}
-		
-		/// <summary> True iff terms are stored as term vector together with their token positions.</summary>
-		public bool IsStorePositionWithTermVector()
-		{
-			return storePositionWithTermVector;
-		}
-		
-		/// <summary>True iff the value of the filed is stored as binary </summary>
-		public bool IsBinary()
-		{
-			return isBinary;
-		}
-		
-		/// <summary>True if norms are omitted for this indexed field </summary>
-		public bool GetOmitNorms()
-		{
-			return omitNorms;
-		}
-		
-		/// <summary>Expert:
-		/// 
-		/// If set, omit normalization factors associated with this indexed field.
-		/// This effectively disables indexing boosts and length normalization for this field.
-		/// </summary>
-		public void  SetOmitNorms(bool omitNorms)
-		{
-			this.omitNorms = omitNorms;
-		}
-		
-		/// <summary>Prints a Field for human consumption. </summary>
-		public override System.String ToString()
-		{
-			System.Text.StringBuilder result = new System.Text.StringBuilder();
-			if (isStored)
-			{
-				result.Append("stored");
-				if (isCompressed)
-					result.Append("/compressed");
-				else
-					result.Append("/uncompressed");
-			}
-			if (isIndexed)
-			{
-				if (result.Length > 0)
-					result.Append(",");
-				result.Append("indexed");
-			}
-			if (isTokenized)
-			{
-				if (result.Length > 0)
-					result.Append(",");
-				result.Append("tokenized");
-			}
-			if (storeTermVector)
-			{
-				if (result.Length > 0)
-					result.Append(",");
-				result.Append("termVector");
-			}
-			if (storeOffsetWithTermVector)
-			{
-				if (result.Length > 0)
-					result.Append(",");
-				result.Append("termVectorOffsets");
-			}
-			if (storePositionWithTermVector)
-			{
-				if (result.Length > 0)
-					result.Append(",");
-				result.Append("termVectorPosition");
-			}
-			if (isBinary)
-			{
-				if (result.Length > 0)
-					result.Append(",");
-				result.Append("binary");
-			}
-			if (omitNorms)
-			{
-				result.Append(",omitNorms");
-			}
-			result.Append('<');
-			result.Append(name);
-			result.Append(':');
-			
-			if (fieldsData != null)
-			{
-				result.Append(fieldsData);
-			}
-			
-			result.Append('>');
-			return result.ToString();
 		}
 	}
 }

Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/FieldSelector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/FieldSelector.cs?view=auto&rev=534192
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/FieldSelector.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/FieldSelector.cs Tue May  1 11:45:26 2007
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Lucene.Net.Documents
+{
+	/// <summary> Similar to a {@link java.io.FileFilter}, the FieldSelector allows one to make decisions about
+	/// what Fields get loaded on a {@link Document} by {@link Lucene.Net.Index.IndexReader#Document(int,Lucene.Net.Documents.FieldSelector)}
+	/// 
+	/// 
+	/// </summary>
+	public interface FieldSelector
+	{
+		
+		/// <summary> </summary>
+		/// <param name="">fieldName
+		/// </param>
+		/// <returns> true if the {@link Field} with <code>fieldName</code> should be loaded or not
+		/// </returns>
+		FieldSelectorResult Accept(System.String fieldName);
+	}
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/FieldSelectorResult.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/FieldSelectorResult.cs?view=auto&rev=534192
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/FieldSelectorResult.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/FieldSelectorResult.cs Tue May  1 11:45:26 2007
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Lucene.Net.Documents
+{
+	/// <summary>  Provides information about what should be done with this Field 
+	/// 
+	/// 
+	/// </summary>
+	//Replace with an enumerated type in 1.5
+	public sealed class FieldSelectorResult
+	{
+		
+		/// <summary> Load this {@link Field} every time the {@link Document} is loaded, reading in the data as it is encounterd.
+		/// {@link Document#GetField(String)} and {@link Document#GetFieldable(String)} should not return null.
+		/// <p/>
+		/// {@link Document#Add(Fieldable)} should be called by the Reader.
+		/// </summary>
+		public static readonly FieldSelectorResult LOAD = new FieldSelectorResult(0);
+		/// <summary> Lazily load this {@link Field}.  This means the {@link Field} is valid, but it may not actually contain its data until
+		/// invoked.  {@link Document#GetField(String)} SHOULD NOT BE USED.  {@link Document#GetFieldable(String)} is safe to use and should
+		/// return a valid instance of a {@link Fieldable}.
+		/// <p/>
+		/// {@link Document#Add(Fieldable)} should be called by the Reader.
+		/// </summary>
+		public static readonly FieldSelectorResult LAZY_LOAD = new FieldSelectorResult(1);
+		/// <summary> Do not load the {@link Field}.  {@link Document#GetField(String)} and {@link Document#GetFieldable(String)} should return null.
+		/// {@link Document#Add(Fieldable)} is not called.
+		/// <p/>
+		/// {@link Document#Add(Fieldable)} should not be called by the Reader.
+		/// </summary>
+		public static readonly FieldSelectorResult NO_LOAD = new FieldSelectorResult(2);
+		/// <summary> Load this field as in the {@link #LOAD} case, but immediately return from {@link Field} loading for the {@link Document}.  Thus, the
+		/// Document may not have its complete set of Fields.  {@link Document#GetField(String)} and {@link Document#GetFieldable(String)} should
+		/// both be valid for this {@link Field}
+		/// <p/>
+		/// {@link Document#Add(Fieldable)} should be called by the Reader.
+		/// </summary>
+		public static readonly FieldSelectorResult LOAD_AND_BREAK = new FieldSelectorResult(3);
+		/// <summary> Behaves much like {@link #LOAD} but does not uncompress any compressed data.  This is used for internal purposes.
+		/// {@link Document#GetField(String)} and {@link Document#GetFieldable(String)} should not return null.
+		/// <p/>
+		/// {@link Document#Add(Fieldable)} should be called by the Reader.
+		/// </summary>
+		public static readonly FieldSelectorResult LOAD_FOR_MERGE = new FieldSelectorResult(4);
+		
+		/// <summary>Expert:  Load the size of this {@link Field} rather than its value.
+		/// Size is measured as number of bytes required to store the field == bytes for a binary or any compressed value, and 2*chars for a String value.
+		/// The size is stored as a binary value, represented as an int in a byte[], with the higher order byte first in [0]
+		/// </summary>
+		public static readonly FieldSelectorResult SIZE = new FieldSelectorResult(5);
+		
+		/// <summary>Expert: Like {@link #SIZE} but immediately break from the field loading loop, i.e. stop loading further fields, after the size is loaded </summary>
+		public static readonly FieldSelectorResult SIZE_AND_BREAK = new FieldSelectorResult(6);
+		
+		
+		
+		private int id;
+		
+		private FieldSelectorResult(int id)
+		{
+			this.id = id;
+		}
+		
+		public  override bool Equals(System.Object o)
+		{
+			if (this == o)
+				return true;
+			if (o == null || GetType() != o.GetType())
+				return false;
+			
+			FieldSelectorResult that = (FieldSelectorResult) o;
+			
+			if (id != that.id)
+				return false;
+			
+			return true;
+		}
+		
+		public override int GetHashCode()
+		{
+			return id;
+		}
+	}
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Fieldable.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/Fieldable.cs?view=auto&rev=534192
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Fieldable.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Fieldable.cs Tue May  1 11:45:26 2007
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Lucene.Net.Documents
+{
+	
+	/// <summary> Synonymous with {@link Field}.
+	/// 
+	/// 
+	/// </summary>
+	public interface Fieldable
+	{
+		/// <summary>Sets the boost factor hits on this field.  This value will be
+		/// multiplied into the score of all hits on this this field of this
+		/// document.
+		/// 
+		/// <p>The boost is multiplied by {@link Lucene.Net.Documents.Document#GetBoost()} of the document
+		/// containing this field.  If a document has multiple fields with the same
+		/// name, all such values are multiplied together.  This product is then
+		/// multipled by the value {@link Lucene.Net.Search.Similarity#LengthNorm(String,int)}, and
+		/// rounded by {@link Lucene.Net.Search.Similarity#EncodeNorm(float)} before it is stored in the
+		/// index.  One should attempt to ensure that this product does not overflow
+		/// the range of that encoding.
+		/// 
+		/// </summary>
+		/// <seealso cref="Lucene.Net.Documents.Document#SetBoost(float)">
+		/// </seealso>
+		/// <seealso cref="int)">
+		/// </seealso>
+		/// <seealso cref="Lucene.Net.Search.Similarity#EncodeNorm(float)">
+		/// </seealso>
+		void  SetBoost(float boost);
+		
+		/// <summary>Returns the boost factor for hits for this field.
+		/// 
+		/// <p>The default value is 1.0.
+		/// 
+		/// <p>Note: this value is not stored directly with the document in the index.
+		/// Documents returned from {@link Lucene.Net.Index.IndexReader#Document(int)} and
+		/// {@link Lucene.Net.Search.Hits#Doc(int)} may thus not have the same value present as when
+		/// this field was indexed.
+		/// 
+		/// </summary>
+		/// <seealso cref="#SetBoost(float)">
+		/// </seealso>
+		float GetBoost();
+		
+		/// <summary>Returns the name of the field as an interned string.
+		/// For example "date", "title", "body", ...
+		/// </summary>
+		System.String Name();
+		
+		/// <summary>The value of the field as a String, or null.  If null, the Reader value
+		/// or binary value is used.  Exactly one of stringValue(), readerValue(), and
+		/// binaryValue() must be set. 
+		/// </summary>
+		System.String StringValue();
+		
+		/// <summary>The value of the field as a Reader, or null.  If null, the String value
+		/// or binary value is  used.  Exactly one of stringValue(), readerValue(),
+		/// and binaryValue() must be set. 
+		/// </summary>
+		System.IO.TextReader ReaderValue();
+		
+		/// <summary>The value of the field in Binary, or null.  If null, the Reader or
+		/// String value is used.  Exactly one of stringValue(), readerValue() and
+		/// binaryValue() must be set. 
+		/// </summary>
+		byte[] BinaryValue();
+		
+		/// <summary>True iff the value of the field is to be stored in the index for return
+		/// with search hits.  It is an error for this to be true if a field is
+		/// Reader-valued. 
+		/// </summary>
+		bool IsStored();
+		
+		/// <summary>True iff the value of the field is to be indexed, so that it may be
+		/// searched on. 
+		/// </summary>
+		bool IsIndexed();
+		
+		/// <summary>True iff the value of the field should be tokenized as text prior to
+		/// indexing.  Un-tokenized fields are indexed as a single word and may not be
+		/// Reader-valued. 
+		/// </summary>
+		bool IsTokenized();
+		
+		/// <summary>True if the value of the field is stored and compressed within the index </summary>
+		bool IsCompressed();
+		
+		/// <summary>True iff the term or terms used to index this field are stored as a term
+		/// vector, available from {@link Lucene.Net.Index.IndexReader#GetTermFreqVector(int,String)}.
+		/// These methods do not provide access to the original content of the field,
+		/// only to terms used to index it. If the original content must be
+		/// preserved, use the <code>stored</code> attribute instead.
+		/// 
+		/// </summary>
+		/// <seealso cref="String)">
+		/// </seealso>
+		bool IsTermVectorStored();
+		
+		/// <summary> True iff terms are stored as term vector together with their offsets 
+		/// (start and end positon in source text).
+		/// </summary>
+		bool IsStoreOffsetWithTermVector();
+		
+		/// <summary> True iff terms are stored as term vector together with their token positions.</summary>
+		bool IsStorePositionWithTermVector();
+		
+		/// <summary>True iff the value of the filed is stored as binary </summary>
+		bool IsBinary();
+		
+		/// <summary>True if norms are omitted for this indexed field </summary>
+		bool GetOmitNorms();
+		
+		/// <summary>Expert:
+		/// 
+		/// If set, omit normalization factors associated with this indexed field.
+		/// This effectively disables indexing boosts and length normalization for this field.
+		/// </summary>
+		void  SetOmitNorms(bool omitNorms);
+		
+		/// <summary> Indicates whether a Field is Lazy or not.  The semantics of Lazy loading are such that if a Field is lazily loaded, retrieving
+		/// it's values via {@link #StringValue()} or {@link #BinaryValue()} is only valid as long as the {@link Lucene.Net.Index.IndexReader} that
+		/// retrieved the {@link Document} is still open.
+		/// 
+		/// </summary>
+		/// <returns> true if this field can be loaded lazily
+		/// </returns>
+		bool IsLazy();
+	}
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/LoadFirstFieldSelector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/LoadFirstFieldSelector.cs?view=auto&rev=534192
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/LoadFirstFieldSelector.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/LoadFirstFieldSelector.cs Tue May  1 11:45:26 2007
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Lucene.Net.Documents
+{
+	/// <summary> Load the First field and break.
+	/// <p/>
+	/// See {@link FieldSelectorResult#LOAD_AND_BREAK}
+	/// </summary>
+	public class LoadFirstFieldSelector : FieldSelector
+	{
+		
+		public virtual FieldSelectorResult Accept(System.String fieldName)
+		{
+			return FieldSelectorResult.LOAD_AND_BREAK;
+		}
+	}
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/MapFieldSelector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/MapFieldSelector.cs?view=auto&rev=534192
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/MapFieldSelector.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/MapFieldSelector.cs Tue May  1 11:45:26 2007
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+* MapFieldSelector.java
+*
+* Created on May 2, 2006, 6:49 PM
+*
+*/
+
+using System;
+
+namespace Lucene.Net.Documents
+{
+	
+	/// <summary> A FieldSelector based on a Map of field names to FieldSelectorResults
+	/// 
+	/// </summary>
+	/// <author>  Chuck Williams
+	/// </author>
+	public class MapFieldSelector : FieldSelector
+	{
+		
+		internal System.Collections.IDictionary fieldSelections;
+		
+		/// <summary>Create a a MapFieldSelector</summary>
+		/// <param name="fieldSelections">maps from field names to FieldSelectorResults
+		/// </param>
+		public MapFieldSelector(System.Collections.IDictionary fieldSelections)
+		{
+			this.fieldSelections = fieldSelections;
+		}
+		
+		/// <summary>Create a a MapFieldSelector</summary>
+		/// <param name="fields">fields to LOAD.  All other fields are NO_LOAD.
+		/// </param>
+		public MapFieldSelector(System.Collections.IList fields)
+		{
+			fieldSelections = new System.Collections.Hashtable(fields.Count * 5 / 3);
+			for (int i = 0; i < fields.Count; i++)
+				fieldSelections[fields[i]] = FieldSelectorResult.LOAD;
+		}
+		
+		/// <summary>Create a a MapFieldSelector</summary>
+		/// <param name="fields">fields to LOAD.  All other fields are NO_LOAD.
+		/// </param>
+		public MapFieldSelector(System.String[] fields)
+		{
+			fieldSelections = new System.Collections.Hashtable(fields.Length * 5 / 3);
+			for (int i = 0; i < fields.Length; i++)
+				fieldSelections[fields[i]] = FieldSelectorResult.LOAD;
+		}
+		
+		/// <summary>Load field according to its associated value in fieldSelections</summary>
+		/// <param name="field">a field name
+		/// </param>
+		/// <returns> the fieldSelections value that field maps to or NO_LOAD if none.
+		/// </returns>
+		public virtual FieldSelectorResult Accept(System.String field)
+		{
+			FieldSelectorResult selection = (FieldSelectorResult) fieldSelections[field];
+			return selection != null ? selection : FieldSelectorResult.NO_LOAD;
+		}
+	}
+}
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/NumberTools.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/NumberTools.cs?view=diff&rev=534192&r1=534191&r2=534192
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/NumberTools.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/NumberTools.cs Tue May  1 11:45:26 2007
@@ -20,137 +20,137 @@
 namespace Lucene.Net.Documents
 {
 	
-    /// <summary> Provides support for converting longs to Strings, and back again. The strings
-    /// are structured so that lexicographic sorting order is preserved.
-    /// 
-    /// <p>
-    /// That is, if l1 is less than l2 for any two longs l1 and l2, then
-    /// NumberTools.longToString(l1) is lexicographically less than
-    /// NumberTools.longToString(l2). (Similarly for "greater than" and "equals".)
-    /// 
-    /// <p>
-    /// This class handles <b>all</b> long values (unlike
-    /// {@link Lucene.Net.document.DateField}).
-    /// 
-    /// </summary>
-    /// <author>  Matt Quail (spud at madbean dot com)
-    /// </author>
-    public class NumberTools
-    {
-		
-        private const int RADIX = 16;
-		
-        private const char NEGATIVE_PREFIX = '-';
-		
-        // NB: NEGATIVE_PREFIX must be < POSITIVE_PREFIX
-        private const char POSITIVE_PREFIX = '0';
-		
-        //NB: this must be less than
-        /// <summary> Equivalent to longToString(Long.MIN_VALUE)</summary>
-#if LUCENE_JAVA_COMPATIBLE
+	/// <summary> Provides support for converting longs to Strings, and back again. The strings
+	/// are structured so that lexicographic sorting order is preserved.
+	/// 
+	/// <p>
+	/// That is, if l1 is less than l2 for any two longs l1 and l2, then
+	/// NumberTools.longToString(l1) is lexicographically less than
+	/// NumberTools.longToString(l2). (Similarly for "greater than" and "equals".)
+	/// 
+	/// <p>
+	/// This class handles <b>all</b> long values (unlike
+	/// {@link Lucene.Net.Documents.DateField}).
+	/// 
+	/// </summary>
+	/// <author>  Matt Quail (spud at madbean dot com)
+	/// </author>
+	public class NumberTools
+	{
+		
+		private const int RADIX = 36;
+		
+		private const char NEGATIVE_PREFIX = '-';
+		
+		// NB: NEGATIVE_PREFIX must be < POSITIVE_PREFIX
+		private const char POSITIVE_PREFIX = '0';
+		
+		//NB: this must be less than
+		/// <summary> Equivalent to longToString(Long.MIN_VALUE)</summary>
+#if !LUCENE_NET_COMPATIBLE
         public static readonly System.String MIN_STRING_VALUE = NEGATIVE_PREFIX + "0000000000000";
 #else
         public static readonly System.String MIN_STRING_VALUE = NEGATIVE_PREFIX + "0000000000000000";
 #endif
 		
-        /// <summary> Equivalent to longToString(Long.MAX_VALUE)</summary>
-#if LUCENE_JAVA_COMPATIBLE
+		/// <summary> Equivalent to longToString(Long.MAX_VALUE)</summary>
+#if !LUCENE_NET_COMPATIBLE
 		public static readonly System.String MAX_STRING_VALUE = POSITIVE_PREFIX + "1y2p0ij32e8e7";
 #else
         public static readonly System.String MAX_STRING_VALUE = POSITIVE_PREFIX + "7fffffffffffffff";
 #endif
 		
-        /// <summary> The length of (all) strings returned by {@link #longToString}</summary>
-        public static readonly int STR_SIZE = MIN_STRING_VALUE.Length;
+		/// <summary> The length of (all) strings returned by {@link #longToString}</summary>
+		public static readonly int STR_SIZE = MIN_STRING_VALUE.Length;
 		
-        /// <summary> Converts a long to a String suitable for indexing.</summary>
-        public static System.String LongToString(long l)
-        {
-
-            if (l == System.Int64.MinValue)
-            {
-                // special case, because long is not symetric around zero
-                return MIN_STRING_VALUE;
-            }
-			
-            System.Text.StringBuilder buf = new System.Text.StringBuilder(STR_SIZE);
-			
-            if (l < 0)
-            {
-                buf.Append(NEGATIVE_PREFIX);
-                l = System.Int64.MaxValue + l + 1;
-            }
-            else
-            {
-                buf.Append(POSITIVE_PREFIX);
-            }
-#if LUCENE_JAVA_COMPATIBLE
+		/// <summary> Converts a long to a String suitable for indexing.</summary>
+		public static System.String LongToString(long l)
+		{
+			
+			if (l == System.Int64.MinValue)
+			{
+				// special case, because long is not symetric around zero
+				return MIN_STRING_VALUE;
+			}
+			
+			System.Text.StringBuilder buf = new System.Text.StringBuilder(STR_SIZE);
+			
+			if (l < 0)
+			{
+				buf.Append(NEGATIVE_PREFIX);
+				l = System.Int64.MaxValue + l + 1;
+			}
+			else
+			{
+				buf.Append(POSITIVE_PREFIX);
+			}
+#if !LUCENE_NET_COMPATIBLE
 			System.String num = ToString(l);
 #else
             System.String num = System.Convert.ToString(l, RADIX);
 #endif
 			
-            int padLen = STR_SIZE - num.Length - buf.Length;
-            while (padLen-- > 0)
-            {
-                buf.Append('0');
-            }
-            buf.Append(num);
-			
-            return buf.ToString();
-        }
-		
-        /// <summary> Converts a String that was returned by {@link #longToString} back to a
-        /// long.
-        /// 
-        /// </summary>
-        /// <throws>  IllegalArgumentException </throws>
-        /// <summary>             if the input is null
-        /// </summary>
-        /// <throws>  NumberFormatException </throws>
-        /// <summary>             if the input does not parse (it was not a String returned by
-        /// longToString()).
-        /// </summary>
-        public static long StringToLong(System.String str)
-        {
-            if (str == null)
-            {
-                throw new System.NullReferenceException("string cannot be null");
-            }
-            if (str.Length != STR_SIZE)
-            {
-                throw new System.FormatException("string is the wrong size");
-            }
-			
-            if (str.Equals(MIN_STRING_VALUE))
-            {
-                return System.Int64.MinValue;
-            }
+			int padLen = STR_SIZE - num.Length - buf.Length;
+			while (padLen-- > 0)
+			{
+				buf.Append('0');
+			}
+			buf.Append(num);
+			
+			return buf.ToString();
+		}
+		
+		/// <summary> Converts a String that was returned by {@link #longToString} back to a
+		/// long.
+		/// 
+		/// </summary>
+		/// <throws>  IllegalArgumentException </throws>
+		/// <summary>             if the input is null
+		/// </summary>
+		/// <throws>  NumberFormatException </throws>
+		/// <summary>             if the input does not parse (it was not a String returned by
+		/// longToString()).
+		/// </summary>
+		public static long StringToLong(System.String str)
+		{
+			if (str == null)
+			{
+				throw new System.NullReferenceException("string cannot be null");
+			}
+			if (str.Length != STR_SIZE)
+			{
+				throw new System.FormatException("string is the wrong size");
+			}
+			
+			if (str.Equals(MIN_STRING_VALUE))
+			{
+				return System.Int64.MinValue;
+			}
 			
-            char prefix = str[0];
-#if LUCENE_JAVA_COMPATIBLE
+			char prefix = str[0];
+#if !LUCENE_NET_COMPATIBLE
 			long l = ToLong(str.Substring(1));
 #else
             long l = System.Convert.ToInt64(str.Substring(1), RADIX);
 #endif
 			
-            if (prefix == POSITIVE_PREFIX)
-            {
-                // nop
-            }
-            else if (prefix == NEGATIVE_PREFIX)
-            {
-                l = l - System.Int64.MaxValue - 1;
-            }
-            else
-            {
-                throw new System.FormatException("string does not begin with the correct prefix");
-            }
+			if (prefix == POSITIVE_PREFIX)
+			{
+				// nop
+			}
+			else if (prefix == NEGATIVE_PREFIX)
+			{
+				l = l - System.Int64.MaxValue - 1;
+			}
+			else
+			{
+				throw new System.FormatException("string does not begin with the correct prefix");
+			}
 			
-            return l;
-        }
+			return l;
+		}
 
-#if LUCENE_JAVA_COMPATIBLE
+#if !LUCENE_NET_COMPATIBLE
         #region BASE36 OPS 
         static System.String digits = "0123456789abcdefghijklmnopqrstuvwxyz";
         static long[] powersOf36 = 



Mime
View raw message