You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ar...@apache.org on 2006/08/17 15:49:32 UTC

svn commit: r432239 [6/8] - in /incubator/lucene.net/trunk/C#/src: ./ Demo/DeleteFiles/ Demo/DemoLib/ Demo/DemoLib/HTML/ Demo/IndexFiles/ Demo/IndexHtml/ Demo/SearchFiles/ Lucene.Net/ Lucene.Net/Analysis/ Lucene.Net/Analysis/Standard/ Lucene.Net/Docume...

Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/TopDocCollector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/TopDocCollector.cs?rev=432239&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/TopDocCollector.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/TopDocCollector.cs Thu Aug 17 06:49:26 2006
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ * 
+ * Licensed 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;
+using PriorityQueue = Lucene.Net.Util.PriorityQueue;
+
+namespace Lucene.Net.Search
+{
+	
+    /// <summary>A {@link HitCollector} implementation that collects the top-scoring
+    /// documents, returning them as a {@link TopDocs}.  This is used by {@link
+    /// IndexSearcher} to implement {@link TopDocs}-based search.
+    /// 
+    /// <p>This may be extended, overriding the collect method to, e.g.,
+    /// conditionally invoke <code>super()</code> in order to filter which
+    /// documents are collected.
+    /// 
+    /// </summary>
+    public class TopDocCollector : HitCollector
+    {
+        private int numHits;
+        private float minScore = 0.0f;
+		
+        internal int totalHits;
+        internal PriorityQueue hq;
+		
+        /// <summary>Construct to collect a given number of hits.</summary>
+        /// <param name="numHits">the maximum number of hits to collect
+        /// </param>
+        public TopDocCollector(int numHits) : this(numHits, new HitQueue(numHits))
+        {
+        }
+		
+        internal TopDocCollector(int numHits, PriorityQueue hq)
+        {
+            this.numHits = numHits;
+            this.hq = hq;
+        }
+		
+        // javadoc inherited
+        public override void  Collect(int doc, float score)
+        {
+            if (score > 0.0f)
+            {
+                totalHits++;
+                if (hq.Size() < numHits || score >= minScore)
+                {
+                    hq.Insert(new ScoreDoc(doc, score));
+                    minScore = ((ScoreDoc) hq.Top()).score; // maintain minScore
+                }
+            }
+        }
+		
+        /// <summary>The total number of documents that matched this query. </summary>
+        public virtual int GetTotalHits()
+        {
+            return totalHits;
+        }
+		
+        /// <summary>The top-scoring hits. </summary>
+        public virtual TopDocs TopDocs()
+        {
+            ScoreDoc[] scoreDocs = new ScoreDoc[hq.Size()];
+            for (int i = hq.Size() - 1; i >= 0; i--)
+                // put docs in array
+                scoreDocs[i] = (ScoreDoc) hq.Pop();
+			
+            float maxScore = (totalHits == 0) ? System.Single.NegativeInfinity : scoreDocs[0].score;
+			
+            return new TopDocs(totalHits, scoreDocs, maxScore);
+        }
+    }
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/TopFieldDocCollector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/TopFieldDocCollector.cs?rev=432239&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/TopFieldDocCollector.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/TopFieldDocCollector.cs Thu Aug 17 06:49:26 2006
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ * 
+ * Licensed 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;
+using IndexReader = Lucene.Net.Index.IndexReader;
+
+namespace Lucene.Net.Search
+{
+	
+    /// <summary>A {@link HitCollector} implementation that collects the top-sorting
+    /// documents, returning them as a {@link TopFieldDocs}.  This is used by {@link
+    /// IndexSearcher} to implement {@link TopFieldDocs}-based search.
+    /// 
+    /// <p>This may be extended, overriding the collect method to, e.g.,
+    /// conditionally invoke <code>super()</code> in order to filter which
+    /// documents are collected.
+    /// 
+    /// </summary>
+    public class TopFieldDocCollector : TopDocCollector
+    {
+		
+        /// <summary>Construct to collect a given number of hits.</summary>
+        /// <param name="reader">the index to be searched
+        /// </param>
+        /// <param name="sort">the sort criteria
+        /// </param>
+        /// <param name="numHits">the maximum number of hits to collect
+        /// </param>
+        public TopFieldDocCollector(IndexReader reader, Sort sort, int numHits) : base(numHits, new FieldSortedHitQueue(reader, sort.fields, numHits))
+        {
+        }
+		
+        // javadoc inherited
+        public override void  Collect(int doc, float score)
+        {
+            if (score > 0.0f)
+            {
+                totalHits++;
+                hq.Insert(new FieldDoc(doc, score));
+            }
+        }
+		
+        // javadoc inherited
+        public override TopDocs TopDocs()
+        {
+            FieldSortedHitQueue fshq = (FieldSortedHitQueue) hq;
+            ScoreDoc[] scoreDocs = new ScoreDoc[fshq.Size()];
+            for (int i = fshq.Size() - 1; i >= 0; i--)
+                // put docs in array
+                scoreDocs[i] = fshq.FillFields((FieldDoc) fshq.Pop());
+			
+            return new TopFieldDocs(totalHits, scoreDocs, fshq.GetFields(), fshq.GetMaxScore());
+        }
+    }
+}
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/TopFieldDocs.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/TopFieldDocs.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/TopFieldDocs.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/TopFieldDocs.cs Thu Aug 17 06:49:26 2006
@@ -18,40 +18,38 @@
 
 namespace Lucene.Net.Search
 {
-	
-	
-	/// <summary> Expert: Returned by low-level sorted search implementations.
-	/// 
-	/// <p>Created: Feb 12, 2004 8:58:46 AM 
-	/// 
-	/// </summary>
-	/// <author>   Tim Jones (Nacimiento Software)
-	/// </author>
-	/// <since>   lucene 1.4
-	/// </since>
-	/// <version>  $Id: TopFieldDocs.java 354819 2005-12-07 17:48:37Z yonik $
-	/// </version>
-	/// <seealso cref="Searcher.Search(Query,Filter,int,Sort)">
-	/// </seealso>
-	[Serializable]
-	public class TopFieldDocs : TopDocs
-	{
+    /// <summary> Expert: Returned by low-level sorted search implementations.
+    /// 
+    /// <p>Created: Feb 12, 2004 8:58:46 AM 
+    /// 
+    /// </summary>
+    /// <author>   Tim Jones (Nacimiento Software)
+    /// </author>
+    /// <since>   lucene 1.4
+    /// </since>
+    /// <version>  $Id: TopFieldDocs.java 354819 2005-12-07 17:48:37Z yonik $
+    /// </version>
+    /// <seealso cref="Searcher#search(Query,Filter,int,Sort)">
+    /// </seealso>
+    [Serializable]
+    public class TopFieldDocs : TopDocs
+    {
 		
-		/// <summary>The fields which were used to sort results by. </summary>
-		public SortField[] fields;
+        /// <summary>The fields which were used to sort results by. </summary>
+        public SortField[] fields;
 		
-		/// <summary>Creates one of these objects.</summary>
-		/// <param name="totalHits"> Total number of hits for the query.
-		/// </param>
-		/// <param name="scoreDocs"> The top hits for the query.
-		/// </param>
-		/// <param name="fields">    The sort criteria used to find the top hits.
-		/// </param>
-		/// <param name="maxScore">  The maximum score encountered.
-		/// </param>
-		internal TopFieldDocs(int totalHits, ScoreDoc[] scoreDocs, SortField[] fields, float maxScore) : base(totalHits, scoreDocs, maxScore)
-		{
-			this.fields = fields;
-		}
-	}
+        /// <summary>Creates one of these objects.</summary>
+        /// <param name="totalHits"> Total number of hits for the query.
+        /// </param>
+        /// <param name="scoreDocs"> The top hits for the query.
+        /// </param>
+        /// <param name="fields">    The sort criteria used to find the top hits.
+        /// </param>
+        /// <param name="maxScore">  The maximum score encountered.
+        /// </param>
+        internal TopFieldDocs(int totalHits, ScoreDoc[] scoreDocs, SortField[] fields, float maxScore) : base(totalHits, scoreDocs, maxScore)
+        {
+            this.fields = fields;
+        }
+    }
 }

Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/_delete_.PhrasePrefixQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/_delete_.PhrasePrefixQuery.cs?rev=432239&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/_delete_.PhrasePrefixQuery.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/_delete_.PhrasePrefixQuery.cs Thu Aug 17 06:49:26 2006
@@ -0,0 +1,322 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ * 
+ * Licensed 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;
+using IndexReader = Lucene.Net.Index.IndexReader;
+using MultipleTermPositions = Lucene.Net.Index.MultipleTermPositions;
+using Term = Lucene.Net.Index.Term;
+using TermPositions = Lucene.Net.Index.TermPositions;
+using ToStringUtils = Lucene.Net.Util.ToStringUtils;
+
+namespace _delete_Lucene.Net.Search
+{
+#if DELETE_ME
+	/// <summary> PhrasePrefixQuery is a generalized version of PhraseQuery, with an added
+	/// method {@link #Add(Term[])}.
+	/// To use this class, to search for the phrase "Microsoft app*" first use
+	/// add(Term) on the term "Microsoft", then find all terms that has "app" as
+	/// prefix using IndexReader.terms(Term), and use PhrasePrefixQuery.add(Term[]
+	/// terms) to add them to the query.
+	/// 
+	/// </summary>
+	/// <deprecated> use {@link Lucene.Net.search.MultiPhraseQuery} instead
+	/// </deprecated>
+	/// <author>  Anders Nielsen
+	/// </author>
+	/// <version>  1.0
+	/// </version>
+	[Serializable]
+	public class PhrasePrefixQuery : Query
+	{
+		private System.String field;
+		private System.Collections.ArrayList termArrays = new System.Collections.ArrayList();
+		private System.Collections.ArrayList positions = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
+		
+		private int slop = 0;
+		
+		/// <summary>Sets the phrase slop for this query.</summary>
+		/// <seealso cref="PhraseQuery.SetSlop(int)">
+		/// </seealso>
+		public virtual void  SetSlop(int s)
+		{
+			slop = s;
+		}
+		
+		/// <summary>Sets the phrase slop for this query.</summary>
+		/// <seealso cref="PhraseQuery.GetSlop()">
+		/// </seealso>
+		public virtual int GetSlop()
+		{
+			return slop;
+		}
+		
+		/// <summary>Add a single term at the next position in the phrase.</summary>
+		/// <seealso cref="PhraseQuery.Add(Term)">
+		/// </seealso>
+		public virtual void  Add(Term term)
+		{
+			Add(new Term[]{term});
+		}
+		
+		/// <summary>Add multiple terms at the next position in the phrase.  Any of the terms
+		/// may match.
+		/// 
+		/// </summary>
+		/// <seealso cref="PhraseQuery.Add(Term)">
+		/// </seealso>
+		public virtual void  Add(Term[] terms)
+		{
+			int position = 0;
+			if (positions.Count > 0)
+				position = ((System.Int32) positions[positions.Count - 1]) + 1;
+			
+			Add(terms, position);
+		}
+		
+		/// <summary> Allows to specify the relative position of terms within the phrase.
+		/// 
+		/// </summary>
+		/// <seealso cref="PhraseQuery.Add(Term, int)">
+		/// </seealso>
+		/// <param name="terms">
+		/// </param>
+		/// <param name="position">
+		/// </param>
+		public virtual void  Add(Term[] terms, int position)
+		{
+			if (termArrays.Count == 0)
+				field = terms[0].Field();
+			
+			for (int i = 0; i < terms.Length; i++)
+			{
+				if (terms[i].Field() != field)
+				{
+					throw new System.ArgumentException("All phrase terms must be in the same field (" + field + "): " + terms[i]);
+				}
+			}
+			
+			termArrays.Add(terms);
+			positions.Add((System.Int32) position);
+		}
+		
+		/// <summary> Returns the relative positions of terms in this phrase.</summary>
+		public virtual int[] GetPositions()
+		{
+			int[] result = new int[positions.Count];
+			for (int i = 0; i < positions.Count; i++)
+				result[i] = ((System.Int32) positions[i]);
+			return result;
+		}
+		
+		[Serializable]
+		private class PhrasePrefixWeight : Weight
+		{
+			private void  InitBlock(PhrasePrefixQuery enclosingInstance)
+			{
+				this.enclosingInstance = enclosingInstance;
+			}
+			private PhrasePrefixQuery enclosingInstance;
+			public PhrasePrefixQuery Enclosing_Instance
+			{
+				get
+				{
+					return enclosingInstance;
+				}
+				
+			}
+			private Similarity similarity;
+			private float value_Renamed;
+			private float idf;
+			private float queryNorm;
+			private float queryWeight;
+			
+			public PhrasePrefixWeight(PhrasePrefixQuery enclosingInstance, Searcher searcher)
+			{
+				InitBlock(enclosingInstance);
+				this.similarity = Enclosing_Instance.GetSimilarity(searcher);
+				
+				// compute idf
+				System.Collections.IEnumerator i = Enclosing_Instance.termArrays.GetEnumerator();
+				while (i.MoveNext())
+				{
+					Term[] terms = (Term[]) i.Current;
+					for (int j = 0; j < terms.Length; j++)
+					{
+						idf += Enclosing_Instance.GetSimilarity(searcher).Idf(terms[j], searcher);
+					}
+				}
+			}
+			
+			public virtual Query GetQuery()
+			{
+				return Enclosing_Instance;
+			}
+			public virtual float GetValue()
+			{
+				return value_Renamed;
+			}
+			
+			public virtual float SumOfSquaredWeights()
+			{
+				queryWeight = idf * Enclosing_Instance.GetBoost(); // compute query weight
+				return queryWeight * queryWeight; // square it
+			}
+			
+			public virtual void  Normalize(float queryNorm)
+			{
+				this.queryNorm = queryNorm;
+				queryWeight *= queryNorm; // normalize query weight
+				value_Renamed = queryWeight * idf; // idf for document 
+			}
+			
+			public virtual Scorer Scorer(IndexReader reader)
+			{
+				if (Enclosing_Instance.termArrays.Count == 0)
+				// optimize zero-term case
+					return null;
+				
+				TermPositions[] tps = new TermPositions[Enclosing_Instance.termArrays.Count];
+				for (int i = 0; i < tps.Length; i++)
+				{
+					Term[] terms = (Term[]) Enclosing_Instance.termArrays[i];
+					
+					TermPositions p;
+					if (terms.Length > 1)
+						p = new MultipleTermPositions(reader, terms);
+					else
+						p = reader.TermPositions(terms[0]);
+					
+					if (p == null)
+						return null;
+					
+					tps[i] = p;
+				}
+				
+				if (Enclosing_Instance.slop == 0)
+					return new ExactPhraseScorer(this, tps, Enclosing_Instance.GetPositions(), similarity, reader.Norms(Enclosing_Instance.field));
+				else
+					return new SloppyPhraseScorer(this, tps, Enclosing_Instance.GetPositions(), similarity, Enclosing_Instance.slop, reader.Norms(Enclosing_Instance.field));
+			}
+			
+			public virtual Explanation Explain(IndexReader reader, int doc)
+			{
+				Explanation result = new Explanation();
+				result.SetDescription("weight(" + GetQuery() + " in " + doc + "), product of:");
+				
+				Explanation idfExpl = new Explanation(idf, "idf(" + GetQuery() + ")");
+				
+				// explain query weight
+				Explanation queryExpl = new Explanation();
+				queryExpl.SetDescription("queryWeight(" + GetQuery() + "), product of:");
+				
+				Explanation boostExpl = new Explanation(Enclosing_Instance.GetBoost(), "boost");
+				if (Enclosing_Instance.GetBoost() != 1.0f)
+					queryExpl.AddDetail(boostExpl);
+				
+				queryExpl.AddDetail(idfExpl);
+				
+				Explanation queryNormExpl = new Explanation(queryNorm, "queryNorm");
+				queryExpl.AddDetail(queryNormExpl);
+				
+				queryExpl.SetValue(boostExpl.GetValue() * idfExpl.GetValue() * queryNormExpl.GetValue());
+				
+				result.AddDetail(queryExpl);
+				
+				// explain field weight
+				Explanation fieldExpl = new Explanation();
+				fieldExpl.SetDescription("fieldWeight(" + GetQuery() + " in " + doc + "), product of:");
+				
+				Explanation tfExpl = Scorer(reader).Explain(doc);
+				fieldExpl.AddDetail(tfExpl);
+				fieldExpl.AddDetail(idfExpl);
+				
+				Explanation fieldNormExpl = new Explanation();
+				byte[] fieldNorms = reader.Norms(Enclosing_Instance.field);
+				float fieldNorm = fieldNorms != null?Similarity.DecodeNorm(fieldNorms[doc]):0.0f;
+				fieldNormExpl.SetValue(fieldNorm);
+				fieldNormExpl.SetDescription("fieldNorm(field=" + Enclosing_Instance.field + ", doc=" + doc + ")");
+				fieldExpl.AddDetail(fieldNormExpl);
+				
+				fieldExpl.SetValue(tfExpl.GetValue() * idfExpl.GetValue() * fieldNormExpl.GetValue());
+				
+				result.AddDetail(fieldExpl);
+				
+				// combine them
+				result.SetValue(queryExpl.GetValue() * fieldExpl.GetValue());
+				
+				if (queryExpl.GetValue() == 1.0f)
+					return fieldExpl;
+				
+				return result;
+			}
+		}
+		
+		protected internal override Weight CreateWeight(Searcher searcher)
+		{
+			if (termArrays.Count == 1)
+			{
+				// optimize one-term case
+				Term[] terms = (Term[]) termArrays[0];
+				BooleanQuery boq = new BooleanQuery(true);
+				for (int i = 0; i < terms.Length; i++)
+				{
+					boq.Add(new TermQuery(terms[i]), BooleanClause.Occur.SHOULD);
+				}
+				boq.SetBoost(GetBoost());
+				return boq.CreateWeight(searcher);
+			}
+			return new PhrasePrefixWeight(this, searcher);
+		}
+		
+		/// <summary>Prints a user-readable version of this query. </summary>
+		public override System.String ToString(System.String f)
+		{
+			System.Text.StringBuilder buffer = new System.Text.StringBuilder();
+			if (!field.Equals(f))
+			{
+				buffer.Append(field);
+				buffer.Append(":");
+			}
+			
+			buffer.Append("\"");
+			System.Collections.IEnumerator i = termArrays.GetEnumerator();
+			while (i.MoveNext())
+			{
+				Term[] terms = (Term[]) i.Current;
+				buffer.Append(terms[0].Text() + (terms.Length > 1?"*":""));
+				if (i.MoveNext())
+					buffer.Append(" ");
+			}
+			buffer.Append("\"");
+			
+			if (slop != 0)
+			{
+				buffer.Append("~");
+				buffer.Append(slop);
+			}
+			
+			buffer.Append(ToStringUtils.Boost(GetBoost()));
+			
+			return buffer.ToString();
+		}
+        // {{Aroush-1.9}} Do we need this?!
+		override public System.Object Clone()
+		{
+			return null;
+		}
+	}
+#endif
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/_delete_DateFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/_delete_DateFilter.cs?rev=432239&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/_delete_DateFilter.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/_delete_DateFilter.cs Thu Aug 17 06:49:26 2006
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ * 
+ * Licensed 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;
+using DateField = Lucene.Net.Documents.DateField;
+using IndexReader = Lucene.Net.Index.IndexReader;
+using Term = Lucene.Net.Index.Term;
+using TermDocs = Lucene.Net.Index.TermDocs;
+using TermEnum = Lucene.Net.Index.TermEnum;
+
+namespace _delete_Lucene.Net.Search
+{
+#if DELETE_ME
+	/// <summary> A Filter that restricts search results to a range of time.
+	/// 
+	/// <p>For this to work, documents must have been indexed with a
+	/// {@link DateField}.</p>
+	/// 
+	/// </summary>
+	/// <deprecated> Instead, use {@link RangeFilter} combined with 
+	/// {@link Lucene.Net.document.DateTools}.
+	/// </deprecated>
+	[Serializable]
+	public class DateFilter : Filter
+	{
+		private void  InitBlock()
+		{
+			start = DateField.MIN_DATE_STRING();
+			end = DateField.MAX_DATE_STRING();
+		}
+		internal System.String field;
+		
+		internal System.String start;
+		internal System.String end;
+		
+		private DateFilter(System.String f)
+		{
+			InitBlock();
+			field = f;
+		}
+		
+		/// <summary> Constructs a filter for field <code>f</code> matching dates
+		/// between <code>from</code> and <code>to</code> inclusively.
+		/// </summary>
+		public DateFilter(System.String f, System.DateTime from, System.DateTime to)
+		{
+			InitBlock();
+			field = f;
+			start = DateField.DateToString(from);
+			end = DateField.DateToString(to);
+		}
+		
+		/// <summary> Constructs a filter for field <code>f</code> matching times
+		/// between <code>from</code> and <code>to</code> inclusively.
+		/// </summary>
+		public DateFilter(System.String f, long from, long to)
+		{
+			InitBlock();
+			field = f;
+			start = DateField.TimeToString(from);
+			end = DateField.TimeToString(to);
+		}
+		
+		/// <summary> Constructs a filter for field <code>f</code> matching
+		/// dates on or before before <code>date</code>.
+		/// </summary>
+		public static DateFilter Before(System.String field, System.DateTime date)
+		{
+			DateFilter result = new DateFilter(field);
+			result.end = DateField.DateToString(date);
+			return result;
+		}
+		
+		/// <summary> Constructs a filter for field <code>f</code> matching times
+		/// on or before <code>time</code>.
+		/// </summary>
+		public static DateFilter Before(System.String field, long time)
+		{
+			DateFilter result = new DateFilter(field);
+			result.end = DateField.TimeToString(time);
+			return result;
+		}
+		
+		/// <summary> Constructs a filter for field <code>f</code> matching
+		/// dates on or after <code>date</code>.
+		/// </summary>
+		public static DateFilter After(System.String field, System.DateTime date)
+		{
+			DateFilter result = new DateFilter(field);
+			result.start = DateField.DateToString(date);
+			return result;
+		}
+		
+		/// <summary> Constructs a filter for field <code>f</code> matching
+		/// times on or after <code>time</code>.
+		/// </summary>
+		public static DateFilter After(System.String field, long time)
+		{
+			DateFilter result = new DateFilter(field);
+			result.start = DateField.TimeToString(time);
+			return result;
+		}
+		
+		/// <summary> Returns a BitSet with true for documents which should be
+		/// permitted in search results, and false for those that should
+		/// not.
+		/// </summary>
+		public override System.Collections.BitArray Bits(IndexReader reader)
+		{
+			System.Collections.BitArray bits = new System.Collections.BitArray((reader.MaxDoc() % 64 == 0?reader.MaxDoc() / 64:reader.MaxDoc() / 64 + 1) * 64);
+			TermEnum enumerator = reader.Terms(new Term(field, start));
+			TermDocs termDocs = reader.TermDocs();
+			if (enumerator.Term() == null)
+			{
+				return bits;
+			}
+			
+			try
+			{
+				Term stop = new Term(field, end);
+				while (enumerator.Term().CompareTo(stop) <= 0)
+				{
+					termDocs.Seek(enumerator.Term());
+					while (termDocs.Next())
+					{
+						bits.Set(termDocs.Doc(), true);
+					}
+					if (!enumerator.Next())
+					{
+						break;
+					}
+				}
+			}
+			finally
+			{
+				enumerator.Close();
+				termDocs.Close();
+			}
+			return bits;
+		}
+		
+		public override System.String ToString()
+		{
+			System.Text.StringBuilder buffer = new System.Text.StringBuilder();
+			buffer.Append(field);
+			buffer.Append(":");
+			buffer.Append(DateField.StringToDate(start).ToString("r"));
+			buffer.Append("-");
+			buffer.Append(DateField.StringToDate(end).ToString("r"));
+			return buffer.ToString();
+		}
+	}
+#endif
+}
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/BufferedIndexOutput.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/BufferedIndexOutput.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/BufferedIndexOutput.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/BufferedIndexOutput.cs Thu Aug 17 06:49:26 2006
@@ -20,7 +20,7 @@
 {
 	
 	/// <summary>Base implementation class for buffered {@link IndexOutput}. </summary>
-	public abstract class BufferedIndexOutput:IndexOutput
+	public abstract class BufferedIndexOutput : IndexOutput
 	{
 		internal const int BUFFER_SIZE = 1024;
 		

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/Directory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/Directory.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/Directory.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/Directory.cs Thu Aug 17 06:49:26 2006
@@ -59,37 +59,15 @@
 		/// <summary>Returns the length of a file in the directory. </summary>
 		public abstract long FileLength(System.String name);
 		
-		/// <deprecated> use {@link #CreateOutput(String)} 
-		/// </deprecated>
-		public virtual OutputStream createFile(System.String name)
-		{
-			return (OutputStream) CreateOutput(name);
-		}
 		
 		/// <summary>Creates a new, empty file in the directory with the given name.
 		/// Returns a stream writing this file. 
 		/// </summary>
-		public virtual IndexOutput CreateOutput(System.String name)
-		{
-			// default implementation for back compatibility
-			// this method should be abstract
-			return (IndexOutput) createFile(name);
-		}
+		public abstract IndexOutput CreateOutput(System.String name);
 		
-		/// <deprecated> use {@link #OpenInput(String)} 
-		/// </deprecated>
-		public virtual InputStream OpenFile(System.String name)
-		{
-			return (InputStream) OpenInput(name);
-		}
 		
 		/// <summary>Returns a stream reading an existing file. </summary>
-		public virtual IndexInput OpenInput(System.String name)
-		{
-			// default implementation for back compatibility
-			// this method should be abstract
-			return (IndexInput) OpenFile(name);
-		}
+		public abstract IndexInput OpenInput(System.String name);
 		
 		/// <summary>Construct a {@link Lock}.</summary>
 		/// <param name="name">the name of the lock file

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/FSDirectory.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs Thu Aug 17 06:49:26 2006
@@ -42,7 +42,18 @@
 			}
 			private System.IO.FileInfo lockFile;
 			private FSDirectory enclosingInstance;
-			public FSDirectory Enclosing_Instance
+            override public bool IsLocked()
+            {
+                if (Lucene.Net.Store.FSDirectory.disableLocks)
+                    return false;
+                bool tmpBool;
+                if (System.IO.File.Exists(lockFile.FullName))
+                    tmpBool = true;
+                else
+                    tmpBool = System.IO.Directory.Exists(lockFile.FullName);
+                return tmpBool;
+            }
+            public FSDirectory Enclosing_Instance
 			{
 				get
 				{
@@ -102,17 +113,6 @@
 					tmpBool = false;
 				bool generatedAux = tmpBool;
 			}
-			public override bool IsLocked()
-			{
-				if (Lucene.Net.Store.FSDirectory.disableLocks)
-					return false;
-				bool tmpBool;
-				if (System.IO.File.Exists(lockFile.FullName))
-					tmpBool = true;
-				else
-					tmpBool = System.IO.Directory.Exists(lockFile.FullName);
-				return tmpBool;
-			}
 			
 			public override System.String ToString()
 			{
@@ -131,19 +131,19 @@
 		
 		private static bool disableLocks = false;
 		
-		/// <summary> Set whether Lucene's use of lock files is disabled. By default, 
-		/// lock files are enabled. They should only be disabled if the index
-		/// is on a read-only medium like a CD-ROM.
-		/// </summary>
-		public static void  SetDisableLocks(bool doDisableLocks)
+        /// <summary> Set whether Lucene's use of lock files is disabled. By default, 
+        /// lock files are enabled. They should only be disabled if the index
+        /// is on a read-only medium like a CD-ROM.
+        /// </summary>
+        public static void  SetDisableLocks(bool doDisableLocks)
 		{
 			FSDirectory.disableLocks = doDisableLocks;
 		}
 		
-		/// <summary> Returns whether Lucene's use of lock files is disabled.</summary>
-		/// <returns> true if locks are disabled, false if locks are enabled.
-		/// </returns>
-		public static bool GetDisableLocks()
+        /// <summary> Returns whether Lucene's use of lock files is disabled.</summary>
+        /// <returns> true if locks are disabled, false if locks are enabled.
+        /// </returns>
+        public static bool GetDisableLocks()
 		{
 			return FSDirectory.disableLocks;
 		}
@@ -308,7 +308,9 @@
 				
                 System.String[] files = System.IO.Directory.GetFileSystemEntries(directory.FullName); // clear old files    // {{Aroush-1.9}} we want the line below, not this one; how do we make the line below work in C#?!
                 //// System.String[] files = System.IO.Directory.GetFileSystemEntries(new IndexFileNameFilter()); // clear old files 
-				for (int i = 0; i < files.Length; i++)
+                //// if (files == null)
+                ////    throw new System.IO.IOException("Cannot read directory " + directory.FullName);
+                for (int i = 0; i < files.Length; i++)
 				{
 					System.IO.FileInfo file = new System.IO.FileInfo(System.IO.Path.Combine(directory.FullName, files[i]));
 					bool tmpBool2;
@@ -503,8 +505,9 @@
 					}
 					catch (System.IO.IOException ioe)
 					{
-						throw new System.IO.IOException("Cannot rename " + old + " to " + nu);
-					}
+                        System.IO.IOException newExc = new System.IO.IOException("Cannot rename " + old + " to " + nu, ioe);
+                        throw newExc;
+                    }
 					finally
 					{
 						if (in_Renamed != null)

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/Lock.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/Lock.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/Lock.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/Lock.cs Thu Aug 17 06:49:26 2006
@@ -95,14 +95,6 @@
 			private Lock lock_Renamed;
 			private long lockWaitTimeout;
 			
-			/// <summary>Constructs an executor that will grab the named lock.
-			/// Defaults lockWaitTimeout to Lock.COMMIT_LOCK_TIMEOUT.
-			/// </summary>
-			/// <deprecated> Kept only to avoid breaking existing code.
-			/// </deprecated>
-			public With(Lock lock_Renamed) : this(lock_Renamed, IndexWriter.COMMIT_LOCK_TIMEOUT)
-			{
-			}
 			
 			/// <summary>Constructs an executor that will grab the named lock. </summary>
 			public With(Lock lock_Renamed, long lockWaitTimeout)

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/MMapDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/MMapDirectory.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/MMapDirectory.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/MMapDirectory.cs Thu Aug 17 06:49:26 2006
@@ -81,11 +81,7 @@
 			}
 		}
 		
-		/* Added class MultiMMapIndexInput, Paul Elschot.
-		* Slightly adapted constructor of MMapIndexInput.
-		* Licensed under the Apache License, Version 2.0.
-		*/
-		private class MultiMMapIndexInput:IndexInput, System.ICloneable
+		private class MultiMMapIndexInput : IndexInput, System.ICloneable
 		{
 			
 			private System.IO.FileStream[] buffers; // private ByteBuffer[] buffers;    // {{Aroush-1.9}}
@@ -199,8 +195,9 @@
 				}
 				catch (System.IO.IOException ioe)
 				{
-					throw new System.Exception(ioe.ToString()); // {{Aroush-1.9}} should be re-thrown as RuntimeException
-				}
+                    System.Exception newException = new System.Exception("", ioe);  // {{Aroush-2.0}} This should be SystemException
+                    throw newException;
+                }
 				return clone;
 			}
 			

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/RAMDirectory.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMDirectory.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMDirectory.cs Thu Aug 17 06:49:26 2006
@@ -101,11 +101,11 @@
 				// read current file
 				IndexInput is_Renamed = dir.OpenInput(files[i]);
 				// and copy to ram disk
-				int len = (int) is_Renamed.Length();
-				int readCount = 0;
+				long len = (int) is_Renamed.Length();
+				long readCount = 0;
 				while (readCount < len)
 				{
-					int toRead = readCount + BufferedIndexOutput.BUFFER_SIZE > len?len - readCount : BufferedIndexOutput.BUFFER_SIZE;
+					int toRead = readCount + BufferedIndexOutput.BUFFER_SIZE > len ? (int) (len - readCount) : BufferedIndexOutput.BUFFER_SIZE;
 					is_Renamed.ReadBytes(buf, 0, toRead);
 					os.WriteBytes(buf, toRead);
 					readCount += toRead;

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMInputStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/RAMInputStream.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMInputStream.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMInputStream.cs Thu Aug 17 06:49:26 2006
@@ -28,7 +28,7 @@
 	class RAMInputStream : BufferedIndexInput, System.ICloneable
 	{
 		private RAMFile file;
-		private int pointer = 0;
+		private long pointer = 0;
 		private long length;
 		
 		public RAMInputStream(RAMFile f)
@@ -40,11 +40,11 @@
 		public override void  ReadInternal(byte[] dest, int destOffset, int len)
 		{
 			int remainder = len;
-			int start = pointer;
+			long start = pointer;
 			while (remainder != 0)
 			{
-				int bufferNumber = start / BUFFER_SIZE;
-				int bufferOffset = start % BUFFER_SIZE;
+				int bufferNumber = (int) (start / BUFFER_SIZE);
+				int bufferOffset = (int) (start % BUFFER_SIZE);
 				int bytesInBuffer = BUFFER_SIZE - bufferOffset;
 				int bytesToCopy = bytesInBuffer >= remainder?remainder:bytesInBuffer;
 				byte[] buffer = (byte[]) file.buffers[bufferNumber];
@@ -62,7 +62,7 @@
 		
 		public override void  SeekInternal(long pos)
 		{
-			pointer = (int) pos;
+			pointer = pos;
 		}
 		
 		public override long Length()

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMOutputStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/RAMOutputStream.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMOutputStream.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMOutputStream.cs Thu Aug 17 06:49:26 2006
@@ -28,7 +28,7 @@
 	public class RAMOutputStream : BufferedIndexOutput
 	{
 		private RAMFile file;
-		private int pointer = 0;
+		private long pointer = 0;
 		
 		/// <summary>Construct an empty output buffer. </summary>
 		public RAMOutputStream() : this(new RAMFile())
@@ -83,8 +83,8 @@
             int bufferPos = 0;
             while (bufferPos != len)
             {
-                int bufferNumber = pointer / BUFFER_SIZE;
-                int bufferOffset = pointer % BUFFER_SIZE;
+                int bufferNumber = (int) (pointer / BUFFER_SIZE);
+                int bufferOffset = (int) (pointer % BUFFER_SIZE);
                 int bytesInBuffer = BUFFER_SIZE - bufferOffset;
                 int remainInSrcBuffer = len - bufferPos;
                 int bytesToCopy = bytesInBuffer >= remainInSrcBuffer ? remainInSrcBuffer : bytesInBuffer;
@@ -118,7 +118,7 @@
 		public override void  Seek(long pos)
 		{
 			base.Seek(pos);
-			pointer = (int) pos;
+			pointer = pos;
 		}
 		public override long Length()
 		{

Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/_delete_InputStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/_delete_InputStream.cs?rev=432239&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/_delete_InputStream.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/_delete_InputStream.cs Thu Aug 17 06:49:26 2006
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ * 
+ * Licensed 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 _delete_Lucene.Net.Store
+{
+#if DELETE_ME	
+	/// <deprecated> Use {@link IndexInput} or {@link BufferedIndexInput} instead.
+	/// </deprecated>
+	public abstract class InputStream : BufferedIndexInput
+	{
+		
+		protected internal long length; // set by subclasses
+		
+		public override long Length()
+		{
+			return length;
+		}
+	}
+#endif
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/_delete_OutputStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/_delete_OutputStream.cs?rev=432239&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/_delete_OutputStream.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/_delete_OutputStream.cs Thu Aug 17 06:49:26 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ * 
+ * Licensed 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 _delete_Lucene.Net.Store
+{
+#if DELETE_ME	
+	/// <deprecated> Use {@link IndexOutput} or {@link BufferedIndexOutput}
+	/// instead.
+	/// </deprecated>
+	public abstract class OutputStream : BufferedIndexOutput
+	{
+	}
+#endif
+}
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/PriorityQueue.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Util/PriorityQueue.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/PriorityQueue.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/PriorityQueue.cs Thu Aug 17 06:49:26 2006
@@ -23,11 +23,15 @@
 	/// least element can always be found in constant time.  Put()'s and pop()'s
 	/// require log(size) time. 
 	/// </summary>
-	public abstract class PriorityQueue
+    [Serializable]
+    public abstract class PriorityQueue
 	{
-		private System.Object[] heap;
-		private int size;
-		private int maxSize;
+        [NonSerialized]
+        private System.Object[] heap;
+        [NonSerialized]
+        private int size;
+        [NonSerialized]
+        private int maxSize;
 		
 		/// <summary>Determines the ordering of objects in this priority queue.  Subclasses
 		/// must define this one method. 

Modified: incubator/lucene.net/trunk/C#/src/Test/Analysis/TestAnalyzers.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Analysis/TestAnalyzers.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Analysis/TestAnalyzers.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Analysis/TestAnalyzers.cs Thu Aug 17 06:49:26 2006
@@ -24,7 +24,8 @@
     public class TestAnalyzers
 	{
 		
-		public virtual void  AssertAnalyzesTo(Analyzer a, System.String input, System.String[] output)
+		
+        public virtual void  AssertAnalyzesTo(Analyzer a, System.String input, System.String[] output)
 		{
 			TokenStream ts = a.TokenStream("dummy", new System.IO.StringReader(input));
 			for (int i = 0; i < output.Length; i++)

Modified: incubator/lucene.net/trunk/C#/src/Test/Analysis/TestStopAnalyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Analysis/TestStopAnalyzer.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Analysis/TestStopAnalyzer.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Analysis/TestStopAnalyzer.cs Thu Aug 17 06:49:26 2006
@@ -29,11 +29,13 @@
         [SetUp]
 		public virtual void  SetUp()
 		{
+            stop = new StopAnalyzer();
+            inValidTokens = new System.Collections.Hashtable();
+
 			for (int i = 0; i < StopAnalyzer.ENGLISH_STOP_WORDS.Length; i++)
 			{
-                if (inValidTokens.ContainsKey(StopAnalyzer.ENGLISH_STOP_WORDS[i]) == false)
-				    inValidTokens.Add(StopAnalyzer.ENGLISH_STOP_WORDS[i], StopAnalyzer.ENGLISH_STOP_WORDS[i]);
-			}
+                inValidTokens.Add(StopAnalyzer.ENGLISH_STOP_WORDS[i], StopAnalyzer.ENGLISH_STOP_WORDS[i]);
+            }
 		}
 		
         [Test]

Modified: incubator/lucene.net/trunk/C#/src/Test/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/AssemblyInfo.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/AssemblyInfo.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/AssemblyInfo.cs Thu Aug 17 06:49:26 2006
@@ -26,7 +26,7 @@
 // You can specify all the values or you can default the Revision and Build Numbers 
 // by using the '*' as shown below:
 
-[assembly: AssemblyVersion("1.9.1.001")]
+[assembly: AssemblyVersion("2.0.0.001")]
 
 //
 // In order to sign your assembly you must specify a key to use. Refer to the 

Modified: incubator/lucene.net/trunk/C#/src/Test/Document/TestBinaryDocument.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Document/TestBinaryDocument.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Document/TestBinaryDocument.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Document/TestBinaryDocument.cs Thu Aug 17 06:49:26 2006
@@ -31,8 +31,8 @@
 	/// </summary>
 	/// <author>  Bernhard Messer
 	/// </author>
-	/// <version>  $Id: TestBinaryDocument.java 150546 2004-09-30 12:40:28Z goller $
-	/// </version>
+    /// <version>  $Id: TestBinaryDocument.java 387550 2006-03-21 15:36:32Z yonik $
+    /// </version>
 	[TestFixture]
     public class TestBinaryDocument
 	{
@@ -67,11 +67,7 @@
 			doc.Add(stringFldStored);
 			doc.Add(stringFldCompressed);
 			
-			/** test for field count */
-            System.Collections.IEnumerator iter = doc.Fields();
-            int count = 0;
-            while (iter.MoveNext()) count++;
-            Assert.AreEqual(4, count);
+            Assert.AreEqual(4, doc.GetFieldsCount());
 			
 			/** add the doc to a ram index */
 			RAMDirectory dir = new RAMDirectory();
@@ -101,7 +97,7 @@
 			Assert.IsTrue(stringFldCompressedTest.Equals(binaryValCompressed));
 			
 			/** delete the document from index */
-			reader.Delete(0);
+			reader.DeleteDocument(0);
 			Assert.AreEqual(0, reader.NumDocs());
 			
 			reader.Close();

Modified: incubator/lucene.net/trunk/C#/src/Test/Document/TestDateTools.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Document/TestDateTools.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Document/TestDateTools.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Document/TestDateTools.cs Thu Aug 17 06:49:26 2006
@@ -192,5 +192,30 @@
 		{
             return date.ToString("yyyy-MM-dd HH:mm:ss:fff");
         }
-	}
+	
+	    [Test]
+        public virtual void  TestDateToolsUTC()
+        {
+            // Sun, 30 Oct 2005 00:00:00 +0000 -- the last second of 2005's DST in Europe/London
+            //long time = 1130630400;
+            DateTime time1 = new DateTime(2005, 10, 30);
+            DateTime time2 = time1.AddHours(1);
+            try
+            {
+                //TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); // {{Aroush-2.0}} need porting 'java.util.TimeZone.getTimeZone'
+                System.DateTime tempAux = time1;
+                System.String d1 = DateTools.DateToString(tempAux, DateTools.Resolution.MINUTE);
+                System.DateTime tempAux2 = time2;
+                System.String d2 = DateTools.DateToString(tempAux2, DateTools.Resolution.MINUTE);
+                System.Console.Out.WriteLine("d1: " + d1 + " d2: " + d2);
+                Assert.IsFalse(d1.Equals(d2), "different times");
+                Assert.AreEqual(DateTools.StringToTime(d1), time1.Ticks, "midnight");
+                Assert.AreEqual(DateTools.StringToTime(d2), time2.Ticks, "later");
+            }
+            finally
+            {
+                //TimeZone.SetDefault(null);    // {{Aroush-2.0}} need porting 'java.util.TimeZone.setDefault'
+            }
+        }
+    }
 }

Modified: incubator/lucene.net/trunk/C#/src/Test/Document/TestDocument.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Document/TestDocument.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Document/TestDocument.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Document/TestDocument.cs Thu Aug 17 06:49:26 2006
@@ -56,10 +56,7 @@
 			doc.Add(stringFld);
 			doc.Add(binaryFld);
 
-            System.Collections.IEnumerator iter = doc.Fields();
-            int count = 0;
-            while (iter.MoveNext()) count++;
-            Assert.AreEqual(2, count);
+            Assert.AreEqual(2, doc.GetFieldsCount());
 			
 			Assert.IsTrue(binaryFld.IsBinary());
 			Assert.IsTrue(binaryFld.IsStored());
@@ -74,10 +71,7 @@
 			
 			doc.Add(binaryFld2);
 			
-            iter = doc.Fields();
-            count = 0;
-            while (iter.MoveNext()) count++;
-            Assert.AreEqual(3, count);
+            Assert.AreEqual(3, doc.GetFieldsCount());
 			
 			byte[][] binaryTests = doc.GetBinaryValues("binary");
 			
@@ -92,16 +86,10 @@
 			Assert.IsTrue(binaryTest2.Equals(binaryVal2));
 			
 			doc.RemoveField("string");
-            iter = doc.Fields();
-            count = 0;
-            while (iter.MoveNext()) count++;
-            Assert.AreEqual(2, count);
+            Assert.AreEqual(2, doc.GetFieldsCount());
 			
 			doc.RemoveFields("binary");
-            iter = doc.Fields();
-            count = 0;
-            while (iter.MoveNext()) count++;
-            Assert.AreEqual(0, count);
+            Assert.AreEqual(0, doc.GetFieldsCount());
 		}
 		
 		/// <summary> Tests {@link Document#RemoveField(String)} method for a brand new Document
@@ -112,40 +100,27 @@
 		[Test]
 		public virtual void  TestRemoveForNewDocument()
 		{
-            int count;
-            System.Collections.IEnumerator iter;
-
 			Lucene.Net.Documents.Document doc = MakeDocumentWithFields();
-            iter = doc.Fields();    count = 0;  while (iter.MoveNext()) count++;
-            Assert.AreEqual(8, count);
+            Assert.AreEqual(8, doc.GetFieldsCount());
 			doc.RemoveFields("keyword");
-            iter = doc.Fields();    count = 0;  while (iter.MoveNext()) count++;
-            Assert.AreEqual(6, count);
+            Assert.AreEqual(6, doc.GetFieldsCount());
 			doc.RemoveFields("doesnotexists"); // removing non-existing fields is siltenlty ignored
 			doc.RemoveFields("keyword"); // removing a field more than once
-            iter = doc.Fields();    count = 0;  while (iter.MoveNext()) count++;
-            Assert.AreEqual(6, count);
+            Assert.AreEqual(6, doc.GetFieldsCount());
 			doc.RemoveField("text");
-            iter = doc.Fields();    count = 0;  while (iter.MoveNext()) count++;
-            Assert.AreEqual(5, count);
+            Assert.AreEqual(5, doc.GetFieldsCount());
 			doc.RemoveField("text");
-            iter = doc.Fields();    count = 0;  while (iter.MoveNext()) count++;
-            Assert.AreEqual(4, count);
+            Assert.AreEqual(4, doc.GetFieldsCount());
 			doc.RemoveField("text");
-            iter = doc.Fields();    count = 0;  while (iter.MoveNext()) count++;
-            Assert.AreEqual(4, count);
+            Assert.AreEqual(4, doc.GetFieldsCount());
 			doc.RemoveField("doesnotexists"); // removing non-existing fields is siltenlty ignored
-            iter = doc.Fields();    count = 0;  while (iter.MoveNext()) count++;
-            Assert.AreEqual(4, count);
+            Assert.AreEqual(4, doc.GetFieldsCount());
 			doc.RemoveFields("unindexed");
-            iter = doc.Fields();    count = 0;  while (iter.MoveNext()) count++;
-			Assert.AreEqual(2, count);
+			Assert.AreEqual(2, doc.GetFieldsCount());
 			doc.RemoveFields("unstored");
-            iter = doc.Fields();    count = 0;  while (iter.MoveNext()) count++;
-            Assert.AreEqual(0, count);
+            Assert.AreEqual(0, doc.GetFieldsCount());
 			doc.RemoveFields("doesnotexists"); // removing non-existing fields is siltenlty ignored
-            iter = doc.Fields();    count = 0;  while (iter.MoveNext()) count++;
-            Assert.AreEqual(0, count);
+            Assert.AreEqual(0, doc.GetFieldsCount());
 		}
 		
         [Test]

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/DocHelper.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/DocHelper.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/DocHelper.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/DocHelper.cs Thu Aug 17 06:49:26 2006
@@ -155,11 +155,10 @@
 		
 		public static int NumFields(Lucene.Net.Documents.Document doc)
 		{
-			System.Collections.IEnumerator fields = doc.Fields();
-			int result = 0;
-			while (fields.MoveNext())
+            int result = 0;
+            foreach (Field field in doc.Fields())
 			{
-				System.String name = fields.Current.ToString();
+				System.String name = field.Name();
 				name += ""; // avoid compiler warning
 				result++;
 			}

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/Store/TestRAMDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/Store/TestRAMDirectory.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/Store/TestRAMDirectory.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/Store/TestRAMDirectory.cs Thu Aug 17 06:49:26 2006
@@ -55,7 +55,7 @@
 			System.String tempDir = System.IO.Path.GetTempPath();
 			if (tempDir == null)
 				throw new System.IO.IOException("java.io.tmpdir undefined, cannot run test");
-			indexDir = new System.IO.FileInfo(tempDir + "\\" + "RAMDirIndex");
+			indexDir = new System.IO.FileInfo(System.IO.Path.Combine(tempDir, "RAMDirIndex"));
 			
 			IndexWriter writer = new IndexWriter(indexDir, new WhitespaceAnalyzer(), true);
 			// add some documents

Added: incubator/lucene.net/trunk/C#/src/Test/Index/Store/_delete_TestFSDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/Store/_delete_TestFSDirectory.cs?rev=432239&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/Store/_delete_TestFSDirectory.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/Store/_delete_TestFSDirectory.cs Thu Aug 17 06:49:26 2006
@@ -0,0 +1,229 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ * 
+ * Licensed 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;
+using NUnit.Framework;
+using StandardAnalyzer = Lucene.Net.Analysis.Standard.StandardAnalyzer;
+using IndexWriter = Lucene.Net.Index.IndexWriter;
+
+namespace _delete_Lucene.Net.Index.Store
+{
+#if DELETE_ME
+	/// <summary> Test to illustrate the problem found when trying to open an IndexWriter in
+	/// a situation where the the property <code>Lucene.Net.lockDir</code>
+	/// was not set and the one specified by <code>java.io.tmpdir</code> had been
+	/// set to a non-existent path. What I observed is that this combination of
+	/// conditions resulted in a <code>NullPointerException</code> being thrown in
+	/// the <code>create()</code> method in <code>FSDirectory</code>, where
+	/// <code>files.length</code> is de-referenced, but <code>files</code> is
+	/// </code>null</code>.
+	/// 
+	/// </summary>
+	/// <author>  Michael Goddard
+	/// </author>
+	
+    [TestFixture]
+	public class TestFSDirectory
+	{
+		
+		/// <summary> What happens if the Lucene lockDir doesn't exist?
+		/// 
+		/// </summary>
+		/// <throws>  Exception </throws>
+		[Test]
+        public virtual void  TestNonExistentTmpDir()
+		{
+            orgApacheLuceneLockDir = System.Configuration.ConfigurationSettings.AppSettings.Get("Lucene.Net.lockDir");
+			//System.Configuration.ConfigurationSettings.AppSettings.Set("Lucene.Net.lockDir", NON_EXISTENT_DIRECTORY); // {{Aroush}} how do we setup an envirement variable in C#?
+			System.String exceptionClassName = OpenIndexWriter();
+			if (exceptionClassName == null || exceptionClassName.Equals("java.io.IOException"))
+				Assert.IsTrue(true);
+			else
+				Assert.Fail("Caught an unexpected Exception");
+		}
+		
+		/// <summary> What happens if the Lucene lockDir is a regular file instead of a
+		/// directory?
+		/// 
+		/// </summary>
+		/// <throws>  Exception </throws>
+		[Test]
+        public virtual void  TestTmpDirIsPlainFile()
+		{
+			shouldBeADirectory = new System.IO.FileInfo(NON_EXISTENT_DIRECTORY);
+            shouldBeADirectory.Create().Close();
+            System.String exceptionClassName = OpenIndexWriter();
+			if (exceptionClassName == null || exceptionClassName.Equals("java.io.IOException"))
+				Assert.IsTrue(true);
+			else
+				Assert.Fail("Caught an unexpected Exception");
+		}
+		
+		public static readonly System.String FILE_SEP = System.IO.Path.DirectorySeparatorChar.ToString();
+		
+		public static readonly System.String NON_EXISTENT_DIRECTORY = System.IO.Path.GetTempPath() + FILE_SEP + "highly_improbable_directory_name";
+		
+		public static readonly System.String TEST_INDEX_DIR = System.IO.Path.GetTempPath() + FILE_SEP + "temp_index";
+		
+		private System.String orgApacheLuceneLockDir;
+		
+		private System.IO.FileInfo shouldBeADirectory;
+		
+        [TearDown]
+		public virtual void  TearDown()
+		{
+			if (orgApacheLuceneLockDir != null)
+			{
+				System.Configuration.ConfigurationSettings.AppSettings.Set("Lucene.Net.lockDir", orgApacheLuceneLockDir);
+			}
+            bool tmpBool = false;
+            if ((shouldBeADirectory != null) && 
+                System.IO.File.Exists(shouldBeADirectory.FullName) && 
+                System.IO.Directory.Exists(shouldBeADirectory.FullName))
+            {
+                tmpBool = true;
+            }
+            if (shouldBeADirectory != null && tmpBool)
+			{
+				try
+				{
+					bool tmpBool2;
+					if (System.IO.File.Exists(shouldBeADirectory.FullName))
+					{
+						System.IO.File.Delete(shouldBeADirectory.FullName);
+						tmpBool2 = true;
+					}
+					else if (System.IO.Directory.Exists(shouldBeADirectory.FullName))
+					{
+						System.IO.Directory.Delete(shouldBeADirectory.FullName);
+						tmpBool2 = true;
+					}
+					else
+						tmpBool2 = false;
+					bool generatedAux = tmpBool2;
+				}
+				catch (System.Exception e)
+				{
+                    System.Console.Error.WriteLine(e.StackTrace);
+				}
+			}
+			System.IO.FileInfo deletableIndex = new System.IO.FileInfo(TEST_INDEX_DIR);
+			bool tmpBool3;
+			if (System.IO.File.Exists(deletableIndex.FullName))
+				tmpBool3 = true;
+			else
+				tmpBool3 = System.IO.Directory.Exists(deletableIndex.FullName);
+			if (tmpBool3)
+				try
+				{
+					RmDir(deletableIndex);
+				}
+				catch (System.Exception e)
+				{
+					System.Console.Error.WriteLine(e.StackTrace);
+				}
+		}
+		
+		/// <summary> Open an IndexWriter<br>
+		/// Catch any (expected) IOException<br>
+		/// Close the IndexWriter
+		/// </summary>
+		private static System.String OpenIndexWriter()
+		{
+			IndexWriter iw = null;
+			System.String ret = null;
+			try
+			{
+				iw = new IndexWriter(TEST_INDEX_DIR, new StandardAnalyzer(), true);
+			}
+			catch (System.IO.IOException e)
+			{
+				ret = e.ToString();
+				System.Console.Error.WriteLine(e.StackTrace);
+			}
+			catch (System.NullReferenceException e)
+			{
+				ret = e.ToString();
+				System.Console.Error.WriteLine(e.StackTrace);
+			}
+			finally
+			{
+				if (iw != null)
+				{
+					try
+					{
+						iw.Close();
+					}
+					catch (System.IO.IOException ioe)
+					{
+						// ignore this
+					}
+				}
+			}
+			return ret;
+		}
+		
+		private static void  RmDir(System.IO.FileInfo dirName)
+		{
+			bool tmpBool;
+			if (System.IO.File.Exists(dirName.FullName))
+				tmpBool = true;
+			else
+				tmpBool = System.IO.Directory.Exists(dirName.FullName);
+			if (tmpBool)
+			{
+				if (System.IO.Directory.Exists(dirName.FullName))
+				{
+					System.IO.FileInfo[] contents = SupportClass.FileSupport.GetFiles(dirName);
+					for (int i = 0; i < contents.Length; i++)
+						RmDir(contents[i]);
+					bool tmpBool2;
+					if (System.IO.File.Exists(dirName.FullName))
+					{
+						System.IO.File.Delete(dirName.FullName);
+						tmpBool2 = true;
+					}
+					else if (System.IO.Directory.Exists(dirName.FullName))
+					{
+						System.IO.Directory.Delete(dirName.FullName);
+						tmpBool2 = true;
+					}
+					else
+						tmpBool2 = false;
+					bool generatedAux = tmpBool2;
+				}
+				else
+				{
+					bool tmpBool3;
+					if (System.IO.File.Exists(dirName.FullName))
+					{
+						System.IO.File.Delete(dirName.FullName);
+						tmpBool3 = true;
+					}
+					else if (System.IO.Directory.Exists(dirName.FullName))
+					{
+						System.IO.Directory.Delete(dirName.FullName);
+						tmpBool3 = true;
+					}
+					else
+						tmpBool3 = false;
+					bool generatedAux2 = tmpBool3;
+				}
+			}
+		}
+	}
+#endif
+}
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestCompoundFile.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestCompoundFile.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestCompoundFile.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestCompoundFile.cs Thu Aug 17 06:49:26 2006
@@ -58,7 +58,7 @@
 		public virtual void  SetUp()
 		{
 			//dir = new RAMDirectory();
-			dir = FSDirectory.GetDirectory(new System.IO.FileInfo(System.Configuration.ConfigurationSettings.AppSettings.Get("tempDir") + "\\" + "testIndex"), true);
+            dir = FSDirectory.GetDirectory(new System.IO.FileInfo(System.Configuration.ConfigurationSettings.AppSettings.Get("tempDir") + "\\" + "testIndex"), true);
 		}
 		
 		
@@ -638,10 +638,9 @@
 			cr.Close();
 		}
 
-        /// <summary>
-        /// This test that writes larger than the size of the buffer output
+        /// <summary>This test that writes larger than the size of the buffer output
         /// will correctly increment the file pointer.
-        /// </summary>
+        /// </summary>
         [Test]
         public virtual void  TestLargeWrites()
                                                {

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestDoc.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestDoc.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestDoc.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestDoc.cs Thu Aug 17 06:49:26 2006
@@ -191,7 +191,7 @@
 			Analyzer analyzer = new SimpleAnalyzer();
 			DocumentWriter writer = new DocumentWriter(directory, analyzer, Similarity.GetDefault(), 1000);
 			
-			System.IO.FileInfo file = new System.IO.FileInfo(workDir.FullName + "\\" + fileName);
+			System.IO.FileInfo file = new System.IO.FileInfo(System.IO.Path.Combine(workDir.FullName, fileName));
 			Lucene.Net.Documents.Document doc = FileDocument.Document(file);
 			
 			writer.AddDocument(segment, doc);

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestDocumentWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestDocumentWriter.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestDocumentWriter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestDocumentWriter.cs Thu Aug 17 06:49:26 2006
@@ -125,7 +125,7 @@
 			for (int i = 0; i < reader.FieldInfos.Size(); i++)
 			{
 				FieldInfo fi = reader.FieldInfos.FieldInfo(i);
-				if (fi.IsIndexed)
+				if (fi.IsIndexed())
 				{
 					Assert.IsTrue(fi.omitNorms == !dir.FileExists(segName + ".f" + i));
 				}

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexModifier.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestIndexModifier.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexModifier.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexModifier.cs Thu Aug 17 06:49:26 2006
@@ -55,7 +55,7 @@
 			i.Optimize();
 			Assert.AreEqual(2, i.DocCount());
 			i.Flush();
-			i.Delete(0);
+			i.DeleteDocument(0);
 			Assert.AreEqual(1, i.DocCount());
 			i.Flush();
 			Assert.AreEqual(1, i.DocCount());
@@ -63,7 +63,7 @@
 			i.AddDocument(GetDoc());
 			i.Flush();
 			Assert.AreEqual(3, i.DocCount());
-			i.Delete(allDocTerm);
+			i.DeleteDocuments(allDocTerm);
 			Assert.AreEqual(0, i.DocCount());
 			i.Optimize();
 			Assert.AreEqual(0, i.DocCount());
@@ -87,7 +87,7 @@
 			Assert.IsFalse(i.GetUseCompoundFile());
 			
 			// test setting properties when internally the reader is opened:
-			i.Delete(allDocTerm);
+			i.DeleteDocuments(allDocTerm);
 			i.SetMaxBufferedDocs(100);
 			i.SetMergeFactor(25);
 			i.SetMaxFieldLength(250000);
@@ -151,7 +151,7 @@
 			System.String tempDir = System.IO.Path.GetTempPath();
 			if (tempDir == null)
 				throw new System.IO.IOException("java.io.tmpdir undefined, cannot run test");
-			System.IO.FileInfo indexDir = new System.IO.FileInfo(tempDir + "\\" + "lucenetestindex");
+			System.IO.FileInfo indexDir = new System.IO.FileInfo(System.IO.Path.Combine(tempDir, "lucenetestindex"));
 			Directory rd = FSDirectory.GetDirectory(indexDir, create);
 			IndexThread.id = 0;
 			IndexThread.idStack.Clear();
@@ -314,7 +314,7 @@
 							continue;
 						}
 						Term delTerm = new Term("id", System.Int32.Parse(delId).ToString());
-						int delCount = index.Delete(delTerm);
+						int delCount = index.DeleteDocuments(delTerm);
 						if (delCount != 1)
 						{
 							throw new System.SystemException("Internal error: " + threadNumber + " deleted " + delCount + " documents, term=" + delTerm);

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestIndexReader.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexReader.cs Thu Aug 17 06:49:26 2006
@@ -215,7 +215,7 @@
 			// DELETE DOCUMENTS CONTAINING TERM: aaa
 			int deleted = 0;
 			reader = IndexReader.Open(dir);
-			deleted = reader.Delete(searchTerm);
+			deleted = reader.DeleteDocuments(searchTerm);
 			Assert.AreEqual(100, deleted, "deleted count");
 			Assert.AreEqual(100, reader.DocFreq(searchTerm), "deleted docFreq");
 			AssertTermDocsCount("deleted termDocs", reader, searchTerm, 0);
@@ -292,7 +292,7 @@
 			int deleted = 0;
 			try
 			{
-				deleted = reader.Delete(searchTerm);
+                deleted = reader.DeleteDocuments(searchTerm);
 				Assert.Fail("Delete allowed on an index reader with stale segment information");
 			}
 			catch (System.IO.IOException e)
@@ -309,7 +309,7 @@
 			AssertTermDocsCount("first reader", reader, searchTerm, 100);
 			AssertTermDocsCount("first reader", reader, searchTerm2, 100);
 			
-			deleted = reader.Delete(searchTerm);
+			deleted = reader.DeleteDocuments(searchTerm);
 			Assert.AreEqual(100, deleted, "deleted count");
 			Assert.AreEqual(100, reader.DocFreq(searchTerm), "deleted docFreq");
 			Assert.AreEqual(100, reader.DocFreq(searchTerm2), "deleted docFreq");
@@ -395,7 +395,7 @@
 			IndexReader reader = IndexReader.Open(dir);
 			try
 			{
-				reader.Delete(0);
+				reader.DeleteDocument(0);
 				Assert.Fail("expected lock");
 			}
 			catch (System.IO.IOException e)
@@ -403,7 +403,7 @@
 				// expected exception
 			}
 			IndexReader.Unlock(dir); // this should not be done in the real world! 
-			reader.Delete(0);
+			reader.DeleteDocument(0);
 			reader.Close();
 			writer.Close();
 		}
@@ -417,8 +417,8 @@
 			AddDocumentWithFields(writer);
 			writer.Close();
 			IndexReader reader = IndexReader.Open(dir);
-			reader.Delete(0);
-			reader.Delete(1);
+			reader.DeleteDocument(0);
+			reader.DeleteDocument(1);
 			reader.UndeleteAll();
 			reader.Close();
 			reader = IndexReader.Open(dir);
@@ -482,7 +482,7 @@
 			// delete documents containing term: aaa
 			// when the reader is closed, the segment info is updated and
 			// the first reader is now stale
-			reader2.Delete(searchTerm1);
+			reader2.DeleteDocuments(searchTerm1);
 			Assert.AreEqual(100, reader2.DocFreq(searchTerm1), "after delete 1");
 			Assert.AreEqual(100, reader2.DocFreq(searchTerm2), "after delete 1");
 			Assert.AreEqual(100, reader2.DocFreq(searchTerm3), "after delete 1");
@@ -504,7 +504,7 @@
 			// delete documents containing term: bbb
 			try
 			{
-				reader1.Delete(searchTerm2);
+				reader1.DeleteDocuments(searchTerm2);
 				Assert.Fail("Delete allowed from a stale index reader");
 			}
 			catch (System.IO.IOException e)
@@ -522,7 +522,7 @@
 			AssertTermDocsCount("reopened", reader1, searchTerm2, 100);
 			AssertTermDocsCount("reopened", reader1, searchTerm3, 100);
 			
-			reader1.Delete(searchTerm2);
+			reader1.DeleteDocuments(searchTerm2);
 			Assert.AreEqual(100, reader1.DocFreq(searchTerm1), "deleted 2");
 			Assert.AreEqual(100, reader1.DocFreq(searchTerm2), "deleted 2");
 			Assert.AreEqual(100, reader1.DocFreq(searchTerm3), "deleted 2");

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestIndexWriter.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriter.cs Thu Aug 17 06:49:26 2006
@@ -28,8 +28,8 @@
 	
 	/// <author>  goller
 	/// </author>
-	/// <version>  $Id: TestIndexWriter.java 208807 2005-07-01 22:13:53Z dnaber $
-	/// </version>
+    /// <version>  $Id: TestIndexWriter.java 387550 2006-03-21 15:36:32Z yonik $
+    /// </version>
 	[TestFixture]
     public class TestIndexWriter
 	{
@@ -56,7 +56,7 @@
 			reader = IndexReader.Open(dir);
 			for (i = 0; i < 40; i++)
 			{
-				reader.Delete(i);
+				reader.DeleteDocument(i);
 			}
 			reader.Close();
 			

Added: incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriterMerging.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestIndexWriterMerging.cs?rev=432239&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriterMerging.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriterMerging.cs Thu Aug 17 06:49:26 2006
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ * 
+ * Licensed 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;
+using StandardAnalyzer = Lucene.Net.Analysis.Standard.StandardAnalyzer;
+using Document = Lucene.Net.Documents.Document;
+using Field = Lucene.Net.Documents.Field;
+using Directory = Lucene.Net.Store.Directory;
+using RAMDirectory = Lucene.Net.Store.RAMDirectory;
+using NUnit.Framework;
+
+namespace Lucene.Net.Index
+{
+	
+	
+    [TestFixture]
+    public class TestIndexWriterMerging
+    {
+		
+        /// <summary> Tests that index merging (specifically addIndexes()) doesn't
+        /// change the index order of documents.
+        /// </summary>
+        [Test]
+        public virtual void  TestLucene()
+        {
+			
+            int num = 100;
+			
+            Directory indexA = new RAMDirectory();
+            Directory indexB = new RAMDirectory();
+			
+            FillIndex(indexA, 0, num);
+            bool fail = VerifyIndex(indexA, 0);
+            if (fail)
+            {
+                Assert.Fail("Index a is invalid");
+            }
+			
+            FillIndex(indexB, num, num);
+            fail = VerifyIndex(indexB, num);
+            if (fail)
+            {
+                Assert.Fail("Index b is invalid");
+            }
+			
+            Directory merged = new RAMDirectory();
+			
+            IndexWriter writer = new IndexWriter(merged, new StandardAnalyzer(), true);
+            writer.SetMergeFactor(2);
+			
+            writer.AddIndexes(new Directory[]{indexA, indexB});
+            writer.Close();
+            merged.Close();
+			
+            fail = VerifyIndex(merged, 0);
+			
+            Assert.IsFalse(fail, "The merged index is invalid");
+        }
+		
+        private bool VerifyIndex(Directory directory, int startAt)
+        {
+            bool fail = false;
+            IndexReader reader = IndexReader.Open(directory);
+			
+            int max = reader.MaxDoc();
+            for (int i = 0; i < max; i++)
+            {
+                Lucene.Net.Documents.Document temp = reader.Document(i);
+                //System.out.println("doc "+i+"="+temp.getField("count").stringValue());
+                //compare the index doc number to the value that it should be
+                if (!temp.GetField("count").StringValue().Equals((i + startAt) + ""))
+                {
+                    fail = true;
+                    System.Console.Out.WriteLine("Document " + (i + startAt) + " is returning document " + temp.GetField("count").StringValue());
+                }
+            }
+            return fail;
+        }
+		
+        private void  FillIndex(Directory dir, int start, int numDocs)
+        {
+			
+            IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(), true);
+            writer.SetMergeFactor(2);
+            writer.SetMaxBufferedDocs(2);
+			
+            for (int i = start; i < (start + numDocs); i++)
+            {
+                Lucene.Net.Documents.Document temp = new Lucene.Net.Documents.Document();
+                temp.Add(new Field("count", ("" + i), Field.Store.YES, Field.Index.UN_TOKENIZED));
+				
+                writer.AddDocument(temp);
+            }
+            writer.Close();
+        }
+    }
+}
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestMultiReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestMultiReader.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestMultiReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestMultiReader.cs Thu Aug 17 06:49:26 2006
@@ -95,7 +95,7 @@
 			MultiReader reader = new MultiReader(dir, sis, false, readers);
 			Assert.IsTrue(reader != null);
 			Assert.AreEqual(2, reader.NumDocs());
-			reader.Delete(0);
+			reader.DeleteDocument(0);
 			Assert.AreEqual(1, reader.NumDocs());
 			reader.UndeleteAll();
 			Assert.AreEqual(2, reader.NumDocs());

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestSegmentReader.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentReader.cs Thu Aug 17 06:49:26 2006
@@ -77,10 +77,8 @@
 			//There are 2 unstored fields on the document that are not preserved across writing
 			Assert.IsTrue(DocHelper.NumFields(result) == DocHelper.NumFields(testDoc) - DocHelper.unstored.Count);
 			
-			System.Collections.IEnumerator fields = result.Fields();
-			while (fields.MoveNext())
+            foreach (Field field in result.Fields())
 			{
-				Field field = (Field) fields.Current;
 				Assert.IsTrue(field != null);
 				Assert.IsTrue(DocHelper.nameValues.Contains(field.Name()));
 			}
@@ -95,7 +93,7 @@
 			SegmentReader deleteReader = SegmentReader.Get(new SegmentInfo("seg-to-delete", 1, dir));
 			Assert.IsTrue(deleteReader != null);
 			Assert.IsTrue(deleteReader.NumDocs() == 1);
-			deleteReader.Delete(0);
+			deleteReader.DeleteDocument(0);
 			Assert.IsTrue(deleteReader.IsDeleted(0) == true);
 			Assert.IsTrue(deleteReader.HasDeletions() == true);
 			Assert.IsTrue(deleteReader.NumDocs() == 0);

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentTermDocs.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestSegmentTermDocs.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentTermDocs.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentTermDocs.cs Thu Aug 17 06:49:26 2006
@@ -75,7 +75,6 @@
 				int docId = segTermDocs.Doc();
 				Assert.IsTrue(docId == 0);
 				int freq = segTermDocs.Freq();
-                System.Console.Out.WriteLine("freq: " + freq);
 				Assert.IsTrue(freq == 3);
 			}
 			reader.Close();

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestTermVectorsReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestTermVectorsReader.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestTermVectorsReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestTermVectorsReader.cs Thu Aug 17 06:49:26 2006
@@ -104,7 +104,7 @@
 		{
 			//Check to see the files were created properly in setup
 			Assert.IsTrue(writer.IsDocumentOpen() == false);
-			Assert.IsTrue(dir.FileExists(seg + TermVectorsWriter.TvdExtension));
+			Assert.IsTrue(dir.FileExists(seg + TermVectorsWriter.TvxExtension));
 			Assert.IsTrue(dir.FileExists(seg + TermVectorsWriter.TvxExtension));
 		}
 		

Modified: incubator/lucene.net/trunk/C#/src/Test/IndexTest.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/IndexTest.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/IndexTest.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/IndexTest.cs Thu Aug 17 06:49:26 2006
@@ -73,7 +73,7 @@
 			{
 				System.String[] files = System.IO.Directory.GetFileSystemEntries(file.FullName);
 				for (int i = 0; i < files.Length; i++)
-					IndexDocs(writer, new System.IO.FileInfo(file.FullName + "\\" + files[i]));
+					IndexDocs(writer, new System.IO.FileInfo(System.IO.Path.Combine(file.FullName, files[i])));
 			}
 			else
 			{

Modified: incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestMultiAnalyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/QueryParser/TestMultiAnalyzer.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestMultiAnalyzer.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestMultiAnalyzer.cs Thu Aug 17 06:49:26 2006
@@ -80,12 +80,35 @@
 			// phrase with non-default boost:
 			Assert.AreEqual("\"(multi multi2) foo\"^2.0", qp.Parse("\"multi foo\"^2").ToString());
 			
-			// non-default operator:
+            // phrase after changing default slop
+            qp.SetPhraseSlop(99);
+            Assert.AreEqual("\"(multi multi2) foo\"~99 bar", qp.Parse("\"multi foo\" bar").ToString());
+            Assert.AreEqual("\"(multi multi2) foo\"~99 \"foo bar\"~2", qp.Parse("\"multi foo\" \"foo bar\"~2").ToString());
+            qp.SetPhraseSlop(0);
+			
+            // non-default operator:
 			qp.SetDefaultOperator(Lucene.Net.QueryParsers.QueryParser.AND_OPERATOR);
 			Assert.AreEqual("+(multi multi2) +foo", qp.Parse("multi foo").ToString());
 		}
 		
-		[Test]
+        [Test]
+        public virtual void  testMultiAnalyzerWithSubclassOfQueryParser()
+        {
+			
+            DumbQueryParser qp = new DumbQueryParser("", new MultiAnalyzer(this));
+            qp.SetPhraseSlop(99); // modified default slop
+			
+            // direct call to (super's) getFieldQuery to demonstrate differnce
+            // between phrase and multiphrase with modified default slop
+            Assert.AreEqual("\"foo bar\"~99", qp.GetSuperFieldQuery("", "foo bar").ToString());
+            Assert.AreEqual("\"(multi multi2) bar\"~99", qp.GetSuperFieldQuery("", "multi bar").ToString());
+			
+			
+            // ask sublcass to parse phrase with modified default slop
+            Assert.AreEqual("\"(multi multi2) foo\"~99 bar", qp.Parse("\"multi foo\" bar").ToString());
+        }
+		
+        [Test]
         public virtual void  TestPosIncrementAnalyzer()
 		{
 			Lucene.Net.QueryParsers.QueryParser qp = new Lucene.Net.QueryParsers.QueryParser("", new PosIncrementAnalyzer(this));
@@ -264,5 +287,47 @@
 				return null;
 			}
 		}
-	}
+		
+        /// <summary>a very simple subclass of QueryParser </summary>
+        public class DumbQueryParser : Lucene.Net.QueryParsers.QueryParser
+        {
+			
+            public DumbQueryParser(System.String f, Analyzer a):base(f, a)
+            {
+            }
+			
+            /// <summary>expose super's version </summary>
+            public Lucene.Net.Search.Query GetSuperFieldQuery(System.String f, System.String t)
+            {
+                return base.GetFieldQuery(f, t);
+            }
+            /// <summary>wrap super's version </summary>
+            protected internal virtual Lucene.Net.Search.Query GetFieldQuery(System.String f, System.String t)
+            {
+                return new DumbQueryWrapper(GetSuperFieldQuery(f, t));
+            }
+        }
+		
+        /// <summary> A very simple wrapper to prevent instanceof checks but uses
+        /// the toString of the query it wraps.
+        /// </summary>
+        [Serializable]
+        private sealed class DumbQueryWrapper : Lucene.Net.Search.Query
+        {
+			
+            private Lucene.Net.Search.Query q;
+            public DumbQueryWrapper(Lucene.Net.Search.Query q):base()
+            {
+                this.q = q;
+            }
+            public override System.String ToString(System.String f)
+            {
+                return q.ToString(f);
+            }
+            override public System.Object Clone()
+            {
+                return null;
+            }
+        }
+    }
 }