lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccurr...@apache.org
Subject [Lucene.Net] svn commit: r1199962 [8/14] - in /incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk: src/core/ src/core/Analysis/ src/core/Analysis/Standard/ src/core/Document/ src/core/Index/ src/core/QueryParser/ src/core/Search/ src/core/Search/Function/ src/cor...
Date Wed, 09 Nov 2011 21:03:52 GMT
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SegmentReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SegmentReader.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SegmentReader.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SegmentReader.cs Wed Nov  9 21:03:47 2011
@@ -16,7 +16,7 @@
  */
 
 using System;
-
+using Lucene.Net.Util;
 using Document = Lucene.Net.Documents.Document;
 using FieldSelector = Lucene.Net.Documents.FieldSelector;
 using BufferedIndexInput = Lucene.Net.Store.BufferedIndexInput;
@@ -24,7 +24,6 @@ using Directory = Lucene.Net.Store.Direc
 using IndexInput = Lucene.Net.Store.IndexInput;
 using IndexOutput = Lucene.Net.Store.IndexOutput;
 using BitVector = Lucene.Net.Util.BitVector;
-using CloseableThreadLocal = Lucene.Net.Util.CloseableThreadLocal;
 using DefaultSimilarity = Lucene.Net.Search.DefaultSimilarity;
 
 namespace Lucene.Net.Index
@@ -35,7 +34,7 @@ namespace Lucene.Net.Index
 	/// <summary> <p/><b>NOTE:</b> This API is new and still experimental
 	/// (subject to change suddenly in the next release)<p/>
 	/// </summary>
-	public class SegmentReader:IndexReader, System.ICloneable
+	public class SegmentReader : IndexReader, System.ICloneable
 	{
 		public SegmentReader()
 		{
@@ -50,8 +49,8 @@ namespace Lucene.Net.Index
 		private SegmentInfo si;
 		private int readBufferSize;
 		
-		internal CloseableThreadLocal fieldsReaderLocal;
-		internal CloseableThreadLocal termVectorsLocal = new CloseableThreadLocal();
+		internal CloseableThreadLocal<FieldsReader> fieldsReaderLocal;
+        internal CloseableThreadLocal<TermVectorsReader> termVectorsLocal = new CloseableThreadLocal<TermVectorsReader>();
 		
 		internal BitVector deletedDocs = null;
 		internal Ref deletedDocsRef = null;
@@ -391,7 +390,7 @@ namespace Lucene.Net.Index
 		}
 		
 		/// <summary> Sets the initial value </summary>
-		private class FieldsReaderLocal:CloseableThreadLocal
+		private class FieldsReaderLocal : CloseableThreadLocal<FieldsReader>
 		{
 			public FieldsReaderLocal(SegmentReader enclosingInstance)
 			{
@@ -410,9 +409,9 @@ namespace Lucene.Net.Index
 				}
 				
 			}
-			public /*protected internal*/ override System.Object InitialValue()
+			public /*protected internal*/ override FieldsReader InitialValue()
 			{
-				return Enclosing_Instance.core.GetFieldsReaderOrig().Clone();
+				return (FieldsReader) Enclosing_Instance.core.GetFieldsReaderOrig().Clone();
 			}
 		}
 		
@@ -768,24 +767,7 @@ namespace Lucene.Net.Index
 			}
 		}
 		
-		internal System.Collections.IDictionary norms = new System.Collections.Hashtable();
-		
-		/// <summary>The class which implements SegmentReader. </summary>
-		// @deprecated (LUCENE-1677)
-		private static System.Type IMPL;
-		
-		// @deprecated (LUCENE-1677)
-		private static System.Type READONLY_IMPL;
-		
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-		/// <deprecated>
-		/// </deprecated>
-        [Obsolete]
-		public static SegmentReader Get(SegmentInfo si)
-		{
-			return Get(false, si.dir, si, BufferedIndexInput.BUFFER_SIZE, true, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR);
-		}
+		internal System.Collections.Generic.IDictionary<string, Norm> norms = new SupportClass.HashMap<string, Norm>();
 		
 		/// <throws>  CorruptIndexException if the index is corrupt </throws>
 		/// <throws>  IOException if there is a low-level IO error </throws>
@@ -796,30 +778,9 @@ namespace Lucene.Net.Index
 		
 		/// <throws>  CorruptIndexException if the index is corrupt </throws>
 		/// <throws>  IOException if there is a low-level IO error </throws>
-		/// <deprecated>
-		/// </deprecated>
-        [Obsolete]
-		internal static SegmentReader Get(SegmentInfo si, int readBufferSize, bool doOpenStores, int termInfosIndexDivisor)
-		{
-			return Get(false, si.dir, si, readBufferSize, doOpenStores, termInfosIndexDivisor);
-		}
-		
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
 		public static SegmentReader Get(bool readOnly, Directory dir, SegmentInfo si, int readBufferSize, bool doOpenStores, int termInfosIndexDivisor)
 		{
-			SegmentReader instance;
-			try
-			{
-				if (readOnly)
-					instance = (SegmentReader) System.Activator.CreateInstance(READONLY_IMPL);
-				else
-					instance = (SegmentReader) System.Activator.CreateInstance(IMPL);
-			}
-			catch (System.Exception e)
-			{
-				throw new System.SystemException("cannot load SegmentReader class: " + e, e);
-			}
+			SegmentReader instance = readOnly ? new ReadOnlySegmentReader() : new SegmentReader();
 			instance.readOnly = readOnly;
 			instance.si = si;
 			instance.readBufferSize = readBufferSize;
@@ -962,18 +923,7 @@ namespace Lucene.Net.Index
 				System.Diagnostics.Debug.Assert(!doClone ||(normsUpToDate && deletionsUpToDate));
 				
 				// clone reader
-				SegmentReader clone;
-				try
-				{
-					if (openReadOnly)
-						clone = (SegmentReader) System.Activator.CreateInstance(READONLY_IMPL);
-					else
-						clone = (SegmentReader) System.Activator.CreateInstance(IMPL);
-				}
-				catch (System.Exception e)
-				{
-					throw new System.SystemException("cannot load SegmentReader class: " + e, e);
-				}
+				SegmentReader clone = openReadOnly ? new ReadOnlySegmentReader() : new SegmentReader();
 				
 				bool success = false;
 				try
@@ -1019,8 +969,7 @@ namespace Lucene.Net.Index
 						}
 					}
 					
-					clone.SetDisableFakeNorms(GetDisableFakeNorms());
-					clone.norms = new System.Collections.Hashtable();
+					clone.norms = new SupportClass.HashMap<string, Norm>();
 					
 					// Clone norms
 					for (int i = 0; i < fieldNormsChanged.Length; i++)
@@ -1030,9 +979,9 @@ namespace Lucene.Net.Index
 						if (doClone || !fieldNormsChanged[i])
 						{
 							System.String curField = core.fieldInfos.FieldInfo(i).name;
-							Norm norm = (Norm) this.norms[curField];
+							Norm norm = this.norms[curField];
 							if (norm != null)
-								clone.norms[curField] = norm.Clone();
+								clone.norms[curField] = (Norm)norm.Clone();
 						}
 					}
 					
@@ -1055,14 +1004,6 @@ namespace Lucene.Net.Index
 				return clone;
 			}
 		}
-		
-		/// <deprecated>  
-		/// </deprecated>
-        [Obsolete]
-		protected internal override void  DoCommit()
-		{
-			DoCommit(null);
-		}
 
         protected internal override void DoCommit(System.Collections.Generic.IDictionary<string, string> commitUserData)
         {
@@ -1129,17 +1070,14 @@ namespace Lucene.Net.Index
             if (normsDirty)
             {               // re-write norms
                 si.SetNumFields(core.fieldInfos.Size());
-                System.Collections.IEnumerator it = norms.Values.GetEnumerator();
-                while (it.MoveNext())
+                foreach (Norm norm in norms.Values)
                 {
-                    Norm norm = (Norm)it.Current;
                     if (norm.dirty)
                     {
                         norm.ReWrite(si);
                     }
                 }
             }
-
             deletedDocsDirty = false;
             normsDirty = false;
             hasChanges = false;
@@ -1147,7 +1085,7 @@ namespace Lucene.Net.Index
         
 		internal virtual FieldsReader GetFieldsReader()
 		{
-			return (FieldsReader) fieldsReaderLocal.Get();
+			return fieldsReaderLocal.Get();
 		}
 		
 		protected internal override void  DoClose()
@@ -1162,10 +1100,9 @@ namespace Lucene.Net.Index
 				deletedDocs = null;
 			}
 			
-			System.Collections.IEnumerator it = norms.Values.GetEnumerator();
-			while (it.MoveNext())
+			foreach(Norm norm in norms.Values)
 			{
-				((Norm) it.Current).DecRef();
+				norm.DecRef();
 			}
 			if (core != null)
 			{
@@ -1328,56 +1265,56 @@ namespace Lucene.Net.Index
 		{
 			EnsureOpen();
 
-            System.Collections.Generic.IDictionary<string, string> fieldSet = new System.Collections.Generic.Dictionary<string, string>();
+            System.Collections.Generic.ISet<string> fieldSet = new System.Collections.Generic.HashSet<string>();
 			for (int i = 0; i < core.fieldInfos.Size(); i++)
 			{
 				FieldInfo fi = core.fieldInfos.FieldInfo(i);
 				if (fieldOption == IndexReader.FieldOption.ALL)
 				{
-					fieldSet[fi.name] = fi.name;
+					fieldSet.Add(fi.name);
 				}
 				else if (!fi.isIndexed && fieldOption == IndexReader.FieldOption.UNINDEXED)
-				{
-					fieldSet[fi.name] = fi.name;
+                {
+                    fieldSet.Add(fi.name);
 				}
 				else if (fi.omitTermFreqAndPositions && fieldOption == IndexReader.FieldOption.OMIT_TERM_FREQ_AND_POSITIONS)
-				{
-					fieldSet[fi.name] = fi.name;
+                {
+                    fieldSet.Add(fi.name);
 				}
 				else if (fi.storePayloads && fieldOption == IndexReader.FieldOption.STORES_PAYLOADS)
-				{
-					fieldSet[fi.name] = fi.name;
+                {
+                    fieldSet.Add(fi.name);
 				}
 				else if (fi.isIndexed && fieldOption == IndexReader.FieldOption.INDEXED)
-				{
-					fieldSet[fi.name] = fi.name;
+                {
+                    fieldSet.Add(fi.name);
 				}
 				else if (fi.isIndexed && fi.storeTermVector == false && fieldOption == IndexReader.FieldOption.INDEXED_NO_TERMVECTOR)
-				{
-					fieldSet[fi.name] = fi.name;
+                {
+                    fieldSet.Add(fi.name);
 				}
 				else if (fi.storeTermVector == true && fi.storePositionWithTermVector == false && fi.storeOffsetWithTermVector == false && fieldOption == IndexReader.FieldOption.TERMVECTOR)
-				{
-					fieldSet[fi.name] = fi.name;
+                {
+                    fieldSet.Add(fi.name);
 				}
 				else if (fi.isIndexed && fi.storeTermVector && fieldOption == IndexReader.FieldOption.INDEXED_WITH_TERMVECTOR)
-				{
-					fieldSet[fi.name] = fi.name;
+                {
+                    fieldSet.Add(fi.name);
 				}
 				else if (fi.storePositionWithTermVector && fi.storeOffsetWithTermVector == false && fieldOption == IndexReader.FieldOption.TERMVECTOR_WITH_POSITION)
-				{
-					fieldSet[fi.name] = fi.name;
+                {
+                    fieldSet.Add(fi.name);
 				}
 				else if (fi.storeOffsetWithTermVector && fi.storePositionWithTermVector == false && fieldOption == IndexReader.FieldOption.TERMVECTOR_WITH_OFFSET)
-				{
-					fieldSet[fi.name] = fi.name;
-				}
-				else if ((fi.storeOffsetWithTermVector && fi.storePositionWithTermVector) && fieldOption == IndexReader.FieldOption.TERMVECTOR_WITH_POSITION_OFFSET)
-				{
-					fieldSet[fi.name] = fi.name;
+                {
+                    fieldSet.Add(fi.name);
 				}
+                else if ((fi.storeOffsetWithTermVector && fi.storePositionWithTermVector) && fieldOption == IndexReader.FieldOption.TERMVECTOR_WITH_POSITION_OFFSET)
+                {
+                    fieldSet.Add(fi.name);
+                }
 			}
-			return fieldSet.Keys;
+			return fieldSet;
 		}
 		
 		
@@ -1386,36 +1323,16 @@ namespace Lucene.Net.Index
 			lock (this)
 			{
 				EnsureOpen();
-				return norms.Contains(field);
+				return norms.ContainsKey(field);
 			}
 		}
 		
-		internal static byte[] CreateFakeNorms(int size)
-		{
-			byte[] ones = new byte[size];
-			byte val = (byte) DefaultSimilarity.EncodeNorm(1.0f);
-            for (int i = 0; i < ones.Length; i++)
-            {
-                ones[i] = val;
-            }
-			return ones;
-		}
-		
-		private byte[] ones;
-		private byte[] FakeNorms()
-		{
-			System.Diagnostics.Debug.Assert(!GetDisableFakeNorms());
-			if (ones == null)
-				ones = CreateFakeNorms(MaxDoc());
-			return ones;
-		}
-		
 		// can return null if norms aren't stored
 		protected internal virtual byte[] GetNorms(System.String field)
 		{
 			lock (this)
 			{
-				Norm norm = (Norm) norms[field];
+				Norm norm = norms[field];
 				if (norm == null)
 					return null; // not indexed, or norms not stored
 				return norm.Bytes();
@@ -1429,15 +1346,13 @@ namespace Lucene.Net.Index
 			{
 				EnsureOpen();
 				byte[] bytes = GetNorms(field);
-				if (bytes == null && !GetDisableFakeNorms())
-					bytes = FakeNorms();
 				return bytes;
 			}
 		}
 		
 		protected internal override void  DoSetNorm(int doc, System.String field, byte value_Renamed)
 		{
-			Norm norm = (Norm) norms[field];
+			Norm norm = norms[field];
 			if (norm == null)
 			// not an indexed field
 				return ;
@@ -1447,13 +1362,13 @@ namespace Lucene.Net.Index
 		}
 		
 		/// <summary>Read norms into a pre-allocated array. </summary>
-		public override void  Norms(System.String field, byte[] bytes, int offset)
+		public override void Norms(System.String field, byte[] bytes, int offset)
 		{
 			lock (this)
 			{
 				
 				EnsureOpen();
-				Norm norm = (Norm) norms[field];
+				Norm norm = norms[field];
 				if (norm == null)
 				{
                     for (int i = offset; i < bytes.Length; i++)
@@ -1475,7 +1390,7 @@ namespace Lucene.Net.Index
 			for (int i = 0; i < core.fieldInfos.Size(); i++)
 			{
 				FieldInfo fi = core.fieldInfos.FieldInfo(i);
-				if (norms.Contains(fi.name))
+				if (norms.ContainsKey(fi.name))
 				{
 					// in case this SegmentReader is being re-opened, we might be able to
 					// reuse some norm instances and skip loading them here
@@ -1546,10 +1461,8 @@ namespace Lucene.Net.Index
 			{
 				return false;
 			}
-			System.Collections.IEnumerator it = norms.Values.GetEnumerator();
-			while (it.MoveNext())
+			foreach(Norm norm in norms.Values)
 			{
-				Norm norm = (Norm) it.Current;
 				if (norm.refCount > 0)
 				{
 					return false;
@@ -1561,8 +1474,7 @@ namespace Lucene.Net.Index
 		// for testing only
 		public /*internal*/ virtual bool NormsClosed(System.String field)
 		{
-			Norm norm = (Norm) norms[field];
-			return norm.refCount == 0;
+			return norms[field].refCount == 0;
 		}
 		
 		/// <summary> Create a clone from the initial TermVectorsReader and store it in the ThreadLocal.</summary>
@@ -1570,7 +1482,7 @@ namespace Lucene.Net.Index
 		/// </returns>
 		internal virtual TermVectorsReader GetTermVectorsReader()
 		{
-			TermVectorsReader tvReader = (TermVectorsReader) termVectorsLocal.Get();
+			TermVectorsReader tvReader = termVectorsLocal.Get();
 			if (tvReader == null)
 			{
 				TermVectorsReader orig = core.GetTermVectorsReaderOrig();
@@ -1626,15 +1538,13 @@ namespace Lucene.Net.Index
 			EnsureOpen();
 			FieldInfo fi = core.fieldInfos.FieldInfo(field);
 			if (fi == null || !fi.storeTermVector)
-				return ;
+				return;
 			
 			TermVectorsReader termVectorsReader = GetTermVectorsReader();
 			if (termVectorsReader == null)
 			{
-				return ;
+				return;
 			}
-			
-			
 			termVectorsReader.Get(docNumber, field, mapper);
 		}
 		
@@ -1692,10 +1602,8 @@ namespace Lucene.Net.Index
 			rollbackDeletedDocsDirty = deletedDocsDirty;
 			rollbackNormsDirty = normsDirty;
 			rollbackPendingDeleteCount = pendingDeleteCount;
-			System.Collections.IEnumerator it = norms.Values.GetEnumerator();
-			while (it.MoveNext())
-			{
-				Norm norm = (Norm) it.Current;
+			foreach(Norm norm in norms.Values)
+            {
 				norm.rollbackDirty = norm.dirty;
 			}
 		}
@@ -1707,10 +1615,8 @@ namespace Lucene.Net.Index
 			deletedDocsDirty = rollbackDeletedDocsDirty;
 			normsDirty = rollbackNormsDirty;
 			pendingDeleteCount = rollbackPendingDeleteCount;
-			System.Collections.IEnumerator it = norms.Values.GetEnumerator();
-			while (it.MoveNext())
-			{
-				Norm norm = (Norm) it.Current;
+			foreach(Norm norm in norms.Values)
+            {
 				norm.dirty = norm.rollbackDirty;
 			}
 		}
@@ -1727,7 +1633,6 @@ namespace Lucene.Net.Index
 		// This is necessary so that cloned SegmentReaders (which
 		// share the underlying postings data) will map to the
 		// same entry in the FieldCache.  See LUCENE-1579.
-        [Obsolete("Lucene.Net-2.9.1. This method overrides obsolete member Lucene.Net.Index.IndexReader.GetFieldCacheKey()")]
 		public override System.Object GetFieldCacheKey()
 		{
 			return core.freqStream;
@@ -1747,10 +1652,12 @@ namespace Lucene.Net.Index
 		/// <summary> Lotsa tests did hacks like:<br/>
 		/// SegmentReader reader = (SegmentReader) IndexReader.open(dir);<br/>
 		/// They broke. This method serves as a hack to keep hacks working
+		/// We do it with R/W access for the tests (BW compatibility)
 		/// </summary>
+		[Obsolete("Remove this when tests are fixed!")]
 		public /*internal*/ static SegmentReader GetOnlySegmentReader(Directory dir)
 		{
-			return GetOnlySegmentReader(IndexReader.Open(dir));
+			return GetOnlySegmentReader(IndexReader.Open(dir,false));
 		}
 		
 		public /*internal*/ static SegmentReader GetOnlySegmentReader(IndexReader reader)
@@ -1776,55 +1683,8 @@ namespace Lucene.Net.Index
 		{
 			return core.termsIndexDivisor;
 		}
-		static SegmentReader()
-		{
-			{
-				try
-				{
-					System.String name = SupportClass.AppSettings.Get("Lucene.Net.SegmentReader.class", typeof(SegmentReader).FullName);
-					IMPL = System.Type.GetType(name);
-				}
-				catch (System.Security.SecurityException se)
-				{
-					try
-					{
-						IMPL = System.Type.GetType(typeof(SegmentReader).FullName);
-					}
-					catch (System.Exception e)
-					{
-						throw new System.SystemException("cannot load default SegmentReader class: " + e, e);
-					}
-				}
-				catch (System.Exception e)
-				{
-					throw new System.SystemException("cannot load SegmentReader class: " + e, e);
-				}
-			}
-			{
-				try
-				{
-					System.String name = SupportClass.AppSettings.Get("Lucene.Net.ReadOnlySegmentReader.class", typeof(ReadOnlySegmentReader).FullName);
-					READONLY_IMPL = System.Type.GetType(name);
-				}
-				catch (System.Security.SecurityException se)
-				{
-					try
-					{
-						READONLY_IMPL = System.Type.GetType(typeof(ReadOnlySegmentReader).FullName);
-					}
-					catch (System.Exception e)
-					{
-						throw new System.SystemException("cannot load default ReadOnlySegmentReader class: " + e, e);
-					}
-				}
-				catch (System.Exception e)
-				{
-					throw new System.SystemException("cannot load ReadOnlySegmentReader class: " + e, e);
-				}
-			}
-		}
-
-        public System.Collections.IDictionary norms_ForNUnit
+		
+        public System.Collections.Generic.IDictionary<string, Norm> norms_ForNUnit
         {
             get { return norms; }
         }

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SegmentWriteState.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SegmentWriteState.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SegmentWriteState.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SegmentWriteState.cs Wed Nov  9 21:03:47 2011
@@ -31,7 +31,7 @@ namespace Lucene.Net.Index
 		internal int numDocs;
 		internal int termIndexInterval;
 		internal int numDocsInStore;
-		internal System.Collections.Hashtable flushedFiles;
+		internal System.Collections.Generic.ICollection<string> flushedFiles;
 		
 		public SegmentWriteState(DocumentsWriter docWriter, Directory directory, System.String segmentName, System.String docStoreSegmentName, int numDocs, int numDocsInStore, int termIndexInterval)
 		{
@@ -42,7 +42,7 @@ namespace Lucene.Net.Index
 			this.numDocs = numDocs;
 			this.numDocsInStore = numDocsInStore;
 			this.termIndexInterval = termIndexInterval;
-            flushedFiles = new System.Collections.Hashtable();
+            flushedFiles = new System.Collections.Generic.HashSet<string>();
 		}
 		
 		public virtual System.String SegmentFileName(System.String ext)

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/StoredFieldsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/StoredFieldsWriter.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/StoredFieldsWriter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/StoredFieldsWriter.cs Wed Nov  9 21:03:47 2011
@@ -106,8 +106,8 @@ namespace Lucene.Net.Index
 					fieldsWriter = null;
 					lastDocID = 0;
 					System.Diagnostics.Debug.Assert(state.docStoreSegmentName != null);
-                    SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, state.docStoreSegmentName + "." + IndexFileNames.FIELDS_EXTENSION);
-                    SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, state.docStoreSegmentName + "." + IndexFileNames.FIELDS_INDEX_EXTENSION);
+                    state.flushedFiles.Add(state.docStoreSegmentName + "." + IndexFileNames.FIELDS_EXTENSION);
+                    state.flushedFiles.Add(state.docStoreSegmentName + "." + IndexFileNames.FIELDS_INDEX_EXTENSION);
 					
 					state.docWriter.RemoveOpenFile(state.docStoreSegmentName + "." + IndexFileNames.FIELDS_EXTENSION);
 					state.docWriter.RemoveOpenFile(state.docStoreSegmentName + "." + IndexFileNames.FIELDS_INDEX_EXTENSION);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/TermInfosReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/TermInfosReader.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/TermInfosReader.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/TermInfosReader.cs Wed Nov  9 21:03:47 2011
@@ -16,10 +16,9 @@
  */
 
 using System;
-
+using Lucene.Net.Util;
+using Lucene.Net.Util.Cache;
 using Directory = Lucene.Net.Store.Directory;
-using CloseableThreadLocal = Lucene.Net.Util.CloseableThreadLocal;
-using SimpleLRUCache = Lucene.Net.Util.Cache.SimpleLRUCache;
 
 namespace Lucene.Net.Index
 {
@@ -35,7 +34,7 @@ namespace Lucene.Net.Index
 		private System.String segment;
 		private FieldInfos fieldInfos;
 		
-		private CloseableThreadLocal threadResources = new CloseableThreadLocal();
+		private CloseableThreadLocal<ThreadResources> threadResources = new CloseableThreadLocal<ThreadResources>();
 		private SegmentTermEnum origEnum;
 		private long size;
 		
@@ -53,7 +52,7 @@ namespace Lucene.Net.Index
 			internal SegmentTermEnum termEnum;
 			
 			// Used for caching the least recently looked-up Terms
-			internal Lucene.Net.Util.Cache.Cache termInfoCache;
+			internal Lucene.Net.Util.Cache.Cache<Term, TermInfo> termInfoCache;
 		}
 		
 		internal TermInfosReader(Directory dir, System.String seg, FieldInfos fis, int readBufferSize, int indexDivisor)
@@ -154,13 +153,13 @@ namespace Lucene.Net.Index
 		
 		private ThreadResources GetThreadResources()
 		{
-			ThreadResources resources = (ThreadResources) threadResources.Get();
+			ThreadResources resources = threadResources.Get();
 			if (resources == null)
 			{
 				resources = new ThreadResources();
 				resources.termEnum = Terms();
 				// Cache does not have to be thread-safe, it is only used by one thread at the same time
-				resources.termInfoCache = new SimpleLRUCache(DEFAULT_CACHE_SIZE);
+				resources.termInfoCache = new SimpleLRUCache<Term,TermInfo>(DEFAULT_CACHE_SIZE);
 				threadResources.Set(resources);
 			}
 			return resources;
@@ -208,13 +207,13 @@ namespace Lucene.Net.Index
 			
 			TermInfo ti;
 			ThreadResources resources = GetThreadResources();
-			Lucene.Net.Util.Cache.Cache cache = null;
+			Lucene.Net.Util.Cache.Cache<Term, TermInfo> cache = null;
 			
 			if (useCache)
 			{
 				cache = resources.termInfoCache;
 				// check the cache first if the term was recently looked up
-				ti = (TermInfo) cache.Get(term);
+				ti = cache.Get(term);
 				if (ti != null)
 				{
 					return ti;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/TermVectorsTermsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/TermVectorsTermsWriter.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/TermVectorsTermsWriter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/TermVectorsTermsWriter.cs Wed Nov  9 21:03:47 2011
@@ -118,9 +118,9 @@ namespace Lucene.Net.Index
 					if (4 + ((long) state.numDocsInStore) * 16 != state.directory.FileLength(fileName))
 						throw new System.SystemException("after flush: tvx size mismatch: " + state.numDocsInStore + " docs vs " + state.directory.FileLength(fileName) + " length in bytes of " + fileName + " file exists?=" + state.directory.FileExists(fileName));
 					
-					SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, state.docStoreSegmentName + "." + IndexFileNames.VECTORS_INDEX_EXTENSION);
-                    SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, state.docStoreSegmentName + "." + IndexFileNames.VECTORS_FIELDS_EXTENSION);
-					SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, state.docStoreSegmentName + "." + IndexFileNames.VECTORS_DOCUMENTS_EXTENSION);
+					state.flushedFiles.Add(state.docStoreSegmentName + "." + IndexFileNames.VECTORS_INDEX_EXTENSION);
+                    state.flushedFiles.Add(state.docStoreSegmentName + "." + IndexFileNames.VECTORS_FIELDS_EXTENSION);
+					state.flushedFiles.Add(state.docStoreSegmentName + "." + IndexFileNames.VECTORS_DOCUMENTS_EXTENSION);
 					
 					docWriter.RemoveOpenFile(state.docStoreSegmentName + "." + IndexFileNames.VECTORS_INDEX_EXTENSION);
 					docWriter.RemoveOpenFile(state.docStoreSegmentName + "." + IndexFileNames.VECTORS_FIELDS_EXTENSION);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj Wed Nov  9 21:03:47 2011
@@ -19,7 +19,6 @@
  under the License.
 
 -->
-
 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
   <PropertyGroup>
     <ProjectType>Local</ProjectType>
@@ -116,13 +115,6 @@
       <Name>System</Name>
     </Reference>
     <Reference Include="System.configuration" />
-    <Reference Include="System.Data">
-      <Name>System.Data</Name>
-    </Reference>
-    <Reference Include="System.Runtime.Remoting">
-      <Name>System.Runtime.Remoting</Name>
-    </Reference>
-    <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml">
       <Name>System.XML</Name>
     </Reference>
@@ -352,9 +344,6 @@
     <Compile Include="Index\IndexFileNames.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Index\IndexModifier.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Index\IndexReader.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -586,9 +575,6 @@
     <Compile Include="Search\FieldDocSortedHitQueue.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Search\FieldSortedHitQueue.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Search\FieldValueHitQueue.cs" />
     <Compile Include="Search\Filter.cs">
       <SubType>Code</SubType>
@@ -731,6 +717,7 @@
     <Compile Include="Search\SimilarityDelegator.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Search\SingleTermEnum.cs" />
     <Compile Include="Search\SloppyPhraseScorer.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -793,19 +780,12 @@
     <Compile Include="Search\TermScorer.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Search\TimeLimitedCollector.cs" />
     <Compile Include="Search\TimeLimitingCollector.cs" />
-    <Compile Include="Search\TopDocCollector.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Search\TopDocs.cs">
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Search\TopDocsCollector.cs" />
     <Compile Include="Search\TopFieldCollector.cs" />
-    <Compile Include="Search\TopFieldDocCollector.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Search\TopFieldDocs.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -819,23 +799,33 @@
     <Compile Include="Search\WildcardTermEnum.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Store\AlreadyClosedException.cs" />
+    <Compile Include="Store\AlreadyClosedException.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="Store\BufferedIndexInput.cs">
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Store\BufferedIndexOutput.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Store\CheckSumIndexInput.cs" />
-    <Compile Include="Store\CheckSumIndexOutput.cs" />
+    <Compile Include="Store\CheckSumIndexInput.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Store\CheckSumIndexOutput.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="Store\Directory.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Store\FileSwitchDirectory.cs" />
+    <Compile Include="Store\FileSwitchDirectory.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="Store\FSDirectory.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Store\FSLockFactory.cs" />
+    <Compile Include="Store\FSLockFactory.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="Store\IndexInput.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -848,21 +838,33 @@
     <Compile Include="Store\LockFactory.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Store\LockObtainFailedException.cs" />
-    <Compile Include="Store\LockReleaseFailedException.cs" />
-    <Compile Include="Store\LockStressTest.cs" />
-    <Compile Include="Store\LockVerifyServer.cs" />
+    <Compile Include="Store\LockObtainFailedException.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Store\LockReleaseFailedException.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Store\LockStressTest.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Store\LockVerifyServer.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="Store\MMapDirectory.cs">
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Store\NativeFSLockFactory.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Store\NIOFSDirectory.cs" />
+    <Compile Include="Store\NIOFSDirectory.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="Store\NoLockFactory.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Store\NoSuchDirectoryException.cs" />
+    <Compile Include="Store\NoSuchDirectoryException.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="Store\RAMDirectory.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -875,14 +877,18 @@
     <Compile Include="Store\RAMOutputStream.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Store\SimpleFSDirectory.cs" />
+    <Compile Include="Store\SimpleFSDirectory.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="Store\SimpleFSLockFactory.cs">
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Store\SingleInstanceLockFactory.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Store\VerifyingLockFactory.cs" />
+    <Compile Include="Store\VerifyingLockFactory.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="SupportClass.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -944,6 +950,7 @@
     <None Include="QueryParser\QueryParser.jj" />
     <Content Include="Analysis\Package.html" />
     <Content Include="Analysis\Standard\Package.html" />
+    <Content Include="ChangeNotes.txt" />
     <Content Include="Document\Package.html" />
     <Content Include="Index\Package.html" />
     <Content Include="Messages\Package.html" />

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/MultiFieldQueryParser.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/MultiFieldQueryParser.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/MultiFieldQueryParser.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/MultiFieldQueryParser.cs Wed Nov  9 21:03:47 2011
@@ -16,7 +16,7 @@
  */
 
 using System;
-
+using System.Collections.Generic;
 using Analyzer = Lucene.Net.Analysis.Analyzer;
 using BooleanClause = Lucene.Net.Search.BooleanClause;
 using BooleanQuery = Lucene.Net.Search.BooleanQuery;
@@ -31,12 +31,12 @@ namespace Lucene.Net.QueryParsers
 	/// <summary> A QueryParser which constructs queries to search multiple fields.
 	/// 
 	/// </summary>
-	/// <version>  $Revision: 829134 $
+	/// <version>  $Revision: 829231 $
 	/// </version>
 	public class MultiFieldQueryParser:QueryParser
 	{
-		protected internal System.String[] fields;
-		protected internal System.Collections.IDictionary boosts;
+		protected internal string[] fields;
+		protected internal IDictionary<string, float> boosts;
 		
 		/// <summary> Creates a MultiFieldQueryParser. Allows passing of a map with term to
 		/// Boost, and the boost to apply to each term.
@@ -71,92 +71,13 @@ namespace Lucene.Net.QueryParsers
 		/// In other words, all the query's terms must appear, but it doesn't matter
 		/// in what fields they appear.
 		/// <p/>
-		/// 
 		/// </summary>
-		/// <deprecated> Please use
-		/// <see cref="MultiFieldQueryParser(Version, String[], Analyzer, System.Collections.IDictionary)" />
-		/// instead
-		/// </deprecated>
-        [Obsolete("Please use MultiFieldQueryParser(Version, String[], Analyzer, IDictionary) instead")]
-		public MultiFieldQueryParser(System.String[] fields, Analyzer analyzer, System.Collections.IDictionary boosts):this(Version.LUCENE_24, fields, analyzer)
+		public MultiFieldQueryParser(Version matchVersion, string[] fields, Analyzer analyzer, IDictionary<string,float> boosts)
+            : this(matchVersion, fields, analyzer)
 		{
 			this.boosts = boosts;
 		}
 		
-		/// <summary> Creates a MultiFieldQueryParser. Allows passing of a map with term to
-		/// Boost, and the boost to apply to each term.
-		/// 
-		/// <p/>
-		/// It will, when parse(String query) is called, construct a query like this
-		/// (assuming the query consists of two terms and you specify the two fields
-		/// <c>title</c> and <c>body</c>):
-		/// <p/>
-		/// 
-		/// <code>
-		/// (title:term1 body:term1) (title:term2 body:term2)
-		/// </code>
-		/// 
-		/// <p/>
-		/// When setDefaultOperator(AND_OPERATOR) is set, the result will be:
-		/// <p/>
-		/// 
-		/// <code>
-		/// +(title:term1 body:term1) +(title:term2 body:term2)
-		/// </code>
-		/// 
-		/// <p/>
-		/// When you pass a boost (title=>5 body=>10) you can get
-		/// <p/>
-		/// 
-		/// <code>
-		/// +(title:term1^5.0 body:term1^10.0) +(title:term2^5.0 body:term2^10.0)
-		/// </code>
-		/// 
-		/// <p/>
-		/// In other words, all the query's terms must appear, but it doesn't matter
-		/// in what fields they appear.
-		/// <p/>
-		/// </summary>
-		public MultiFieldQueryParser(Version matchVersion, System.String[] fields, Analyzer analyzer, System.Collections.IDictionary boosts):this(matchVersion, fields, analyzer)
-		{
-			this.boosts = boosts;
-		}
-		
-		/// <summary> Creates a MultiFieldQueryParser.
-		/// 
-		/// <p/>
-		/// It will, when parse(String query) is called, construct a query like this
-		/// (assuming the query consists of two terms and you specify the two fields
-		/// <c>title</c> and <c>body</c>):
-		/// <p/>
-		/// 
-		/// <code>
-		/// (title:term1 body:term1) (title:term2 body:term2)
-		/// </code>
-		/// 
-		/// <p/>
-		/// When setDefaultOperator(AND_OPERATOR) is set, the result will be:
-		/// <p/>
-		/// 
-		/// <code>
-		/// +(title:term1 body:term1) +(title:term2 body:term2)
-		/// </code>
-		/// 
-		/// <p/>
-		/// In other words, all the query's terms must appear, but it doesn't matter
-		/// in what fields they appear.
-		/// <p/>
-		/// 
-		/// </summary>
-		/// <deprecated> Please use
-		/// <see cref="MultiFieldQueryParser(Version, String[], Analyzer)" />
-		/// instead
-		/// </deprecated>
-        [Obsolete("Please use MultiFieldQueryParser(Version, String[], Analyzer) instead")]
-		public MultiFieldQueryParser(System.String[] fields, Analyzer analyzer):this(Version.LUCENE_24, fields, analyzer)
-		{
-		}
-		
 		/// <summary> Creates a MultiFieldQueryParser.
 		/// 
 		/// <p/>
@@ -187,11 +108,11 @@ namespace Lucene.Net.QueryParsers
 			this.fields = fields;
 		}
 		
-		protected internal override Query GetFieldQuery(System.String field, System.String queryText, int slop)
+		protected internal override Query GetFieldQuery(string field, string queryText, int slop)
 		{
 			if (field == null)
 			{
-				System.Collections.IList clauses = new System.Collections.ArrayList();
+				IList<BooleanClause> clauses = new List<BooleanClause>();
 				for (int i = 0; i < fields.Length; i++)
 				{
 					Query q = base.GetFieldQuery(fields[i], queryText);
@@ -201,11 +122,8 @@ namespace Lucene.Net.QueryParsers
 						if (boosts != null)
 						{
 							//Get the boost from the map and apply them
-                            if (boosts.Contains(fields[i]))
-							{
-								System.Single boost = (System.Single) boosts[fields[i]];
-								q.SetBoost((float) boost);
-							}
+							Single boost = boosts[fields[i]];
+							q.SetBoost(boost);
 						}
 						ApplySlop(q, slop);
 						clauses.Add(new BooleanClause(q, BooleanClause.Occur.SHOULD));
@@ -244,7 +162,7 @@ namespace Lucene.Net.QueryParsers
 		{
 			if (field == null)
 			{
-				System.Collections.IList clauses = new System.Collections.ArrayList();
+                IList<BooleanClause> clauses = new List<BooleanClause>();
 				for (int i = 0; i < fields.Length; i++)
 				{
 					clauses.Add(new BooleanClause(GetFuzzyQuery(fields[i], termStr, minSimilarity), BooleanClause.Occur.SHOULD));
@@ -258,7 +176,7 @@ namespace Lucene.Net.QueryParsers
 		{
 			if (field == null)
 			{
-				System.Collections.IList clauses = new System.Collections.ArrayList();
+                IList<BooleanClause> clauses = new List<BooleanClause>();
 				for (int i = 0; i < fields.Length; i++)
 				{
 					clauses.Add(new BooleanClause(GetPrefixQuery(fields[i], termStr), BooleanClause.Occur.SHOULD));
@@ -272,7 +190,7 @@ namespace Lucene.Net.QueryParsers
 		{
 			if (field == null)
 			{
-				System.Collections.IList clauses = new System.Collections.ArrayList();
+                IList<BooleanClause> clauses = new List<BooleanClause>();
 				for (int i = 0; i < fields.Length; i++)
 				{
 					clauses.Add(new BooleanClause(GetWildcardQuery(fields[i], termStr), BooleanClause.Occur.SHOULD));
@@ -287,7 +205,7 @@ namespace Lucene.Net.QueryParsers
 		{
 			if (field == null)
 			{
-				System.Collections.IList clauses = new System.Collections.ArrayList();
+                IList<BooleanClause> clauses = new List<BooleanClause>();
 				for (int i = 0; i < fields.Length; i++)
 				{
 					clauses.Add(new BooleanClause(GetRangeQuery(fields[i], part1, part2, inclusive), BooleanClause.Occur.SHOULD));
@@ -301,37 +219,6 @@ namespace Lucene.Net.QueryParsers
 		/// <p/>
 		/// If x fields are specified, this effectively constructs:
 		/// 
-        /// <code>
-		/// (field1:query1) (field2:query2) (field3:query3)...(fieldx:queryx)
-        /// </code>
-		/// 
-		/// </summary>
-		/// <param name="queries">Queries strings to parse
-		/// </param>
-		/// <param name="fields">Fields to search on
-		/// </param>
-		/// <param name="analyzer">Analyzer to use
-		/// </param>
-		/// <throws>  ParseException </throws>
-		/// <summary>             if query parsing fails
-		/// </summary>
-		/// <throws>  IllegalArgumentException </throws>
-		/// <summary>             if the length of the queries array differs from the length of
-		/// the fields array
-		/// </summary>
-		/// <deprecated> Use <see cref="Parse(Version,String[],String[],Analyzer)" />
-		/// instead
-		/// </deprecated>
-        [Obsolete("Use Parse(Version,String[],String[],Analyzer) instead")]
-		public static Query Parse(System.String[] queries, System.String[] fields, Analyzer analyzer)
-		{
-			return Parse(Version.LUCENE_24, queries, fields, analyzer);
-		}
-		
-		/// <summary> Parses a query which searches on the fields specified.
-		/// <p/>
-		/// If x fields are specified, this effectively constructs:
-		/// 
 		/// <code>
 		/// (field1:query1) (field2:query2) (field3:query3)...(fieldx:queryx)
         /// </code>
@@ -370,47 +257,6 @@ namespace Lucene.Net.QueryParsers
 			return bQuery;
 		}
 		
-		/// <summary> Parses a query, searching on the fields specified.
-		/// Use this if you need to specify certain fields as required,
-		/// and others as prohibited.
-		/// <p/>
-		/// Usage:
-		/// <code>
-		/// String[] fields = {"filename", "contents", "description"};
-		/// BooleanClause.Occur[] flags = {BooleanClause.Occur.SHOULD,
-		/// BooleanClause.Occur.MUST,
-		/// BooleanClause.Occur.MUST_NOT};
-		/// MultiFieldQueryParser.parse("query", fields, flags, analyzer);
-		/// </code>
-		/// <p/>
-		/// The code above would construct a query:
-		/// <code>
-		/// (filename:query) +(contents:query) -(description:query)
-		/// </code>
-		/// 
-		/// </summary>
-		/// <param name="query">Query string to parse
-		/// </param>
-		/// <param name="fields">Fields to search on
-		/// </param>
-		/// <param name="flags">Flags describing the fields
-		/// </param>
-		/// <param name="analyzer">Analyzer to use
-		/// </param>
-		/// <throws>  ParseException if query parsing fails </throws>
-		/// <throws>  IllegalArgumentException if the length of the fields array differs </throws>
-		/// <summary>  from the length of the flags array
-		/// </summary>
-		/// <deprecated> Use
-		/// <see cref="Parse(Version, String, String[], BooleanClause.Occur[], Analyzer)" />
-		/// instead
-		/// </deprecated>
-        [Obsolete("Use Parse(Version, String, String[], BooleanClause.Occur[], Analyzer) instead")]
-		public static Query Parse(System.String query, System.String[] fields, BooleanClause.Occur[] flags, Analyzer analyzer)
-		{
-			return Parse(Version.LUCENE_24, query, fields, flags, analyzer);
-		}
-		
 		/// <summary> Parses a query, searching on the fields specified. Use this if you need
 		/// to specify certain fields as required, and others as prohibited.
 		/// <p/>
@@ -465,48 +311,6 @@ namespace Lucene.Net.QueryParsers
 			return bQuery;
 		}
 		
-		/// <summary> Parses a query, searching on the fields specified.
-		/// Use this if you need to specify certain fields as required,
-		/// and others as prohibited.
-		/// <p/>
-		/// Usage:
-		/// <code>
-		/// String[] query = {"query1", "query2", "query3"};
-		/// String[] fields = {"filename", "contents", "description"};
-		/// BooleanClause.Occur[] flags = {BooleanClause.Occur.SHOULD,
-		/// BooleanClause.Occur.MUST,
-		/// BooleanClause.Occur.MUST_NOT};
-		/// MultiFieldQueryParser.parse(query, fields, flags, analyzer);
-		/// </code>
-		/// <p/>
-		/// The code above would construct a query:
-		/// <code>
-		/// (filename:query1) +(contents:query2) -(description:query3)
-		/// </code>
-		/// 
-		/// </summary>
-		/// <param name="queries">Queries string to parse
-		/// </param>
-		/// <param name="fields">Fields to search on
-		/// </param>
-		/// <param name="flags">Flags describing the fields
-		/// </param>
-		/// <param name="analyzer">Analyzer to use
-		/// </param>
-		/// <throws>  ParseException if query parsing fails </throws>
-		/// <throws>  IllegalArgumentException if the length of the queries, fields, </throws>
-		/// <summary>  and flags array differ
-		/// </summary>
-		/// <deprecated> Used
-		/// <see cref="Parse(Version, String[], String[], BooleanClause.Occur[], Analyzer)" />
-		/// instead
-		/// </deprecated>
-        [Obsolete("Use Parse(Version, String[], String[], BooleanClause.Occur[], Analyzer) instead")]
-		public static Query Parse(System.String[] queries, System.String[] fields, BooleanClause.Occur[] flags, Analyzer analyzer)
-		{
-			return Parse(Version.LUCENE_24, queries, fields, flags, analyzer);
-		}
-		
 		/// <summary> Parses a query, searching on the fields specified. Use this if you need
 		/// to specify certain fields as required, and others as prohibited.
 		/// <p/>

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/QueryParser.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/QueryParser.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/QueryParser.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/QueryParser.cs Wed Nov  9 21:03:47 2011
@@ -18,7 +18,9 @@
 /* Generated By:JavaCC: Do not edit this line. QueryParser.java */
 
 using System;
-
+using System.Collections.Generic;
+using System.Linq;
+using Lucene.Net.Util;
 using Analyzer = Lucene.Net.Analysis.Analyzer;
 using CachingTokenFilter = Lucene.Net.Analysis.CachingTokenFilter;
 using TokenStream = Lucene.Net.Analysis.TokenStream;
@@ -27,7 +29,6 @@ using TermAttribute = Lucene.Net.Analysi
 using DateField = Lucene.Net.Documents.DateField;
 using DateTools = Lucene.Net.Documents.DateTools;
 using Term = Lucene.Net.Index.Term;
-using Parameter = Lucene.Net.Util.Parameter;
 using BooleanClause = Lucene.Net.Search.BooleanClause;
 using BooleanQuery = Lucene.Net.Search.BooleanQuery;
 using FuzzyQuery = Lucene.Net.Search.FuzzyQuery;
@@ -163,7 +164,7 @@ namespace Lucene.Net.QueryParsers
 		// the default date resolution
 		internal DateTools.Resolution dateResolution = null;
 		// maps field names to date resolutions
-		internal System.Collections.IDictionary fieldToDateResolution = null;
+		internal IDictionary<string, DateTools.Resolution> fieldToDateResolution = null;
 		
 		// The collator to use when determining range inclusion,
 		// for use when constructing RangeQuerys.
@@ -172,28 +173,7 @@ namespace Lucene.Net.QueryParsers
 		/// <summary>The default operator for parsing queries. 
 		/// Use <see cref="QueryParser.SetDefaultOperator" /> to change it.
 		/// </summary>
-		[Serializable]
-		public sealed class Operator:Parameter
-		{
-			internal Operator(System.String name):base(name)
-			{
-			}
-			public static readonly Operator OR = new Operator("OR");
-			public static readonly Operator AND = new Operator("AND");
-		}
-		
-		
-		/// <summary>Constructs a query parser.</summary>
-		/// <param name="f"> the default field for query terms.
-		/// </param>
-		/// <param name="a">  used to find terms in the query text.
-		/// </param>
-		/// <deprecated> Use <see cref="QueryParser(Version, String, Analyzer)" /> instead
-		/// </deprecated>
-        [Obsolete("Use QueryParser(Version, String, Analyzer) instead")]
-		public QueryParser(System.String f, Analyzer a):this(Version.LUCENE_24, f, a)
-		{
-		}
+        public enum Operator { OR, AND }
 		
 		/// <summary> Constructs a query parser.
 		/// 
@@ -387,38 +367,7 @@ namespace Lucene.Net.QueryParsers
 		{
 			return lowercaseExpandedTerms;
 		}
-		
-		/// <deprecated> Please use <see cref="SetMultiTermRewriteMethod" /> instead.
-		/// </deprecated>
-        [Obsolete("Please use SetMultiTermRewriteMethod instead.")]
-		public virtual void  SetUseOldRangeQuery(bool useOldRangeQuery)
-		{
-			if (useOldRangeQuery)
-			{
-				SetMultiTermRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
-			}
-			else
-			{
-				SetMultiTermRewriteMethod(MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT);
-			}
-		}
-		
-		
-		/// <deprecated> Please use <see cref="GetMultiTermRewriteMethod" /> instead.
-		/// </deprecated>
-        [Obsolete("Please use GetMultiTermRewriteMethod} instead.")]
-		public virtual bool GetUseOldRangeQuery()
-		{
-			if (GetMultiTermRewriteMethod() == MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE)
-			{
-				return true;
-			}
-			else
-			{
-				return false;
-			}
-		}
-		
+
 		/// <summary> By default QueryParser uses <see cref="MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT" />
 		/// when creating a PrefixQuery, WildcardQuery or RangeQuery. This implementation is generally preferable because it 
 		/// a) Runs faster b) Does not have the scarcity of terms unduly influence score 
@@ -481,8 +430,8 @@ namespace Lucene.Net.QueryParsers
 			
 			if (fieldToDateResolution == null)
 			{
-				// lazily initialize HashMap
-				fieldToDateResolution = new System.Collections.Hashtable();
+				// lazily initialize Dictionary
+				fieldToDateResolution = new Dictionary<string,DateTools.Resolution>();
 			}
 			
 			fieldToDateResolution[fieldName] = dateResolution;
@@ -506,7 +455,7 @@ namespace Lucene.Net.QueryParsers
 				return this.dateResolution;
 			}
 			
-			DateTools.Resolution resolution = (DateTools.Resolution) fieldToDateResolution[fieldName];
+			DateTools.Resolution resolution = fieldToDateResolution[fieldName];
 			if (resolution == null)
 			{
 				// no date resolutions set for the given field; return default date resolution instead
@@ -540,16 +489,8 @@ namespace Lucene.Net.QueryParsers
 		{
 			return rangeCollator;
 		}
-		
-		/// <deprecated> use <see cref="AddClause(System.Collections.IList, int, int, Query)" /> instead.
-		/// </deprecated>
-        [Obsolete("use AddClause(List, int, int, Query) instead.")]
-		protected internal virtual void  AddClause(System.Collections.ArrayList clauses, int conj, int mods, Query q)
-		{
-			AddClause((System.Collections.IList) clauses, conj, mods, q);
-		}
-		
-		protected internal virtual void AddClause(System.Collections.IList clauses, int conj, int mods, Query q)
+
+		protected internal virtual void AddClause(IList<BooleanClause> clauses, int conj, int mods, Query q)
 		{
 			bool required, prohibited;
 			
@@ -557,7 +498,7 @@ namespace Lucene.Net.QueryParsers
 			// unless it's already prohibited
 			if (clauses.Count > 0 && conj == CONJ_AND)
 			{
-				BooleanClause c = (BooleanClause) clauses[clauses.Count - 1];
+				BooleanClause c = clauses[clauses.Count - 1];
 				if (!c.IsProhibited())
 					c.SetOccur(BooleanClause.Occur.MUST);
 			}
@@ -568,7 +509,7 @@ namespace Lucene.Net.QueryParsers
 				// unless it's prohibited (that means we leave -a OR b but +a OR b-->a OR b)
 				// notice if the input is a OR b, first term is parsed as required; without
 				// this modification a OR b would parsed as +a OR b
-				BooleanClause c = (BooleanClause) clauses[clauses.Count - 1];
+				BooleanClause c = clauses[clauses.Count - 1];
 				if (!c.IsProhibited())
 					c.SetOccur(BooleanClause.Occur.SHOULD);
 			}
@@ -643,11 +584,11 @@ namespace Lucene.Net.QueryParsers
 			{
 				if (buffer.HasAttribute(typeof(TermAttribute)))
 				{
-					termAtt = (TermAttribute) buffer.GetAttribute(typeof(TermAttribute));
+					termAtt = buffer.GetAttribute(typeof(TermAttribute));
 				}
 				if (buffer.HasAttribute(typeof(PositionIncrementAttribute)))
 				{
-					posIncrAtt = (PositionIncrementAttribute) buffer.GetAttribute(typeof(PositionIncrementAttribute));
+					posIncrAtt = buffer.GetAttribute(typeof(PositionIncrementAttribute));
 				}
 			}
 			
@@ -742,7 +683,7 @@ namespace Lucene.Net.QueryParsers
 						// phrase query:
 						MultiPhraseQuery mpq = NewMultiPhraseQuery();
 						mpq.SetSlop(phraseSlop);
-						System.Collections.ArrayList multiTerms = new System.Collections.ArrayList();
+						IList<Term> multiTerms = new List<Term>();
 						int position = - 1;
 						for (int i = 0; i < numTokens; i++)
 						{
@@ -767,11 +708,11 @@ namespace Lucene.Net.QueryParsers
 							{
 								if (enablePositionIncrements)
 								{
-                                    mpq.Add((Term[]) multiTerms.ToArray(typeof(Term)), position);
+                                    mpq.Add(multiTerms.ToArray(), position);
 								}
 								else
 								{
-                                    mpq.Add((Term[]) multiTerms.ToArray(typeof(Term)));
+                                    mpq.Add(multiTerms.ToArray());
 								}
 								multiTerms.Clear();
 							}
@@ -780,11 +721,11 @@ namespace Lucene.Net.QueryParsers
 						}
 						if (enablePositionIncrements)
 						{
-                            mpq.Add((Term[]) multiTerms.ToArray(typeof(Term)), position);
+                            mpq.Add(multiTerms.ToArray(), position);
 						}
 						else
 						{
-                            mpq.Add((Term[]) multiTerms.ToArray(typeof(Term)));
+                            mpq.Add(multiTerms.ToArray());
 						}
 						return mpq;
 					}
@@ -1050,29 +991,6 @@ namespace Lucene.Net.QueryParsers
 		/// </returns>
 		/// <exception cref="ParseException">throw in overridden method to disallow
 		/// </exception>
-		/// <deprecated> use <see cref="GetBooleanQuery(System.Collections.IList)" /> instead
-		/// </deprecated>
-        [Obsolete("use GetBooleanQuery(List) instead")]
-		protected internal virtual Query GetBooleanQuery(System.Collections.ArrayList clauses)
-		{
-			return GetBooleanQuery((System.Collections.IList) clauses, false);
-		}
-		
-		/// <summary> Factory method for generating query, given a set of clauses.
-		/// By default creates a boolean query composed of clauses passed in.
-		/// 
-		/// Can be overridden by extending classes, to modify query being
-		/// returned.
-		/// 
-		/// </summary>
-		/// <param name="clauses">List that contains <see cref="BooleanClause" /> instances
-		/// to join.
-		/// 
-		/// </param>
-		/// <returns> Resulting <see cref="Query" /> object.
-		/// </returns>
-		/// <exception cref="ParseException">throw in overridden method to disallow
-		/// </exception>
 		protected internal virtual Query GetBooleanQuery(System.Collections.IList clauses)
 		{
 			return GetBooleanQuery(clauses, false);
@@ -1095,41 +1013,16 @@ namespace Lucene.Net.QueryParsers
 		/// </returns>
 		/// <exception cref="ParseException">throw in overridden method to disallow
 		/// </exception>
-		/// <deprecated> use <see cref="GetBooleanQuery(System.Collections.IList, bool)" /> instead
-		/// </deprecated>
-        [Obsolete("use GetBooleanQuery(List, bool) instead")]
-		protected internal virtual Query GetBooleanQuery(System.Collections.ArrayList clauses, bool disableCoord)
-		{
-			return GetBooleanQuery((System.Collections.IList) clauses, disableCoord);
-		}
-		
-		/// <summary> Factory method for generating query, given a set of clauses.
-		/// By default creates a boolean query composed of clauses passed in.
-		/// 
-		/// Can be overridden by extending classes, to modify query being
-		/// returned.
-		/// 
-		/// </summary>
-		/// <param name="clauses">List that contains <see cref="BooleanClause" /> instances
-		/// to join.
-		/// </param>
-		/// <param name="disableCoord">true if coord scoring should be disabled.
-		/// 
-		/// </param>
-		/// <returns> Resulting <see cref="Query" /> object.
-		/// </returns>
-		/// <exception cref="ParseException">throw in overridden method to disallow
-		/// </exception>
-		protected internal virtual Query GetBooleanQuery(System.Collections.IList clauses, bool disableCoord)
+		protected internal virtual Query GetBooleanQuery(IList<BooleanClause> clauses, bool disableCoord)
 		{
 			if (clauses.Count == 0)
 			{
 				return null; // all clause words were filtered away by the analyzer.
 			}
 			BooleanQuery query = NewBooleanQuery(disableCoord);
-			for (int i = 0; i < clauses.Count; i++)
+			foreach(BooleanClause clause in clauses)
 			{
-				query.Add((BooleanClause) clauses[i]);
+				query.Add(clauses);
 			}
 			return query;
 		}
@@ -1351,11 +1244,14 @@ namespace Lucene.Net.QueryParsers
 			{
 				char c = s[i];
 				// These characters are part of the query syntax and must be escaped
-				if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')' || c == ':' || c == '^' || c == '[' || c == ']' || c == '\"' || c == '{' || c == '}' || c == '~' || c == '*' || c == '?' || c == '|' || c == '&')
-				{
-					sb.Append('\\');
-				}
-				sb.Append(c);
+                if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || 
+                    c == ')' || c == ':' || c == '^' || c == '[' || c == ']' || 
+                    c == '\"' || c == '{' || c == '}' || c == '~' || c == '*' || 
+                    c == '?' || c == '|' || c == '&')
+                {
+                    sb.Append('\\');
+                }
+			    sb.Append(c);
 			}
 			return sb.ToString();
 		}
@@ -1384,7 +1280,6 @@ namespace Lucene.Net.QueryParsers
 			int ret = CONJ_NONE;
 			switch ((jj_ntk == - 1)?Jj_ntk():jj_ntk)
 			{
-				
 				case Lucene.Net.QueryParsers.QueryParserConstants.AND: 
 				case Lucene.Net.QueryParsers.QueryParserConstants.OR: 
 					switch ((jj_ntk == - 1)?Jj_ntk():jj_ntk)
@@ -1484,7 +1379,7 @@ namespace Lucene.Net.QueryParsers
 		
 		public Query Query(System.String field)
 		{
-			System.Collections.IList clauses = new System.Collections.ArrayList();
+			IList<BooleanClause> clauses = new List<BooleanClause>();
 			Query q, firstQuery = null;
 			int conj, mods;
 			mods = Modifiers();
@@ -2218,7 +2113,7 @@ label_1_brk: ;  // {{Aroush-2.9}} this l
 				return (jj_ntk = jj_nt.kind);
 		}
 		
-		private System.Collections.IList jj_expentries = new System.Collections.ArrayList();
+		private IList<int[]> jj_expentries = new List<int[]>();
 		private int[] jj_expentry;
 		private int jj_kind = - 1;
 		private int[] jj_lasttokens = new int[100];
@@ -2286,7 +2181,7 @@ label_1_brk: ;  // {{Aroush-2.9}} this l
 			int[][] exptokseq = new int[jj_expentries.Count][];
 			for (int i = 0; i < jj_expentries.Count; i++)
 			{
-				exptokseq[i] = (int[]) jj_expentries[i];
+				exptokseq[i] = jj_expentries[i];
 			}
 			return new ParseException(token, exptokseq, Lucene.Net.QueryParsers.QueryParserConstants.tokenImage);
 		}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/BooleanQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/BooleanQuery.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/BooleanQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/BooleanQuery.cs Wed Nov  9 21:03:47 2011
@@ -16,7 +16,8 @@
  */
 
 using System;
-
+using System.Collections;
+using Lucene.Net.Index;
 using IndexReader = Lucene.Net.Index.IndexReader;
 using ToStringUtils = Lucene.Net.Util.ToStringUtils;
 using Occur = Lucene.Net.Search.BooleanClause.Occur;
@@ -29,7 +30,7 @@ namespace Lucene.Net.Search
 	/// BooleanQuerys.
 	/// </summary>
 	[Serializable]
-	public class BooleanQuery:Query, System.ICloneable
+	public class BooleanQuery : Query, System.Collections.Generic.IEnumerable<BooleanClause>, System.ICloneable
 	{
 		[Serializable]
 		private class AnonymousClassSimilarityDelegator:SimilarityDelegator
@@ -75,9 +76,6 @@ namespace Lucene.Net.Search
 				}
 				
 			}
-			public TooManyClauses()
-			{
-			}
 		}
 		
 		/// <summary>Return the maximum number of clauses permitted, 1024 by default.
@@ -160,16 +158,8 @@ namespace Lucene.Net.Search
 		/// any specific clauses are required (or prohibited).  This number will
 		/// only be compared against the number of matching optional clauses.
 		/// <p/>
-		/// <p/>
-		/// EXPERT NOTE: Using this method may force collecting docs in order,
-		/// regardless of whether setAllowDocsOutOfOrder(true) has been called.
-		/// <p/>
-		/// 
 		/// </summary>
-		/// <param name="min">the number of optional clauses that must match
-		/// </param>
-		/// <seealso cref="SetAllowDocsOutOfOrder">
-		/// </seealso>
+		/// <param name="min">the number of optional clauses that must match</param>
 		public virtual void  SetMinimumNumberShouldMatch(int min)
 		{
 			this.minNrShouldMatch = min;
@@ -210,15 +200,23 @@ namespace Lucene.Net.Search
 		/// <summary>Returns the set of clauses in this query. </summary>
 		public virtual BooleanClause[] GetClauses()
 		{
-			return (BooleanClause[]) clauses.ToArray();
+			return clauses.ToArray();
 		}
 		
 		/// <summary>Returns the list of clauses in this query. </summary>
-		public virtual System.Collections.IList Clauses()
+		public virtual System.Collections.Generic.List<BooleanClause> Clauses()
 		{
 			return clauses;
 		}
 		
+        /// <summary>
+        /// Returns an iterator on the clauses in this query.
+        /// </summary>
+        /// <returns></returns>
+        public System.Collections.Generic.IEnumerator<BooleanClause> GetEnumerator()
+        {
+            return clauses.GetEnumerator();
+        }
 		/// <summary> Expert: the Weight for BooleanQuery, used to
 		/// normalize, score and explain these queries.
 		/// 
@@ -243,17 +241,16 @@ namespace Lucene.Net.Search
 			}
 			/// <summary>The Similarity implementation. </summary>
 			protected internal Similarity similarity;
-			protected internal System.Collections.ArrayList weights;
+			protected internal System.Collections.Generic.List<Weight> weights;
 			
 			public BooleanWeight(BooleanQuery enclosingInstance, Searcher searcher)
 			{
 				InitBlock(enclosingInstance);
 				this.similarity = Enclosing_Instance.GetSimilarity(searcher);
-				weights = new System.Collections.ArrayList(Enclosing_Instance.clauses.Count);
+                weights = new System.Collections.Generic.List<Weight>(Enclosing_Instance.clauses.Count);
 				for (int i = 0; i < Enclosing_Instance.clauses.Count; i++)
 				{
-					BooleanClause c = (BooleanClause) Enclosing_Instance.clauses[i];
-					weights.Add(c.GetQuery().CreateWeight(searcher));
+				    weights.Add(Enclosing_Instance.clauses[i].GetQuery().CreateWeight(searcher));
 				}
 			}
 			
@@ -271,11 +268,9 @@ namespace Lucene.Net.Search
 				float sum = 0.0f;
 				for (int i = 0; i < weights.Count; i++)
 				{
-					BooleanClause c = (BooleanClause) Enclosing_Instance.clauses[i];
-					Weight w = (Weight) weights[i];
 					// call sumOfSquaredWeights for all clauses in case of side effects
-					float s = w.SumOfSquaredWeights(); // sum sub weights
-					if (!c.IsProhibited())
+					float s = weights[i].SumOfSquaredWeights(); // sum sub weights
+					if (!Enclosing_Instance.clauses[i].IsProhibited())
 					// only add to sum for non-prohibited clauses
 						sum += s;
 				}
@@ -289,9 +284,8 @@ namespace Lucene.Net.Search
 			public override void  Normalize(float norm)
 			{
 				norm *= Enclosing_Instance.GetBoost(); // incorporate boost
-				for (System.Collections.IEnumerator iter = weights.GetEnumerator(); iter.MoveNext(); )
+				foreach (Weight w in weights)
 				{
-					Weight w = (Weight) iter.Current;
 					// normalize all clauses, (even if prohibited in case of side affects)
 					w.Normalize(norm);
 				}
@@ -307,12 +301,12 @@ namespace Lucene.Net.Search
 				float sum = 0.0f;
 				bool fail = false;
 				int shouldMatchCount = 0;
-				for (System.Collections.IEnumerator wIter = weights.GetEnumerator(), cIter = Enclosing_Instance.clauses.GetEnumerator(); wIter.MoveNext(); )
+			    System.Collections.Generic.IEnumerator<BooleanClause> cIter = Enclosing_Instance.clauses.GetEnumerator();
+				for (System.Collections.Generic.IEnumerator<Weight> wIter = weights.GetEnumerator(); wIter.MoveNext(); )
 				{
                     cIter.MoveNext();
-
-                    Weight w = (Weight)wIter.Current;
-					BooleanClause c = (BooleanClause) cIter.Current;
+                    Weight w = wIter.Current;
+					BooleanClause c = cIter.Current;
 					if (w.Scorer(reader, true, true) == null)
 					{
 						continue;
@@ -382,14 +376,14 @@ namespace Lucene.Net.Search
 			
 			public override Scorer Scorer(IndexReader reader, bool scoreDocsInOrder, bool topScorer)
 			{
-				System.Collections.IList required = new System.Collections.ArrayList();
-				System.Collections.IList prohibited = new System.Collections.ArrayList();
-				System.Collections.IList optional = new System.Collections.ArrayList();
-				for (System.Collections.IEnumerator wIter = weights.GetEnumerator(), cIter = Enclosing_Instance.clauses.GetEnumerator(); wIter.MoveNext(); )
+				var required = new System.Collections.Generic.List<Scorer>();
+                var prohibited = new System.Collections.Generic.List<Scorer>();
+                var optional = new System.Collections.Generic.List<Scorer>();
+
+			    System.Collections.Generic.IEnumerator<BooleanClause> cIter = Enclosing_Instance.clauses.GetEnumerator();
+				foreach (Weight w in weights)
 				{
                     cIter.MoveNext();
-
-					Weight w = (Weight) wIter.Current;
 					BooleanClause c = (BooleanClause) cIter.Current;
 					Scorer subScorer = w.Scorer(reader, true, false);
 					if (subScorer == null)
@@ -414,7 +408,6 @@ namespace Lucene.Net.Search
 				}
 				
 				// Check if we can return a BooleanScorer
-				scoreDocsInOrder |= !Lucene.Net.Search.BooleanQuery.allowDocsOutOfOrder; // until it is removed, factor in the static setting.
 				if (!scoreDocsInOrder && topScorer && required.Count == 0 && prohibited.Count < 32)
 				{
 					return new BooleanScorer(similarity, Enclosing_Instance.minNrShouldMatch, optional, prohibited);
@@ -440,9 +433,8 @@ namespace Lucene.Net.Search
 			public override bool ScoresDocsOutOfOrder()
 			{
 				int numProhibited = 0;
-				for (System.Collections.IEnumerator cIter = Enclosing_Instance.clauses.GetEnumerator(); cIter.MoveNext(); )
+				foreach (BooleanClause c in Enclosing_Instance.clauses)
 				{
-					BooleanClause c = (BooleanClause) cIter.Current;
 					if (c.IsRequired())
 					{
 						return false; // BS2 (in-order) will be used by scorer()
@@ -464,76 +456,6 @@ namespace Lucene.Net.Search
 			}
 		}
 		
-		/// <summary> Whether hit docs may be collected out of docid order.
-		/// 
-		/// </summary>
-		/// <deprecated> this will not be needed anymore, as
-		/// <see cref="Weight.ScoresDocsOutOfOrder()" /> is used.
-		/// </deprecated>
-        [Obsolete("this will not be needed anymore, as Weight.ScoresDocsOutOfOrder() is used.")]
-		private static bool allowDocsOutOfOrder = true;
-		
-		/// <summary> Expert: Indicates whether hit docs may be collected out of docid order.
-		/// 
-		/// <p/>
-		/// Background: although the contract of the Scorer class requires that
-		/// documents be iterated in order of doc id, this was not true in early
-		/// versions of Lucene. Many pieces of functionality in the current Lucene code
-		/// base have undefined behavior if this contract is not upheld, but in some
-		/// specific simple cases may be faster. (For example: disjunction queries with
-		/// less than 32 prohibited clauses; This setting has no effect for other
-		/// queries.)
-		/// <p/>
-		/// 
-		/// <p/>
-		/// Specifics: By setting this option to true, docid N might be scored for a
-		/// single segment before docid N-1. Across multiple segments, docs may be
-		/// scored out of order regardless of this setting - it only applies to scoring
-		/// a single segment.
-		/// 
-		/// Being static, this setting is system wide.
-		/// <p/>
-		/// 
-		/// </summary>
-		/// <deprecated> this is not needed anymore, as
-		/// <see cref="Weight.ScoresDocsOutOfOrder()" /> is used.
-		/// </deprecated>
-        [Obsolete("this is not needed anymore, as Weight.ScoresDocsOutOfOrder() is used.")]
-		public static void  SetAllowDocsOutOfOrder(bool allow)
-		{
-			allowDocsOutOfOrder = allow;
-		}
-		
-		/// <summary> Whether hit docs may be collected out of docid order.
-		/// 
-		/// </summary>
-        /// <seealso cref="SetAllowDocsOutOfOrder(bool)">
-		/// </seealso>
-		/// <deprecated> this is not needed anymore, as
-		/// <see cref="Weight.ScoresDocsOutOfOrder()" /> is used.
-		/// </deprecated>
-        [Obsolete("this is not needed anymore, as Weight.ScoresDocsOutOfOrder() is used.")]
-		public static bool GetAllowDocsOutOfOrder()
-		{
-			return allowDocsOutOfOrder;
-		}
-
-        /// <deprecated> Use <see cref="SetAllowDocsOutOfOrder(bool)" /> instead. 
-		/// </deprecated>
-        [Obsolete("Use SetAllowDocsOutOfOrder(bool) instead.")]
-		public static void  SetUseScorer14(bool use14)
-		{
-			SetAllowDocsOutOfOrder(use14);
-		}
-		
-		/// <deprecated> Use <see cref="GetAllowDocsOutOfOrder()" /> instead.
-		/// </deprecated>
-        [Obsolete("Use GetAllowDocsOutOfOrder() instead.")]
-		public static bool GetUseScorer14()
-		{
-			return GetAllowDocsOutOfOrder();
-		}
-		
 		public override Weight CreateWeight(Searcher searcher)
 		{
 			return new BooleanWeight(this, searcher);
@@ -544,7 +466,7 @@ namespace Lucene.Net.Search
 			if (minNrShouldMatch == 0 && clauses.Count == 1)
 			{
 				// optimize 1-clause queries
-				BooleanClause c = (BooleanClause) clauses[0];
+				BooleanClause c = clauses[0];
 				if (!c.IsProhibited())
 				{
 					// just return clause
@@ -567,7 +489,7 @@ namespace Lucene.Net.Search
 			BooleanQuery clone = null; // recursively rewrite
 			for (int i = 0; i < clauses.Count; i++)
 			{
-				BooleanClause c = (BooleanClause) clauses[i];
+				BooleanClause c = clauses[i];
 				Query query = c.GetQuery().Rewrite(reader);
 				if (query != c.GetQuery())
 				{
@@ -586,11 +508,10 @@ namespace Lucene.Net.Search
 		}
 		
 		// inherit javadoc
-		public override void  ExtractTerms(System.Collections.Hashtable terms)
+		public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
 		{
-			for (System.Collections.IEnumerator i = clauses.GetEnumerator(); i.MoveNext(); )
+			foreach(BooleanClause clause in clauses)
 			{
-				BooleanClause clause = (BooleanClause) i.Current;
 				clause.GetQuery().ExtractTerms(terms);
 			}
 		}
@@ -614,7 +535,7 @@ namespace Lucene.Net.Search
 			
 			for (int i = 0; i < clauses.Count; i++)
 			{
-				BooleanClause c = (BooleanClause) clauses[i];
+				BooleanClause c = clauses[i];
 				if (c.IsProhibited())
 					buffer.Append("-");
 				else if (c.IsRequired())
@@ -680,5 +601,10 @@ namespace Lucene.Net.Search
 		{
             return BitConverter.ToInt32(BitConverter.GetBytes(GetBoost()), 0) ^ clauses.GetHashCode() + GetMinimumNumberShouldMatch() + (disableCoord ? 17 : 0);
 		}
+
+	    IEnumerator IEnumerable.GetEnumerator()
+	    {
+	        return GetEnumerator();
+	    }
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/BooleanScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/BooleanScorer.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/BooleanScorer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/BooleanScorer.cs Wed Nov  9 21:03:47 2011
@@ -136,32 +136,11 @@ namespace Lucene.Net.Search
 				return NO_MORE_DOCS;
 			}
 			
-			/// <deprecated> use <see cref="DocID()" /> instead. 
-			/// </deprecated>
-            [Obsolete("use DocID() instead.")]
-			public override int Doc()
-			{
-				return doc;
-			}
-			
 			public override int DocID()
 			{
 				return doc;
 			}
 			
-			public override Explanation Explain(int doc)
-			{
-				return null;
-			}
-			
-			/// <deprecated> use <see cref="NextDoc()" /> instead. 
-			/// </deprecated>
-            [Obsolete("use NextDoc() instead. ")]
-			public override bool Next()
-			{
-				return false;
-			}
-			
 			public override int NextDoc()
 			{
 				return NO_MORE_DOCS;
@@ -171,14 +150,6 @@ namespace Lucene.Net.Search
 			{
 				return score;
 			}
-			
-			/// <deprecated> use <see cref="Advance(int)" /> instead. 
-			/// </deprecated>
-            [Obsolete("use Advance(int) instead. ")]
-			public override bool SkipTo(int target)
-			{
-				return false;
-			}
 		}
 		
 		internal sealed class Bucket
@@ -253,16 +224,17 @@ namespace Lucene.Net.Search
 		private Bucket current;
 		private int doc = - 1;
 		
-		public /*internal*/ BooleanScorer(Similarity similarity, int minNrShouldMatch, System.Collections.IList optionalScorers, System.Collections.IList prohibitedScorers):base(similarity)
+		public /*internal*/ BooleanScorer(Similarity similarity, int minNrShouldMatch,
+            System.Collections.Generic.List<Scorer> optionalScorers, System.Collections.Generic.List<Scorer> prohibitedScorers)
+            : base(similarity)
 		{
 			InitBlock();
 			this.minNrShouldMatch = minNrShouldMatch;
 			
 			if (optionalScorers != null && optionalScorers.Count > 0)
 			{
-				for (System.Collections.IEnumerator si = optionalScorers.GetEnumerator(); si.MoveNext(); )
+				foreach (Scorer scorer in optionalScorers)
 				{
-					Scorer scorer = (Scorer) si.Current;
 					maxCoord++;
 					if (scorer.NextDoc() != NO_MORE_DOCS)
 					{
@@ -273,9 +245,8 @@ namespace Lucene.Net.Search
 			
 			if (prohibitedScorers != null && prohibitedScorers.Count > 0)
 			{
-				for (System.Collections.IEnumerator si = prohibitedScorers.GetEnumerator(); si.MoveNext(); )
+				foreach(Scorer scorer in prohibitedScorers)
 				{
-					Scorer scorer = (Scorer) si.Current;
 					int mask = nextMask;
 					nextMask = nextMask << 1;
 					prohibitedMask |= mask; // update prohibited mask
@@ -359,27 +330,11 @@ namespace Lucene.Net.Search
 			return false;
 		}
 		
-		/// <deprecated> use <see cref="Score(Collector, int, int)" /> instead. 
-		/// </deprecated>
-        [Obsolete("use Score(Collector, int, int) instead.")]
-		protected internal override bool Score(HitCollector hc, int max)
-		{
-			return Score(new HitCollectorWrapper(hc), max, DocID());
-		}
-		
 		public override int Advance(int target)
 		{
 			throw new System.NotSupportedException();
 		}
 		
-		/// <deprecated> use <see cref="DocID()" /> instead. 
-		/// </deprecated>
-        [Obsolete("use DocID() instead. ")]
-		public override int Doc()
-		{
-			return current.doc;
-		}
-		
 		public override int DocID()
 		{
 			return doc;
@@ -389,15 +344,7 @@ namespace Lucene.Net.Search
 		{
 			throw new System.NotSupportedException();
 		}
-		
-		/// <deprecated> use <see cref="NextDoc()" /> instead. 
-		/// </deprecated>
-        [Obsolete("use NextDoc() instead. ")]
-		public override bool Next()
-		{
-			return NextDoc() != NO_MORE_DOCS;
-		}
-		
+
 		public override int NextDoc()
 		{
 			bool more;
@@ -447,22 +394,6 @@ namespace Lucene.Net.Search
 			Score(collector, System.Int32.MaxValue, NextDoc());
 		}
 		
-		/// <deprecated> use <see cref="Score(Collector)" /> instead. 
-		/// </deprecated>
-        [Obsolete("use Score(Collector) instead. ")]
-		public override void  Score(HitCollector hc)
-		{
-			Score(new HitCollectorWrapper(hc));
-		}
-		
-		/// <deprecated> use <see cref="Advance(int)" /> instead. 
-		/// </deprecated>
-        [Obsolete("use Advance(int) instead. ")]
-		public override bool SkipTo(int target)
-		{
-			throw new System.NotSupportedException();
-		}
-		
 		public override System.String ToString()
 		{
 			System.Text.StringBuilder buffer = new System.Text.StringBuilder();



Mime
View raw message