lucene-lucene-net-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 [10/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/co...
Date Wed, 09 Nov 2011 21:03:52 GMT
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheRangeFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheRangeFilter.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheRangeFilter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheRangeFilter.cs Wed Nov  9 21:03:47 2011
@@ -27,20 +27,19 @@ namespace Lucene.Net.Search
 	
 	/// <summary> A range filter built on top of a cached single term field (in <see cref="FieldCache" />).
 	/// 
-	/// <p/>FieldCacheRangeFilter builds a single cache for the field the first time it is used.
-	/// Each subsequent FieldCacheRangeFilter on the same field then reuses this cache,
+    /// <p/><see cref="FieldCacheRangeFilter" /> builds a single cache for the field the first time it is used.
+    /// Each subsequent <see cref="FieldCacheRangeFilter" /> on the same field then reuses this cache,
 	/// even if the range itself changes. 
 	/// 
-	/// <p/>This means that FieldCacheRangeFilter is much faster (sometimes more than 100x as fast) 
-	/// as building a <see cref="TermRangeFilter" /> (or <see cref="ConstantScoreRangeQuery" /> on a <see cref="TermRangeFilter" />)
-	/// for each query, if using a <see cref="NewStringRange" />. However, if the range never changes it
-	/// is slower (around 2x as slow) than building a CachingWrapperFilter on top of a single TermRangeFilter.
+    /// <p/>This means that <see cref="FieldCacheRangeFilter" /> is much faster (sometimes more than 100x as fast) 
+	/// as building a <see cref="TermRangeFilter" /> if using a <see cref="NewStringRange" />. However, if the range never changes it
+    /// is slower (around 2x as slow) than building a CachingWrapperFilter on top of a single <see cref="TermRangeFilter" />.
 	/// 
 	/// For numeric data types, this filter may be significantly faster than <see cref="NumericRangeFilter" />.
 	/// Furthermore, it does not need the numeric values encoded by <see cref="NumericField" />. But
 	/// it has the problem that it only works with exact one value/document (see below).
 	/// 
-	/// <p/>As with all <see cref="FieldCache" /> based functionality, FieldCacheRangeFilter is only valid for 
+    /// <p/>As with all <see cref="FieldCache" /> based functionality, <see cref="FieldCacheRangeFilter" /> is only valid for 
 	/// fields which exact one term for each document (except for <see cref="NewStringRange" />
 	/// where 0 terms are also allowed). Due to a restriction of <see cref="FieldCache" />, for numeric ranges
 	/// all terms that do not have a numeric value, 0 is assumed.
@@ -54,14 +53,14 @@ namespace Lucene.Net.Search
 	/// </summary>
 	
 	[Serializable]
-	public abstract class FieldCacheRangeFilter:Filter
+	public abstract class FieldCacheRangeFilter<T> : Filter
 	{
 		[Serializable]
-		private class AnonymousClassFieldCacheRangeFilter:FieldCacheRangeFilter
+        private class AnonymousClassFieldCacheRangeFilter : FieldCacheRangeFilter<string>
 		{
 			private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
 			{
-				private void  InitBlock(Lucene.Net.Search.StringIndex fcsi, int inclusiveLowerPoint, int inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter enclosingInstance)
+                private void InitBlock(Lucene.Net.Search.StringIndex fcsi, int inclusiveLowerPoint, int inclusiveUpperPoint, FieldCacheRangeFilter<string> enclosingInstance)
 				{
 					this.fcsi = fcsi;
 					this.inclusiveLowerPoint = inclusiveLowerPoint;
@@ -71,8 +70,8 @@ namespace Lucene.Net.Search
 				private Lucene.Net.Search.StringIndex fcsi;
 				private int inclusiveLowerPoint;
 				private int inclusiveUpperPoint;
-				private AnonymousClassFieldCacheRangeFilter enclosingInstance;
-				public AnonymousClassFieldCacheRangeFilter Enclosing_Instance
+                private FieldCacheRangeFilter<string> enclosingInstance;
+                public FieldCacheRangeFilter<string> Enclosing_Instance
 				{
 					get
 					{
@@ -80,7 +79,8 @@ namespace Lucene.Net.Search
 					}
 					
 				}
-				internal AnonymousClassFieldCacheDocIdSet(Lucene.Net.Search.StringIndex fcsi, int inclusiveLowerPoint, int inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2):base(Param1, Param2)
+                internal AnonymousClassFieldCacheDocIdSet(Lucene.Net.Search.StringIndex fcsi, int inclusiveLowerPoint, int inclusiveUpperPoint, FieldCacheRangeFilter<string> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
+                    : base(Param1, Param2)
 				{
 					InitBlock(fcsi, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
 				}
@@ -89,14 +89,15 @@ namespace Lucene.Net.Search
 					return fcsi.order[doc] >= inclusiveLowerPoint && fcsi.order[doc] <= inclusiveUpperPoint;
 				}
 			}
-			internal AnonymousClassFieldCacheRangeFilter(System.String Param1, Lucene.Net.Search.Parser Param2, System.Object Param3, System.Object Param4, bool Param5, bool Param6):base(Param1, Param2, Param3, Param4, Param5, Param6)
+			internal AnonymousClassFieldCacheRangeFilter(string field, Lucene.Net.Search.Parser parser, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
+                : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
 			{
 			}
 			public override DocIdSet GetDocIdSet(IndexReader reader)
 			{
 				Lucene.Net.Search.StringIndex fcsi = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetStringIndex(reader, field);
-				int lowerPoint = fcsi.BinarySearchLookup((System.String) lowerVal);
-				int upperPoint = fcsi.BinarySearchLookup((System.String) upperVal);
+				int lowerPoint = fcsi.BinarySearchLookup(lowerVal);
+				int upperPoint = fcsi.BinarySearchLookup(upperVal);
 				
 				int inclusiveLowerPoint;
 				int inclusiveUpperPoint;
@@ -152,11 +153,11 @@ namespace Lucene.Net.Search
 			}
 		}
 		[Serializable]
-		private class AnonymousClassFieldCacheRangeFilter1:FieldCacheRangeFilter
+		private class AnonymousClassFieldCacheRangeFilter1 : FieldCacheRangeFilter<byte?>
 		{
 			private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
 			{
-				private void  InitBlock(sbyte[] values, byte inclusiveLowerPoint, byte inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter1 enclosingInstance)
+                private void InitBlock(sbyte[] values, byte inclusiveLowerPoint, byte inclusiveUpperPoint, FieldCacheRangeFilter<byte?> enclosingInstance)
 				{
 					this.values = values;
 					this.inclusiveLowerPoint = inclusiveLowerPoint;
@@ -166,8 +167,8 @@ namespace Lucene.Net.Search
 				private sbyte[] values;
 				private byte inclusiveLowerPoint;
 				private byte inclusiveUpperPoint;
-				private AnonymousClassFieldCacheRangeFilter1 enclosingInstance;
-				public AnonymousClassFieldCacheRangeFilter1 Enclosing_Instance
+                private FieldCacheRangeFilter<byte?> enclosingInstance;
+                public FieldCacheRangeFilter<byte?> Enclosing_Instance
 				{
 					get
 					{
@@ -175,7 +176,8 @@ namespace Lucene.Net.Search
 					}
 					
 				}
-				internal AnonymousClassFieldCacheDocIdSet(sbyte[] values, byte inclusiveLowerPoint, byte inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter1 enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2):base(Param1, Param2)
+                internal AnonymousClassFieldCacheDocIdSet(sbyte[] values, byte inclusiveLowerPoint, byte inclusiveUpperPoint, FieldCacheRangeFilter<byte?> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
+                    : base(Param1, Param2)
 				{
 					InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
 				}
@@ -184,7 +186,8 @@ namespace Lucene.Net.Search
 					return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
 				}
 			}
-			internal AnonymousClassFieldCacheRangeFilter1(System.String Param1, Lucene.Net.Search.Parser Param2, System.Object Param3, System.Object Param4, bool Param5, bool Param6):base(Param1, Param2, Param3, Param4, Param5, Param6)
+			internal AnonymousClassFieldCacheRangeFilter1(string field, Parser parser, byte? lowerVal, byte? upperVal, bool includeLower, bool includeUpper)
+                : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
 			{
 			}
 			public override DocIdSet GetDocIdSet(IndexReader reader)
@@ -193,25 +196,25 @@ namespace Lucene.Net.Search
 				byte inclusiveUpperPoint;
 				if (lowerVal != null)
 				{
-					byte i = (byte) System.Convert.ToSByte(((System.ValueType) lowerVal));
-					if (!includeLower && i == (byte) System.Byte.MaxValue)
+					byte i = (byte) lowerVal;
+					if (!includeLower && i == byte.MaxValue)
 						return DocIdSet.EMPTY_DOCIDSET;
 					inclusiveLowerPoint = (byte) (includeLower?i:(i + 1));
 				}
 				else
 				{
-					inclusiveLowerPoint = (byte) System.Byte.MinValue;
+					inclusiveLowerPoint = byte.MinValue;
 				}
 				if (upperVal != null)
 				{
-					byte i = (byte) System.Convert.ToSByte(((System.ValueType) upperVal));
-					if (!includeUpper && i == (byte) System.Byte.MinValue)
+					byte i = (byte)upperVal;
+					if (!includeUpper && i == byte.MinValue)
 						return DocIdSet.EMPTY_DOCIDSET;
 					inclusiveUpperPoint = (byte) (includeUpper?i:(i - 1));
 				}
 				else
 				{
-					inclusiveUpperPoint = (byte) System.Byte.MaxValue;
+					inclusiveUpperPoint = byte.MaxValue;
 				}
 				
 				if (inclusiveLowerPoint > inclusiveUpperPoint)
@@ -223,11 +226,11 @@ namespace Lucene.Net.Search
 			}
 		}
 		[Serializable]
-		private class AnonymousClassFieldCacheRangeFilter2:FieldCacheRangeFilter
+		private class AnonymousClassFieldCacheRangeFilter2 : FieldCacheRangeFilter<short?>
 		{
 			private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
 			{
-				private void  InitBlock(short[] values, short inclusiveLowerPoint, short inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter2 enclosingInstance)
+                private void InitBlock(short[] values, short inclusiveLowerPoint, short inclusiveUpperPoint, FieldCacheRangeFilter<short?> enclosingInstance)
 				{
 					this.values = values;
 					this.inclusiveLowerPoint = inclusiveLowerPoint;
@@ -237,8 +240,8 @@ namespace Lucene.Net.Search
 				private short[] values;
 				private short inclusiveLowerPoint;
 				private short inclusiveUpperPoint;
-				private AnonymousClassFieldCacheRangeFilter2 enclosingInstance;
-				public AnonymousClassFieldCacheRangeFilter2 Enclosing_Instance
+                private FieldCacheRangeFilter<short?> enclosingInstance;
+                public FieldCacheRangeFilter<short?> Enclosing_Instance
 				{
 					get
 					{
@@ -246,7 +249,8 @@ namespace Lucene.Net.Search
 					}
 					
 				}
-				internal AnonymousClassFieldCacheDocIdSet(short[] values, short inclusiveLowerPoint, short inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter2 enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2):base(Param1, Param2)
+                internal AnonymousClassFieldCacheDocIdSet(short[] values, short inclusiveLowerPoint, short inclusiveUpperPoint, FieldCacheRangeFilter<short?> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
+                    : base(Param1, Param2)
 				{
 					InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
 				}
@@ -255,7 +259,8 @@ namespace Lucene.Net.Search
 					return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
 				}
 			}
-			internal AnonymousClassFieldCacheRangeFilter2(System.String Param1, Lucene.Net.Search.Parser Param2, System.Object Param3, System.Object Param4, bool Param5, bool Param6):base(Param1, Param2, Param3, Param4, Param5, Param6)
+			internal AnonymousClassFieldCacheRangeFilter2(string field, Parser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
+                : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
 			{
 			}
 			public override DocIdSet GetDocIdSet(IndexReader reader)
@@ -264,25 +269,25 @@ namespace Lucene.Net.Search
 				short inclusiveUpperPoint;
 				if (lowerVal != null)
 				{
-					short i = System.Convert.ToInt16(((System.ValueType) lowerVal));
-					if (!includeLower && i == System.Int16.MaxValue)
+					short i = (short)lowerVal;
+					if (!includeLower && i == short.MaxValue)
 						return DocIdSet.EMPTY_DOCIDSET;
 					inclusiveLowerPoint = (short) (includeLower?i:(i + 1));
 				}
 				else
 				{
-					inclusiveLowerPoint = System.Int16.MinValue;
+					inclusiveLowerPoint = short.MinValue;
 				}
 				if (upperVal != null)
 				{
-					short i = System.Convert.ToInt16(((System.ValueType) upperVal));
-					if (!includeUpper && i == System.Int16.MinValue)
+					short i = (short)upperVal;
+					if (!includeUpper && i == short.MinValue)
 						return DocIdSet.EMPTY_DOCIDSET;
 					inclusiveUpperPoint = (short) (includeUpper?i:(i - 1));
 				}
 				else
 				{
-					inclusiveUpperPoint = System.Int16.MaxValue;
+					inclusiveUpperPoint = short.MaxValue;
 				}
 				
 				if (inclusiveLowerPoint > inclusiveUpperPoint)
@@ -294,11 +299,11 @@ namespace Lucene.Net.Search
 			}
 		}
 		[Serializable]
-		private class AnonymousClassFieldCacheRangeFilter3:FieldCacheRangeFilter
+		private class AnonymousClassFieldCacheRangeFilter3 : FieldCacheRangeFilter<int?>
 		{
-			private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
+			private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
 			{
-				private void  InitBlock(int[] values, int inclusiveLowerPoint, int inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter3 enclosingInstance)
+                private void InitBlock(int[] values, int inclusiveLowerPoint, int inclusiveUpperPoint, FieldCacheRangeFilter<int?> enclosingInstance)
 				{
 					this.values = values;
 					this.inclusiveLowerPoint = inclusiveLowerPoint;
@@ -308,8 +313,8 @@ namespace Lucene.Net.Search
 				private int[] values;
 				private int inclusiveLowerPoint;
 				private int inclusiveUpperPoint;
-				private AnonymousClassFieldCacheRangeFilter3 enclosingInstance;
-				public AnonymousClassFieldCacheRangeFilter3 Enclosing_Instance
+                private FieldCacheRangeFilter<int?> enclosingInstance;
+                public FieldCacheRangeFilter<int?> Enclosing_Instance
 				{
 					get
 					{
@@ -317,7 +322,8 @@ namespace Lucene.Net.Search
 					}
 					
 				}
-				internal AnonymousClassFieldCacheDocIdSet(int[] values, int inclusiveLowerPoint, int inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter3 enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2):base(Param1, Param2)
+                internal AnonymousClassFieldCacheDocIdSet(int[] values, int inclusiveLowerPoint, int inclusiveUpperPoint, FieldCacheRangeFilter<int?> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
+                    : base(Param1, Param2)
 				{
 					InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
 				}
@@ -326,7 +332,8 @@ namespace Lucene.Net.Search
 					return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
 				}
 			}
-			internal AnonymousClassFieldCacheRangeFilter3(System.String Param1, Lucene.Net.Search.Parser Param2, System.Object Param3, System.Object Param4, bool Param5, bool Param6):base(Param1, Param2, Param3, Param4, Param5, Param6)
+			internal AnonymousClassFieldCacheRangeFilter3(string field, Lucene.Net.Search.Parser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
+                : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
 			{
 			}
 			public override DocIdSet GetDocIdSet(IndexReader reader)
@@ -335,25 +342,25 @@ namespace Lucene.Net.Search
 				int inclusiveUpperPoint;
 				if (lowerVal != null)
 				{
-					int i = System.Convert.ToInt32(((System.ValueType) lowerVal));
-					if (!includeLower && i == System.Int32.MaxValue)
+				    int i = (int) lowerVal;
+					if (!includeLower && i == int.MaxValue)
 						return DocIdSet.EMPTY_DOCIDSET;
 					inclusiveLowerPoint = includeLower?i:(i + 1);
 				}
 				else
 				{
-					inclusiveLowerPoint = System.Int32.MinValue;
+					inclusiveLowerPoint = int.MinValue;
 				}
 				if (upperVal != null)
 				{
-					int i = System.Convert.ToInt32(((System.ValueType) upperVal));
-					if (!includeUpper && i == System.Int32.MinValue)
+				    int i = (int) upperVal;
+					if (!includeUpper && i == int.MinValue)
 						return DocIdSet.EMPTY_DOCIDSET;
 					inclusiveUpperPoint = includeUpper?i:(i - 1);
 				}
 				else
 				{
-					inclusiveUpperPoint = System.Int32.MaxValue;
+					inclusiveUpperPoint = int.MaxValue;
 				}
 				
 				if (inclusiveLowerPoint > inclusiveUpperPoint)
@@ -365,11 +372,11 @@ namespace Lucene.Net.Search
 			}
 		}
 		[Serializable]
-		private class AnonymousClassFieldCacheRangeFilter4:FieldCacheRangeFilter
+		private class AnonymousClassFieldCacheRangeFilter4 : FieldCacheRangeFilter<long?>
 		{
 			private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
 			{
-				private void  InitBlock(long[] values, long inclusiveLowerPoint, long inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter4 enclosingInstance)
+                private void InitBlock(long[] values, long inclusiveLowerPoint, long inclusiveUpperPoint, FieldCacheRangeFilter<long?> enclosingInstance)
 				{
 					this.values = values;
 					this.inclusiveLowerPoint = inclusiveLowerPoint;
@@ -379,8 +386,8 @@ namespace Lucene.Net.Search
 				private long[] values;
 				private long inclusiveLowerPoint;
 				private long inclusiveUpperPoint;
-				private AnonymousClassFieldCacheRangeFilter4 enclosingInstance;
-				public AnonymousClassFieldCacheRangeFilter4 Enclosing_Instance
+                private FieldCacheRangeFilter<long?> enclosingInstance;
+                public FieldCacheRangeFilter<long?> Enclosing_Instance
 				{
 					get
 					{
@@ -388,7 +395,8 @@ namespace Lucene.Net.Search
 					}
 					
 				}
-				internal AnonymousClassFieldCacheDocIdSet(long[] values, long inclusiveLowerPoint, long inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter4 enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2):base(Param1, Param2)
+                internal AnonymousClassFieldCacheDocIdSet(long[] values, long inclusiveLowerPoint, long inclusiveUpperPoint, FieldCacheRangeFilter<long?> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
+                    : base(Param1, Param2)
 				{
 					InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
 				}
@@ -397,7 +405,8 @@ namespace Lucene.Net.Search
 					return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
 				}
 			}
-			internal AnonymousClassFieldCacheRangeFilter4(System.String Param1, Lucene.Net.Search.Parser Param2, System.Object Param3, System.Object Param4, bool Param5, bool Param6):base(Param1, Param2, Param3, Param4, Param5, Param6)
+			internal AnonymousClassFieldCacheRangeFilter4(string field, Lucene.Net.Search.Parser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
+                : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
 			{
 			}
 			public override DocIdSet GetDocIdSet(IndexReader reader)
@@ -406,25 +415,25 @@ namespace Lucene.Net.Search
 				long inclusiveUpperPoint;
 				if (lowerVal != null)
 				{
-					long i = System.Convert.ToInt64(((System.ValueType) lowerVal));
-					if (!includeLower && i == System.Int64.MaxValue)
+					long i = (long)lowerVal;
+					if (!includeLower && i == long.MaxValue)
 						return DocIdSet.EMPTY_DOCIDSET;
 					inclusiveLowerPoint = includeLower?i:(i + 1L);
 				}
 				else
 				{
-					inclusiveLowerPoint = System.Int64.MinValue;
+					inclusiveLowerPoint = long.MinValue;
 				}
 				if (upperVal != null)
 				{
-					long i = System.Convert.ToInt64(((System.ValueType) upperVal));
-					if (!includeUpper && i == System.Int64.MinValue)
+					long i = (long)upperVal;
+					if (!includeUpper && i == long.MinValue)
 						return DocIdSet.EMPTY_DOCIDSET;
 					inclusiveUpperPoint = includeUpper?i:(i - 1L);
 				}
 				else
 				{
-					inclusiveUpperPoint = System.Int64.MaxValue;
+					inclusiveUpperPoint = long.MaxValue;
 				}
 				
 				if (inclusiveLowerPoint > inclusiveUpperPoint)
@@ -436,11 +445,11 @@ namespace Lucene.Net.Search
 			}
 		}
 		[Serializable]
-		private class AnonymousClassFieldCacheRangeFilter5:FieldCacheRangeFilter
+		private class AnonymousClassFieldCacheRangeFilter5 : FieldCacheRangeFilter<float?>
 		{
 			private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
 			{
-				private void  InitBlock(float[] values, float inclusiveLowerPoint, float inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter5 enclosingInstance)
+                private void InitBlock(float[] values, float inclusiveLowerPoint, float inclusiveUpperPoint, FieldCacheRangeFilter<float?> enclosingInstance)
 				{
 					this.values = values;
 					this.inclusiveLowerPoint = inclusiveLowerPoint;
@@ -450,8 +459,8 @@ namespace Lucene.Net.Search
 				private float[] values;
 				private float inclusiveLowerPoint;
 				private float inclusiveUpperPoint;
-				private AnonymousClassFieldCacheRangeFilter5 enclosingInstance;
-				public AnonymousClassFieldCacheRangeFilter5 Enclosing_Instance
+                private FieldCacheRangeFilter<float?> enclosingInstance;
+                public FieldCacheRangeFilter<float?> Enclosing_Instance
 				{
 					get
 					{
@@ -459,7 +468,8 @@ namespace Lucene.Net.Search
 					}
 					
 				}
-				internal AnonymousClassFieldCacheDocIdSet(float[] values, float inclusiveLowerPoint, float inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter5 enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2):base(Param1, Param2)
+                internal AnonymousClassFieldCacheDocIdSet(float[] values, float inclusiveLowerPoint, float inclusiveUpperPoint, FieldCacheRangeFilter<float?> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
+                    : base(Param1, Param2)
 				{
 					InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
 				}
@@ -468,7 +478,8 @@ namespace Lucene.Net.Search
 					return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
 				}
 			}
-			internal AnonymousClassFieldCacheRangeFilter5(System.String Param1, Lucene.Net.Search.Parser Param2, System.Object Param3, System.Object Param4, bool Param5, bool Param6):base(Param1, Param2, Param3, Param4, Param5, Param6)
+			internal AnonymousClassFieldCacheRangeFilter5(string field, Lucene.Net.Search.Parser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
+                : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
 			{
 			}
 			public override DocIdSet GetDocIdSet(IndexReader reader)
@@ -479,27 +490,27 @@ namespace Lucene.Net.Search
 				float inclusiveUpperPoint;
 				if (lowerVal != null)
 				{
-					float f = System.Convert.ToSingle(((System.ValueType) lowerVal));
-					if (!includeUpper && f > 0.0f && System.Single.IsInfinity(f))
+					float f = (float)lowerVal;
+					if (!includeUpper && f > 0.0f && float.IsInfinity(f))
 						return DocIdSet.EMPTY_DOCIDSET;
 					int i = NumericUtils.FloatToSortableInt(f);
 					inclusiveLowerPoint = NumericUtils.SortableIntToFloat(includeLower?i:(i + 1));
 				}
 				else
 				{
-					inclusiveLowerPoint = System.Single.NegativeInfinity;
+					inclusiveLowerPoint = float.NegativeInfinity;
 				}
 				if (upperVal != null)
 				{
-					float f = System.Convert.ToSingle(((System.ValueType) upperVal));
-					if (!includeUpper && f < 0.0f && System.Single.IsInfinity(f))
+				    float f = (float) upperVal;
+					if (!includeUpper && f < 0.0f && float.IsInfinity(f))
 						return DocIdSet.EMPTY_DOCIDSET;
 					int i = NumericUtils.FloatToSortableInt(f);
 					inclusiveUpperPoint = NumericUtils.SortableIntToFloat(includeUpper?i:(i - 1));
 				}
 				else
 				{
-					inclusiveUpperPoint = System.Single.PositiveInfinity;
+					inclusiveUpperPoint = float.PositiveInfinity;
 				}
 				
 				if (inclusiveLowerPoint > inclusiveUpperPoint)
@@ -511,11 +522,11 @@ namespace Lucene.Net.Search
 			}
 		}
 		[Serializable]
-		private class AnonymousClassFieldCacheRangeFilter6:FieldCacheRangeFilter
+		private class AnonymousClassFieldCacheRangeFilter6 : FieldCacheRangeFilter<double?>
 		{
 			private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
 			{
-				private void  InitBlock(double[] values, double inclusiveLowerPoint, double inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter6 enclosingInstance)
+                private void InitBlock(double[] values, double inclusiveLowerPoint, double inclusiveUpperPoint, FieldCacheRangeFilter<double?> enclosingInstance)
 				{
 					this.values = values;
 					this.inclusiveLowerPoint = inclusiveLowerPoint;
@@ -525,8 +536,8 @@ namespace Lucene.Net.Search
 				private double[] values;
 				private double inclusiveLowerPoint;
 				private double inclusiveUpperPoint;
-				private AnonymousClassFieldCacheRangeFilter6 enclosingInstance;
-				public AnonymousClassFieldCacheRangeFilter6 Enclosing_Instance
+                private FieldCacheRangeFilter<double?> enclosingInstance;
+                public FieldCacheRangeFilter<double?> Enclosing_Instance
 				{
 					get
 					{
@@ -534,7 +545,8 @@ namespace Lucene.Net.Search
 					}
 					
 				}
-				internal AnonymousClassFieldCacheDocIdSet(double[] values, double inclusiveLowerPoint, double inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter6 enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2):base(Param1, Param2)
+                internal AnonymousClassFieldCacheDocIdSet(double[] values, double inclusiveLowerPoint, double inclusiveUpperPoint, FieldCacheRangeFilter<double?> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
+                    : base(Param1, Param2)
 				{
 					InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
 				}
@@ -543,7 +555,8 @@ namespace Lucene.Net.Search
 					return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
 				}
 			}
-			internal AnonymousClassFieldCacheRangeFilter6(System.String Param1, Lucene.Net.Search.Parser Param2, System.Object Param3, System.Object Param4, bool Param5, bool Param6):base(Param1, Param2, Param3, Param4, Param5, Param6)
+			internal AnonymousClassFieldCacheRangeFilter6(string field, Lucene.Net.Search.Parser parser, double? lowerVal, double? upperVal, bool includeLower, bool includeUpper)
+                : base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
 			{
 			}
 			public override DocIdSet GetDocIdSet(IndexReader reader)
@@ -554,27 +567,27 @@ namespace Lucene.Net.Search
 				double inclusiveUpperPoint;
 				if (lowerVal != null)
 				{
-					double f = System.Convert.ToDouble(((System.ValueType) lowerVal));
-					if (!includeUpper && f > 0.0 && System.Double.IsInfinity(f))
+				    double f = (double) lowerVal;
+					if (!includeUpper && f > 0.0 && double.IsInfinity(f))
 						return DocIdSet.EMPTY_DOCIDSET;
 					long i = NumericUtils.DoubleToSortableLong(f);
-					inclusiveLowerPoint = NumericUtils.SortableLongToDouble(includeLower?i:(i + 1L));
+					inclusiveLowerPoint = NumericUtils.SortableLongToDouble(includeLower ? i : (i + 1L));
 				}
 				else
 				{
-					inclusiveLowerPoint = System.Double.NegativeInfinity;
+					inclusiveLowerPoint = double.NegativeInfinity;
 				}
 				if (upperVal != null)
 				{
-					double f = System.Convert.ToDouble(((System.ValueType) upperVal));
-					if (!includeUpper && f < 0.0 && System.Double.IsInfinity(f))
+				    double f = (double) upperVal;
+					if (!includeUpper && f < 0.0 && double.IsInfinity(f))
 						return DocIdSet.EMPTY_DOCIDSET;
 					long i = NumericUtils.DoubleToSortableLong(f);
 					inclusiveUpperPoint = NumericUtils.SortableLongToDouble(includeUpper?i:(i - 1L));
 				}
 				else
 				{
-					inclusiveUpperPoint = System.Double.PositiveInfinity;
+					inclusiveUpperPoint = double.PositiveInfinity;
 				}
 				
 				if (inclusiveLowerPoint > inclusiveUpperPoint)
@@ -587,12 +600,12 @@ namespace Lucene.Net.Search
 		}
 		internal System.String field;
 		internal Lucene.Net.Search.Parser parser;
-		internal System.Object lowerVal;
-		internal System.Object upperVal;
+		internal T lowerVal;
+		internal T upperVal;
 		internal bool includeLower;
 		internal bool includeUpper;
 		
-		private FieldCacheRangeFilter(System.String field, Lucene.Net.Search.Parser parser, System.Object lowerVal, System.Object upperVal, bool includeLower, bool includeUpper)
+		private FieldCacheRangeFilter(System.String field, Lucene.Net.Search.Parser parser, T lowerVal, T upperVal, bool includeLower, bool includeUpper)
 		{
 			this.field = field;
 			this.parser = parser;
@@ -605,29 +618,29 @@ namespace Lucene.Net.Search
 		/// <summary>This method is implemented for each data type </summary>
 		public abstract override DocIdSet GetDocIdSet(IndexReader reader);
 		
-		/// <summary> Creates a string range query using <see cref="FieldCache.GetStringIndex(IndexReader,string)" />. This works with all
+		/// <summary> Creates a string range filter using <see cref="FieldCache.GetStringIndex(IndexReader,string)" />. This works with all
 		/// fields containing zero or one term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-		public static FieldCacheRangeFilter NewStringRange(System.String field, System.String lowerVal, System.String upperVal, bool includeLower, bool includeUpper)
+		public static FieldCacheRangeFilter<string> NewStringRange(string field, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
 		{
 			return new AnonymousClassFieldCacheRangeFilter(field, null, lowerVal, upperVal, includeLower, includeUpper);
 		}
 		
-		/// <summary> Creates a numeric range query using <see cref="FieldCache.GetBytes(IndexReader,String)" />. This works with all
+		/// <summary> Creates a numeric range filter using <see cref="FieldCache.GetBytes(IndexReader,String)" />. This works with all
 		/// byte fields containing exactly one numeric term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-		public static FieldCacheRangeFilter NewByteRange(System.String field, System.Byte lowerVal, System.Byte upperVal, bool includeLower, bool includeUpper)
+		public static FieldCacheRangeFilter<byte?> NewByteRange(string field, byte? lowerVal, byte? upperVal, bool includeLower, bool includeUpper)
 		{
 			return NewByteRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
 		}
 		
-		/// <summary> Creates a numeric range query using <see cref="FieldCache.GetBytes(IndexReader,String,ByteParser)" />. This works with all
+		/// <summary> Creates a numeric range filter using <see cref="FieldCache.GetBytes(IndexReader,String,ByteParser)" />. This works with all
 		/// byte fields containing exactly one numeric term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-		public static FieldCacheRangeFilter NewByteRange(System.String field, Lucene.Net.Search.ByteParser parser, System.Byte lowerVal, System.Byte upperVal, bool includeLower, bool includeUpper)
+		public static FieldCacheRangeFilter<byte?> NewByteRange(string field, Lucene.Net.Search.ByteParser parser, byte? lowerVal, byte? upperVal, bool includeLower, bool includeUpper)
 		{
 			return new AnonymousClassFieldCacheRangeFilter1(field, parser, lowerVal, upperVal, includeLower, includeUpper);
 		}
@@ -636,7 +649,7 @@ namespace Lucene.Net.Search
 		/// short fields containing exactly one numeric term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-		public static FieldCacheRangeFilter NewShortRange(System.String field, System.ValueType lowerVal, System.ValueType upperVal, bool includeLower, bool includeUpper)
+		public static FieldCacheRangeFilter<short?> NewShortRange(string field, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
 		{
 			return NewShortRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
 		}
@@ -645,7 +658,7 @@ namespace Lucene.Net.Search
 		/// short fields containing exactly one numeric term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-		public static FieldCacheRangeFilter NewShortRange(System.String field, Lucene.Net.Search.ShortParser parser, System.ValueType lowerVal, System.ValueType upperVal, bool includeLower, bool includeUpper)
+        public static FieldCacheRangeFilter<short?> NewShortRange(string field, Lucene.Net.Search.ShortParser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
 		{
 			return new AnonymousClassFieldCacheRangeFilter2(field, parser, lowerVal, upperVal, includeLower, includeUpper);
 		}
@@ -654,7 +667,7 @@ namespace Lucene.Net.Search
 		/// int fields containing exactly one numeric term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-        public static FieldCacheRangeFilter NewIntRange(System.String field, System.ValueType lowerVal, System.ValueType upperVal, bool includeLower, bool includeUpper)
+        public static FieldCacheRangeFilter<int?> NewIntRange(string field, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
 		{
 			return NewIntRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
 		}
@@ -663,7 +676,7 @@ namespace Lucene.Net.Search
 		/// int fields containing exactly one numeric term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-		public static FieldCacheRangeFilter NewIntRange(System.String field, Lucene.Net.Search.IntParser parser, System.ValueType lowerVal, System.ValueType upperVal, bool includeLower, bool includeUpper)
+        public static FieldCacheRangeFilter<int?> NewIntRange(string field, Lucene.Net.Search.IntParser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
 		{
 			return new AnonymousClassFieldCacheRangeFilter3(field, parser, lowerVal, upperVal, includeLower, includeUpper);
 		}
@@ -672,7 +685,7 @@ namespace Lucene.Net.Search
 		/// long fields containing exactly one numeric term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-		public static FieldCacheRangeFilter NewLongRange(System.String field, System.ValueType lowerVal, System.ValueType upperVal, bool includeLower, bool includeUpper)
+		public static FieldCacheRangeFilter<long?> NewLongRange(string field, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
 		{
 			return NewLongRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
 		}
@@ -681,7 +694,7 @@ namespace Lucene.Net.Search
 		/// long fields containing exactly one numeric term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-		public static FieldCacheRangeFilter NewLongRange(System.String field, Lucene.Net.Search.LongParser parser, System.ValueType lowerVal, System.ValueType upperVal, bool includeLower, bool includeUpper)
+		public static FieldCacheRangeFilter<long?> NewLongRange(string field, Lucene.Net.Search.LongParser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
 		{
 			return new AnonymousClassFieldCacheRangeFilter4(field, parser, lowerVal, upperVal, includeLower, includeUpper);
 		}
@@ -690,7 +703,7 @@ namespace Lucene.Net.Search
 		/// float fields containing exactly one numeric term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-		public static FieldCacheRangeFilter NewFloatRange(System.String field, System.ValueType lowerVal, System.ValueType upperVal, bool includeLower, bool includeUpper)
+        public static FieldCacheRangeFilter<float?> NewFloatRange(string field, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
 		{
 			return NewFloatRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
 		}
@@ -699,7 +712,7 @@ namespace Lucene.Net.Search
 		/// float fields containing exactly one numeric term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-		public static FieldCacheRangeFilter NewFloatRange(System.String field, Lucene.Net.Search.FloatParser parser, System.ValueType lowerVal, System.ValueType upperVal, bool includeLower, bool includeUpper)
+        public static FieldCacheRangeFilter<float?> NewFloatRange(string field, Lucene.Net.Search.FloatParser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
 		{
 			return new AnonymousClassFieldCacheRangeFilter5(field, parser, lowerVal, upperVal, includeLower, includeUpper);
 		}
@@ -708,7 +721,7 @@ namespace Lucene.Net.Search
 		/// double fields containing exactly one numeric term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-		public static FieldCacheRangeFilter NewDoubleRange(System.String field, System.ValueType lowerVal, System.ValueType upperVal, bool includeLower, bool includeUpper)
+        public static FieldCacheRangeFilter<double?> NewDoubleRange(string field, double? lowerVal, double? upperVal, bool includeLower, bool includeUpper)
 		{
 			return NewDoubleRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
 		}
@@ -717,7 +730,7 @@ namespace Lucene.Net.Search
 		/// double fields containing exactly one numeric term in the field. The range can be half-open by setting one
 		/// of the values to <c>null</c>.
 		/// </summary>
-		public static FieldCacheRangeFilter NewDoubleRange(System.String field, Lucene.Net.Search.DoubleParser parser, System.ValueType lowerVal, System.ValueType upperVal, bool includeLower, bool includeUpper)
+        public static FieldCacheRangeFilter<double?> NewDoubleRange(string field, Lucene.Net.Search.DoubleParser parser, double? lowerVal, double? upperVal, bool includeLower, bool includeUpper)
 		{
 			return new AnonymousClassFieldCacheRangeFilter6(field, parser, lowerVal, upperVal, includeLower, includeUpper);
 		}
@@ -732,19 +745,19 @@ namespace Lucene.Net.Search
 		{
 			if (this == o)
 				return true;
-			if (!(o is FieldCacheRangeFilter))
+			if (!(o is FieldCacheRangeFilter<T>))
 				return false;
-			FieldCacheRangeFilter other = (FieldCacheRangeFilter) o;
+			FieldCacheRangeFilter<T> other = (FieldCacheRangeFilter<T>) o;
 			
 			if (!this.field.Equals(other.field) || this.includeLower != other.includeLower || this.includeUpper != other.includeUpper)
 			{
 				return false;
 			}
-			if (this.lowerVal != null?!this.lowerVal.Equals(other.lowerVal):other.lowerVal != null)
+			if (this.lowerVal != null ?! this.lowerVal.Equals(other.lowerVal):other.lowerVal != null)
 				return false;
-			if (this.upperVal != null?!this.upperVal.Equals(other.upperVal):other.upperVal != null)
+			if (this.upperVal != null ?! this.upperVal.Equals(other.upperVal):other.upperVal != null)
 				return false;
-			if (this.parser != null?!this.parser.Equals(other.parser):other.parser != null)
+			if (this.parser != null ?! this.parser.Equals(other.parser):other.parser != null)
 				return false;
 			return true;
 		}
@@ -760,9 +773,36 @@ namespace Lucene.Net.Search
 			return h;
 		}
 		
+        /// <summary>
+        /// Returns the field name for this filter
+        /// </summary>
+        public string GetField { get { return field; } }
+
+        /// <summary>
+        /// Returns <c>true</c> if the lower endpoint is inclusive
+        /// </summary>
+        public bool IncludesLower { get { return includeLower; } }
+
+        /// <summary>
+        /// Returns <c>true</c> if the upper endpoint is inclusive
+        /// </summary>
+        public bool IncludesUpper { get { return includeUpper; } }
+
+        /// <summary>
+        /// Returns the lower value of the range filter
+        /// </summary>
+	    public T LowerValue { get { return lowerVal; } }
+
+        /// <summary>
+        /// Returns the upper value of this range filter
+        /// </summary>
+        public T UpperValue { get { return upperVal; } }
+
+        public Parser Parser { get { return parser; } }
+
 		internal abstract class FieldCacheDocIdSet:DocIdSet
 		{
-			private class AnonymousClassDocIdSetIterator:DocIdSetIterator
+			private class AnonymousClassDocIdSetIterator : DocIdSetIterator
 			{
 				public AnonymousClassDocIdSetIterator(Lucene.Net.Index.TermDocs termDocs, FieldCacheDocIdSet enclosingInstance)
 				{
@@ -785,29 +825,6 @@ namespace Lucene.Net.Search
 				}
 				private int doc = - 1;
 				
-				// @deprecated use <see cref="NextDoc()" /> instead.
-                [Obsolete("Lucene.Net-2.9.1. This method overrides obsolete member Lucene.Net.Search.DocIdSetIterator.Next()")]
-				public override bool Next()
-				{
-					return NextDoc() != NO_MORE_DOCS;
-				}
-				
-				/// <deprecated> use <see cref="Advance(int)" /> instead. 
-				/// </deprecated>
-                [Obsolete("use Advance(int) instead.")]
-				public override bool SkipTo(int target)
-				{
-					return Advance(target) != NO_MORE_DOCS;
-				}
-				
-				/// <deprecated> use <see cref="DocID()" /> instead. 
-				/// </deprecated>
-                [Obsolete("use DocID() instead.")]
-				public override int Doc()
-				{
-					return termDocs.Doc();
-				}
-				
 				public override int DocID()
 				{
 					return doc;
@@ -857,30 +874,6 @@ namespace Lucene.Net.Search
 				}
 				private int doc = - 1;
 				
-				/// <deprecated> use <see cref="NextDoc()" /> instead. 
-				/// </deprecated>
-                [Obsolete("use NextDoc() instead.")]
-				public override bool Next()
-				{
-					return NextDoc() != NO_MORE_DOCS;
-				}
-				
-				/// <deprecated> use <see cref="Advance(int)" /> instead. 
-				/// </deprecated>
-                [Obsolete("use Advance(int) instead.")]
-				public override bool SkipTo(int target)
-				{
-					return Advance(target) != 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;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheTermsFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheTermsFilter.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheTermsFilter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheTermsFilter.cs Wed Nov  9 21:03:47 2011
@@ -99,7 +99,7 @@ namespace Lucene.Net.Search
 		private System.String field;
 		private System.String[] terms;
 		
-		public FieldCacheTermsFilter(System.String field, System.String[] terms)
+		public FieldCacheTermsFilter(System.String field, params System.String[] terms)
 		{
 			this.field = field;
 			this.terms = terms;
@@ -181,27 +181,11 @@ namespace Lucene.Net.Search
 				}
 				private int doc = - 1;
 				
-				/// <deprecated> use <see cref="DocID()" /> instead. 
-				/// </deprecated>
-                [Obsolete("use DocID() instead.")]
-				public override int Doc()
-				{
-					return doc;
-				}
-				
 				public override int DocID()
 				{
 					return doc;
 				}
 				
-				/// <deprecated> use <see cref="NextDoc()" /> instead. 
-				/// </deprecated>
-                [Obsolete("use NextDoc() instead.")]
-				public override bool Next()
-				{
-					return NextDoc() != NO_MORE_DOCS;
-				}
-				
 				public override int NextDoc()
 				{
 					try
@@ -217,14 +201,6 @@ namespace Lucene.Net.Search
 					return doc;
 				}
 				
-				/// <deprecated> use <see cref="Advance(int)" /> instead. 
-				/// </deprecated>
-                [Obsolete("use Advance(int) instead.")]
-				public override bool SkipTo(int target)
-				{
-					return Advance(target) != NO_MORE_DOCS;
-				}
-				
 				public override int Advance(int target)
 				{
 					try

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldDocSortedHitQueue.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldDocSortedHitQueue.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldDocSortedHitQueue.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldDocSortedHitQueue.cs Wed Nov  9 21:03:47 2011
@@ -16,8 +16,7 @@
  */
 
 using System;
-
-using PriorityQueue = Lucene.Net.Util.PriorityQueue;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Search
 {
@@ -30,14 +29,9 @@ namespace Lucene.Net.Search
 	/// </summary>
 	/// <since>   lucene 1.4
 	/// </since>
-	/// <version>  $Id: FieldDocSortedHitQueue.java 695514 2008-09-15 15:42:11Z otis $
-	/// </version>
-	class FieldDocSortedHitQueue:PriorityQueue
+	class FieldDocSortedHitQueue : PriorityQueue<FieldDoc>
 	{
-		
-		// this cannot contain AUTO fields - any AUTO fields should
-		// have been resolved by the time this class is used.
-		internal volatile SortField[] fields;
+		internal volatile SortField[] fields = null;
 		
 		// used in the case where the fields are sorted by locale
 		// based strings
@@ -45,14 +39,9 @@ namespace Lucene.Net.Search
 		
 		
 		/// <summary> Creates a hit queue sorted by the given list of fields.</summary>
-		/// <param name="fields">Fieldable names, in priority order (highest priority first).
-		/// </param>
-		/// <param name="size"> The number of hits to retain.  Must be greater than zero.
-		/// </param>
-		internal FieldDocSortedHitQueue(SortField[] fields, int size)
+		/// <param name="size">The number of hits to retain.  Must be greater than zero.</param>
+		internal FieldDocSortedHitQueue(int size)
 		{
-			this.fields = fields;
-			this.collators = HasCollators(fields);
 			Initialize(size);
 		}
 		
@@ -63,35 +52,28 @@ namespace Lucene.Net.Search
 		/// type until the values come back.  The fields can only be set once.
 		/// This method is thread safe.
 		/// </summary>
-		/// <param name="fields">
-		/// </param>
+		/// <param name="fields"></param>
 		internal virtual void  SetFields(SortField[] fields)
 		{
-			lock (this)
+            lock (this)
 			{
-				if (this.fields == null)
-				{
-					this.fields = fields;
-					this.collators = HasCollators(fields);
-				}
+				this.fields = fields;
+				this.collators = HasCollators(fields);
 			}
 		}
-		
-		
-		/// <summary>Returns the fields being used to sort. </summary>
-		internal virtual SortField[] GetFields()
-		{
-			return fields;
-		}
-		
-		
+
+        /// <summary>Returns the fields being used to sort. </summary>
+        internal virtual SortField[] GetFields()
+        {
+            return fields;
+        }
+
+
 		/// <summary>Returns an array of collators, possibly <c>null</c>.  The collators
 		/// correspond to any SortFields which were given a specific locale.
 		/// </summary>
-		/// <param name="fields">Array of sort fields.
-		/// </param>
-		/// <returns> Array, possibly <c>null</c>.
-		/// </returns>
+		/// <param name="fields">Array of sort fields.</param>
+		/// <returns> Array, possibly <c>null</c>.</returns>
 		private System.Globalization.CompareInfo[] HasCollators(SortField[] fields)
 		{
 			if (fields == null)
@@ -108,135 +90,48 @@ namespace Lucene.Net.Search
 		
 		
 		/// <summary> Returns whether <c>a</c> is less relevant than <c>b</c>.</summary>
-		/// <param name="a">ScoreDoc
-		/// </param>
-		/// <param name="b">ScoreDoc
-		/// </param>
-		/// <returns> <c>true</c> if document <c>a</c> should be sorted after document <c>b</c>.
-		/// </returns>
-		public override bool LessThan(System.Object a, System.Object b)
+        /// <param name="docA">ScoreDoc</param>
+        /// <param name="docB">ScoreDoc</param>
+		/// <returns><c>true</c> if document <c>a</c> should be sorted after document <c>b</c>.</returns>
+        public override bool LessThan(FieldDoc docA, FieldDoc docB)
 		{
-			FieldDoc docA = (FieldDoc) a;
-			FieldDoc docB = (FieldDoc) b;
 			int n = fields.Length;
 			int c = 0;
 			for (int i = 0; i < n && c == 0; ++i)
 			{
 				int type = fields[i].GetType();
-				switch (type)
+				if(type == SortField.STRING)
 				{
-					
-					case SortField.SCORE:  {
-							float r1 = (float) ((System.Single) docA.fields[i]);
-							float r2 = (float) ((System.Single) docB.fields[i]);
-							if (r1 > r2)
-								c = - 1;
-							if (r1 < r2)
-								c = 1;
-							break;
-						}
-					
-					case SortField.DOC: 
-					case SortField.INT:  {
-							int i1 = ((System.Int32) docA.fields[i]);
-							int i2 = ((System.Int32) docB.fields[i]);
-							if (i1 < i2)
-								c = - 1;
-							if (i1 > i2)
-								c = 1;
-							break;
-						}
-					
-					case SortField.LONG:  {
-							long l1 = (long) ((System.Int64) docA.fields[i]);
-							long l2 = (long) ((System.Int64) docB.fields[i]);
-							if (l1 < l2)
-								c = - 1;
-							if (l1 > l2)
-								c = 1;
-							break;
-						}
-					
-					case SortField.STRING:  {
-							System.String s1 = (System.String) docA.fields[i];
-							System.String s2 = (System.String) docB.fields[i];
-							// null values need to be sorted first, because of how FieldCache.getStringIndex()
-							// works - in that routine, any documents without a value in the given field are
-							// put first.  If both are null, the next SortField is used
-							if (s1 == null)
-								c = (s2 == null)?0:- 1;
-							else if (s2 == null)
-								c = 1;
-							// 
-							else if (fields[i].GetLocale() == null)
-							{
-								c = String.CompareOrdinal(s1, s2);
-							}
-							else
-							{
-								c = collators[i].Compare(s1.ToString(), s2.ToString());
-							}
-							break;
-						}
-					
-					case SortField.FLOAT:  {
-							float f1 = (float) ((System.Single) docA.fields[i]);
-							float f2 = (float) ((System.Single) docB.fields[i]);
-							if (f1 < f2)
-								c = - 1;
-							if (f1 > f2)
-								c = 1;
-							break;
-						}
-					
-					case SortField.DOUBLE:  {
-							double d1 = ((System.Double) docA.fields[i]);
-							double d2 = ((System.Double) docB.fields[i]);
-							if (d1 < d2)
-								c = - 1;
-							if (d1 > d2)
-								c = 1;
-							break;
-						}
-					
-					case SortField.BYTE:  {
-							int i1 = (sbyte) ((System.SByte) docA.fields[i]);
-							int i2 = (sbyte) ((System.SByte) docB.fields[i]);
-							if (i1 < i2)
-								c = - 1;
-							if (i1 > i2)
-								c = 1;
-							break;
-						}
-					
-					case SortField.SHORT:  {
-							int i1 = (short) ((System.Int16) docA.fields[i]);
-							int i2 = (short) ((System.Int16) docB.fields[i]);
-							if (i1 < i2)
-								c = - 1;
-							if (i1 > i2)
-								c = 1;
-							break;
-						}
-					
-					case SortField.CUSTOM:  {
-							c = docA.fields[i].CompareTo(docB.fields[i]);
-							break;
-						}
-					
-					case SortField.AUTO:  {
-							// we cannot handle this - even if we determine the type of object (Float or
-							// Integer), we don't necessarily know how to compare them (both SCORE and
-							// FLOAT contain floats, but are sorted opposite of each other). Before
-							// we get here, each AUTO should have been replaced with its actual value.
-							throw new System.SystemException("FieldDocSortedHitQueue cannot use an AUTO SortField");
-						}
-					
-					default:  {
-							throw new System.SystemException("invalid SortField type: " + type);
-						}
-					
-				}
+				    string s1 = (string) docA.fields[i];
+                    string s2 = (string) docB.fields[i];
+                    // null values need to be sorted first, because of how FieldCache.getStringIndex()
+                    // works - in that routine, any documents without a value in the given field are
+                    // put first.  If both are null, the next SortField is used
+                    if (s1 == null)
+                    {
+                        c = (s2 == null) ? 0 : -1;
+                    }
+                    else if (s2 == null)
+                    {
+                        c = 1;
+                    }
+                    else if (fields[i].GetLocale() == null)
+                    {
+                        c = s1.CompareTo(s2);
+                    }
+                    else
+                    {
+                        c = collators[i].Compare(s1, s2);
+                    }
+                }
+                else
+                {
+                    c = docA.fields[i].CompareTo(docB.fields[i]);
+                    if (type == SortField.SCORE)
+                    {
+                        c = -c;
+                    }
+                }
 				if (fields[i].GetReverse())
 				{
 					c = - c;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldValueHitQueue.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldValueHitQueue.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldValueHitQueue.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldValueHitQueue.cs Wed Nov  9 21:03:47 2011
@@ -16,8 +16,7 @@
  */
 
 using System;
-
-using PriorityQueue = Lucene.Net.Util.PriorityQueue;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Search
 {
@@ -26,11 +25,6 @@ namespace Lucene.Net.Search
 	/// Uses <c>FieldCache.DEFAULT</c> for maintaining
 	/// internal term lookup tables.
 	/// 
-	/// This class will not resolve SortField.AUTO types, and expects the type
-	/// of all SortFields used for construction to already have been resolved. 
-	/// <see cref="SortField.DetectFieldType(Lucene.Net.Index.IndexReader, String)" /> is a utility method which
-	/// may be used for field type detection.
-	/// 
 	/// <b>NOTE:</b> This API is experimental and might change in
 	/// incompatible ways in the next release.
 	/// 
@@ -43,32 +37,30 @@ namespace Lucene.Net.Search
 	/// </seealso>
 	/// <seealso cref="FieldCache">
 	/// </seealso>
-	public abstract class FieldValueHitQueue:PriorityQueue
+	public abstract class FieldValueHitQueue : PriorityQueue<FieldValueHitQueue.Entry>
 	{
-		
-		internal sealed class Entry
+        // had to change from internal to public, due to public accessability of FieldValueHitQueue
+		public /*internal*/ sealed class Entry : ScoreDoc
 		{
 			internal int slot;
-			internal int docID;
-			internal float score;
-			
-			internal Entry(int slot, int docID, float score)
+
+            internal Entry(int slot, int doc, float score)
+                : base(doc, score)
 			{
+			    
 				this.slot = slot;
-				this.docID = docID;
-				this.score = score;
 			}
 			
 			public override System.String ToString()
 			{
-				return "slot:" + slot + " docID:" + docID + " score=" + score;
+				return "slot:" + slot + " " + base.ToString();
 			}
 		}
 		
 		/// <summary> An implementation of <see cref="FieldValueHitQueue" /> which is optimized in case
 		/// there is just one comparator.
 		/// </summary>
-		private sealed class OneComparatorFieldValueHitQueue:FieldValueHitQueue
+		private sealed class OneComparatorFieldValueHitQueue : FieldValueHitQueue
 		{
 			
 			private FieldComparator comparator;
@@ -82,8 +74,6 @@ namespace Lucene.Net.Search
 				}
 				
 				SortField field = fields[0];
-				// AUTO is resolved before we are called
-				System.Diagnostics.Debug.Assert(field.GetType() != SortField.AUTO);
 				comparator = field.GetComparator(size, 0);
 				oneReverseMul = field.reverse?- 1:1;
 				
@@ -100,11 +90,8 @@ namespace Lucene.Net.Search
 			/// </param>
 			/// <returns> <c>true</c> if document <c>a</c> should be sorted after document <c>b</c>.
 			/// </returns>
-			public override bool LessThan(System.Object a, System.Object b)
+            public override bool LessThan(Entry hitA, Entry hitB)
 			{
-				Entry hitA = (Entry) a;
-				Entry hitB = (Entry) b;
-				
 				System.Diagnostics.Debug.Assert(hitA != hitB);
 				System.Diagnostics.Debug.Assert(hitA.slot != hitB.slot);
 				
@@ -115,14 +102,14 @@ namespace Lucene.Net.Search
 				}
 				
 				// avoid random sort order that could lead to duplicates (bug #31241):
-				return hitA.docID > hitB.docID;
+                return hitA.doc > hitB.doc;
 			}
 		}
 		
 		/// <summary> An implementation of <see cref="FieldValueHitQueue" /> which is optimized in case
 		/// there is more than one comparator.
 		/// </summary>
-		private sealed class MultiComparatorsFieldValueHitQueue:FieldValueHitQueue
+		private sealed class MultiComparatorsFieldValueHitQueue : FieldValueHitQueue
 		{
 			
 			public MultiComparatorsFieldValueHitQueue(SortField[] fields, int size):base(fields)
@@ -142,12 +129,9 @@ namespace Lucene.Net.Search
 				
 				Initialize(size);
 			}
-			
-			public override bool LessThan(System.Object a, System.Object b)
+
+            public override bool LessThan(Entry hitA, Entry hitB)
 			{
-				Entry hitA = (Entry) a;
-				Entry hitB = (Entry) b;
-				
 				System.Diagnostics.Debug.Assert(hitA != hitB);
 				System.Diagnostics.Debug.Assert(hitA.slot != hitB.slot);
 				
@@ -163,7 +147,7 @@ namespace Lucene.Net.Search
 				}
 				
 				// avoid random sort order that could lead to duplicates (bug #31241):
-				return hitA.docID > hitB.docID;
+                return hitA.doc > hitB.doc;
 			}
 		}
 		
@@ -226,8 +210,8 @@ namespace Lucene.Net.Search
 		protected internal SortField[] fields;
 		protected internal FieldComparator[] comparators;
 		protected internal int[] reverseMul;
-		
-		public abstract override bool LessThan(System.Object a, System.Object b);
+
+        public abstract override bool LessThan(Entry a, Entry b);
 		
 		/// <summary> Given a queue Entry, creates a corresponding FieldDoc
 		/// that contains the values used to sort the given document.
@@ -251,7 +235,7 @@ namespace Lucene.Net.Search
 				fields[i] = comparators[i].Value(entry.slot);
 			}
 			//if (maxscore > 1.0f) doc.score /= maxscore;   // normalize scores
-			return new FieldDoc(entry.docID, entry.score, fields);
+			return new FieldDoc(entry.doc, entry.score, fields);
 		}
 		
 		/// <summary>Returns the SortFields being used by this hit queue. </summary>

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FilteredDocIdSetIterator.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FilteredDocIdSetIterator.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FilteredDocIdSetIterator.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FilteredDocIdSetIterator.cs Wed Nov  9 21:03:47 2011
@@ -52,27 +52,11 @@ namespace Lucene.Net.Search
 		/// </seealso>
 		public abstract /*protected internal*/ bool Match(int doc);
 		
-		/// <deprecated> use <see cref="DocID()" /> instead. 
-		/// </deprecated>
-        [Obsolete("use DocID() instead.")]
-		public override int Doc()
-		{
-			return doc;
-		}
-		
 		public override int DocID()
 		{
 			return doc;
 		}
 		
-		/// <deprecated> use <see cref="NextDoc()" /> instead. 
-		/// </deprecated>
-        [Obsolete("use NextDoc() instead.")]
-		public override bool Next()
-		{
-			return NextDoc() != NO_MORE_DOCS;
-		}
-		
 		public override int NextDoc()
 		{
 			while ((doc = _innerIter.NextDoc()) != NO_MORE_DOCS)
@@ -85,14 +69,6 @@ namespace Lucene.Net.Search
 			return doc;
 		}
 		
-		/// <deprecated> use <see cref="Advance(int)" /> instead. 
-		/// </deprecated>
-        [Obsolete("use Advance(int) instead. ")]
-		public override bool SkipTo(int n)
-		{
-			return Advance(n) != NO_MORE_DOCS;
-		}
-		
 		public override int Advance(int target)
 		{
 			doc = _innerIter.Advance(target);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FilteredQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FilteredQuery.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FilteredQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FilteredQuery.cs Wed Nov  9 21:03:47 2011
@@ -16,7 +16,7 @@
  */
 
 using System;
-
+using Lucene.Net.Index;
 using IndexReader = Lucene.Net.Index.IndexReader;
 using ToStringUtils = Lucene.Net.Util.ToStringUtils;
 
@@ -33,12 +33,8 @@ namespace Lucene.Net.Search
 	/// <p/>Created: Apr 20, 2004 8:58:29 AM
 	/// 
 	/// </summary>
-	/// <since>   1.4
-	/// </since>
-	/// <version>  $Id: FilteredQuery.java 807821 2009-08-25 21:55:49Z mikemccand $
-	/// </version>
-	/// <seealso cref="CachingWrapperFilter">
-	/// </seealso>
+	/// <since>1.4</since>
+	/// <seealso cref="CachingWrapperFilter"/>
 	[Serializable]
 	public class FilteredQuery:Query
 	{
@@ -91,40 +87,16 @@ namespace Lucene.Net.Search
 					return scorerDoc;
 				}
 				
-				/// <deprecated> use <see cref="NextDoc()" /> instead. 
-				/// </deprecated>
-                [Obsolete("use NextDoc() instead. ")]
-				public override bool Next()
-				{
-					return NextDoc() != NO_MORE_DOCS;
-				}
-				
 				public override int NextDoc()
 				{
 					int scorerDoc, disiDoc;
 					return doc = (disiDoc = docIdSetIterator.NextDoc()) != NO_MORE_DOCS && (scorerDoc = scorer.NextDoc()) != NO_MORE_DOCS && AdvanceToCommon(scorerDoc, disiDoc) != NO_MORE_DOCS?scorer.DocID():NO_MORE_DOCS;
 				}
-				
-				/// <deprecated> use <see cref="DocID()" /> instead. 
-				/// </deprecated>
-                [Obsolete("use DocID() instead.")]
-				public override int Doc()
-				{
-					return scorer.Doc();
-				}
 				public override int DocID()
 				{
 					return doc;
 				}
 				
-				/// <deprecated> use <see cref="Advance(int)" /> instead. 
-				/// </deprecated>
-                [Obsolete("use Advance(int) instead.")]
-				public override bool SkipTo(int i)
-				{
-					return Advance(i) != NO_MORE_DOCS;
-				}
-				
 				public override int Advance(int target)
 				{
 					int disiDoc, scorerDoc;
@@ -135,24 +107,6 @@ namespace Lucene.Net.Search
 				{
 					return Enclosing_Instance.Enclosing_Instance.GetBoost() * scorer.Score();
 				}
-				
-				// add an explanation about whether the document was filtered
-				public override Explanation Explain(int i)
-				{
-					Explanation exp = scorer.Explain(i);
-					
-					if (docIdSetIterator.Advance(i) == i)
-					{
-						exp.SetDescription("allowed by filter: " + exp.GetDescription());
-						exp.SetValue(Enclosing_Instance.Enclosing_Instance.GetBoost() * exp.GetValue());
-					}
-					else
-					{
-						exp.SetDescription("removed by filter: " + exp.GetDescription());
-						exp.SetValue(0.0f);
-					}
-					return exp;
-				}
 			}
 			private void  InitBlock(Lucene.Net.Search.Weight weight, Lucene.Net.Search.Similarity similarity, FilteredQuery enclosingInstance)
 			{
@@ -298,7 +252,7 @@ namespace Lucene.Net.Search
 		}
 		
 		// inherit javadoc
-		public override void  ExtractTerms(System.Collections.Hashtable terms)
+		public override void  ExtractTerms(System.Collections.Generic.ISet<Term> terms)
 		{
 			GetQuery().ExtractTerms(terms);
 		}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Function/CustomScoreQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Function/CustomScoreQuery.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Function/CustomScoreQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Function/CustomScoreQuery.cs Wed Nov  9 21:03:47 2011
@@ -16,7 +16,8 @@
  */
 
 using System;
-
+using System.Linq;
+using Lucene.Net.Index;
 using IndexReader = Lucene.Net.Index.IndexReader;
 using ToStringUtils = Lucene.Net.Util.ToStringUtils;
 using ComplexExplanation = Lucene.Net.Search.ComplexExplanation;
@@ -79,7 +80,7 @@ namespace Lucene.Net.Search.Function
 		/// <see cref="Lucene.Net.Search.Function.FieldScoreQuery">FieldScoreQueries</see>.
 		/// This parameter is optional - it can be null or even an empty array.
 		/// </param>
-		public CustomScoreQuery(Query subQuery, ValueSourceQuery[] valSrcQueries)
+		public CustomScoreQuery(Query subQuery, params ValueSourceQuery[] valSrcQueries)
 		{
 			this.subQuery = subQuery;
 			this.valSrcQueries = valSrcQueries != null?valSrcQueries:new ValueSourceQuery[0];
@@ -113,7 +114,7 @@ namespace Lucene.Net.Search.Function
         }
 		
 		/*(non-Javadoc) <see cref="Lucene.Net.Search.Query.extractTerms(java.util.Set) */
-		public override void  ExtractTerms(System.Collections.Hashtable terms)
+		public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
 		{
 			subQuery.ExtractTerms(terms);
 			for (int i = 0; i < valSrcQueries.Length; i++)
@@ -164,15 +165,9 @@ namespace Lucene.Net.Search.Function
             {
                 return false;
             }
-			for (int i = 0; i < valSrcQueries.Length; i++)
-			{
-				//TODO simplify with Arrays.deepEquals() once moving to Java 1.5
-				if (!valSrcQueries[i].Equals(other.valSrcQueries[i]))
-				{
-					return false;
-				}
-			}
-			return true;
+
+            // SequenceEqual should properly mimic java's Array.equals()
+		    return valSrcQueries.SequenceEqual(other.valSrcQueries);
 		}
 		
 		/// <summary>Returns a hash code value for this object. </summary>
@@ -181,7 +176,7 @@ namespace Lucene.Net.Search.Function
 			int valSrcHash = 0;
 			for (int i = 0; i < valSrcQueries.Length; i++)
 			{
-				//TODO simplify with Arrays.deepHashcode() once moving to Java 1.5
+				// TODO: Simplify this hash code generation
 				valSrcHash += valSrcQueries[i].GetHashCode();
 			}
             return (GetType().GetHashCode() + subQuery.GetHashCode() + valSrcHash) ^
@@ -438,21 +433,16 @@ namespace Lucene.Net.Search.Function
 			
 			private Explanation DoExplain(IndexReader reader, int doc)
 			{
-				Scorer[] valSrcScorers = new Scorer[valSrcWeights.Length];
-				for (int i = 0; i < valSrcScorers.Length; i++)
-				{
-					valSrcScorers[i] = valSrcWeights[i].Scorer(reader, true, false);
-				}
 				Explanation subQueryExpl = subQueryWeight.Explain(reader, doc);
 				if (!subQueryExpl.IsMatch())
 				{
 					return subQueryExpl;
 				}
 				// match
-				Explanation[] valSrcExpls = new Explanation[valSrcScorers.Length];
-				for (int i = 0; i < valSrcScorers.Length; i++)
+				Explanation[] valSrcExpls = new Explanation[valSrcWeights.Length];
+                for (int i = 0; i < valSrcWeights.Length; i++)
 				{
-					valSrcExpls[i] = valSrcScorers[i].Explain(doc);
+                    valSrcExpls[i] = valSrcWeights[i].Explain(reader, doc);
 				}
                 Explanation customExp = Enclosing_Instance.GetCustomScoreProvider(reader).CustomExplain(doc, subQueryExpl, valSrcExpls);
 				float sc = GetValue() * customExp.GetValue();
@@ -487,7 +477,6 @@ namespace Lucene.Net.Search.Function
 				}
 				
 			}
-			private CustomWeight weight;
 			private float qWeight;
 			private Scorer subQueryScorer;
 			private Scorer[] valSrcScorers;
@@ -499,7 +488,6 @@ namespace Lucene.Net.Search.Function
 			internal CustomScorer(CustomScoreQuery enclosingInstance, Similarity similarity, IndexReader reader, CustomWeight w, Scorer subQueryScorer, Scorer[] valSrcScorers):base(similarity)
 			{
 				InitBlock(enclosingInstance);
-				this.weight = w;
 				this.qWeight = w.GetValue();
 				this.subQueryScorer = subQueryScorer;
 				this.valSrcScorers = valSrcScorers;
@@ -508,14 +496,6 @@ namespace Lucene.Net.Search.Function
                 this.provider = this.Enclosing_Instance.GetCustomScoreProvider(reader);
 			}
 			
-			/// <deprecated> use <see cref="NextDoc()" /> instead. 
-			/// </deprecated>
-            [Obsolete("use NextDoc() instead.")]
-			public override bool Next()
-			{
-				return NextDoc() != NO_MORE_DOCS;
-			}
-			
 			public override int NextDoc()
 			{
 				int doc = subQueryScorer.NextDoc();
@@ -529,14 +509,6 @@ namespace Lucene.Net.Search.Function
 				return doc;
 			}
 			
-			/// <deprecated> use <see cref="DocID()" /> instead. 
-			/// </deprecated>
-            [Obsolete("use DocID() instead.")]
-			public override int Doc()
-			{
-				return subQueryScorer.Doc();
-			}
-			
 			public override int DocID()
 			{
 				return subQueryScorer.DocID();
@@ -552,14 +524,6 @@ namespace Lucene.Net.Search.Function
                 return qWeight * provider.CustomScore(subQueryScorer.DocID(), subQueryScorer.Score(), vScores);
 			}
 			
-			/// <deprecated> use <see cref="Advance(int)" /> instead. 
-			/// </deprecated>
-            [Obsolete("use Advance(int) instead.")]
-			public override bool SkipTo(int target)
-			{
-				return Advance(target) != NO_MORE_DOCS;
-			}
-			
 			public override int Advance(int target)
 			{
 				int doc = subQueryScorer.Advance(target);
@@ -572,29 +536,6 @@ namespace Lucene.Net.Search.Function
 				}
 				return doc;
 			}
-			
-			// TODO: remove in 3.0
-			/*(non-Javadoc) <see cref="Lucene.Net.Search.Scorer.explain(int) */
-			public override Explanation Explain(int doc)
-			{
-				Explanation subQueryExpl = weight.subQueryWeight.Explain(reader, doc);
-				if (!subQueryExpl.IsMatch())
-				{
-					return subQueryExpl;
-				}
-				// match
-				Explanation[] valSrcExpls = new Explanation[valSrcScorers.Length];
-				for (int i = 0; i < valSrcScorers.Length; i++)
-				{
-					valSrcExpls[i] = valSrcScorers[i].Explain(doc);
-				}
-				Explanation customExp = Enclosing_Instance.CustomExplain(doc, subQueryExpl, valSrcExpls);
-				float sc = qWeight * customExp.GetValue();
-				Explanation res = new ComplexExplanation(true, sc, Enclosing_Instance.ToString() + ", product of:");
-				res.AddDetail(customExp);
-				res.AddDetail(new Explanation(qWeight, "queryBoost")); // actually using the q boost as q weight (== weight value)
-				return res;
-			}
 		}
 		
 		public override Weight CreateWeight(Searcher searcher)

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Function/ValueSourceQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Function/ValueSourceQuery.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Function/ValueSourceQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Function/ValueSourceQuery.cs Wed Nov  9 21:03:47 2011
@@ -16,7 +16,7 @@
  */
 
 using System;
-
+using Lucene.Net.Index;
 using IndexReader = Lucene.Net.Index.IndexReader;
 using TermDocs = Lucene.Net.Index.TermDocs;
 using ToStringUtils = Lucene.Net.Util.ToStringUtils;
@@ -60,7 +60,7 @@ namespace Lucene.Net.Search.Function
 		}
 		
 		/*(non-Javadoc) <see cref="Lucene.Net.Search.Query.extractTerms(java.util.Set) */
-		public override void  ExtractTerms(System.Collections.Hashtable terms)
+		public override void  ExtractTerms(System.Collections.Generic.ISet<Term> terms)
 		{
 			// no terms involved here
 		}
@@ -125,7 +125,15 @@ namespace Lucene.Net.Search.Function
 			/*(non-Javadoc) <see cref="Lucene.Net.Search.Weight.explain(Lucene.Net.Index.IndexReader, int) */
 			public override Explanation Explain(IndexReader reader, int doc)
 			{
-				return new ValueSourceScorer(enclosingInstance, similarity, reader, this).Explain(doc);
+			    DocValues vals = enclosingInstance.valSrc.GetValues(reader);
+			    float sc = queryWeight*vals.FloatVal(doc);
+
+                Explanation result = new ComplexExplanation(true, sc, enclosingInstance.ToString() + ", product of:")
+			    ;
+                result.AddDetail(vals.Explain(doc));
+			    result.AddDetail(new Explanation(enclosingInstance.GetBoost(), "boost"));
+			    result.AddDetail(new Explanation(queryNorm, "queryNorm"));
+			    return result;
 			}
 		}
 		
@@ -134,97 +142,61 @@ namespace Lucene.Net.Search.Function
 		/// is a (cached) field source, then value of that field in that document will 
 		/// be used. (assuming field is indexed for this doc, with a single token.)   
 		/// </summary>
-		private class ValueSourceScorer:Scorer
-		{
-			private void  InitBlock(ValueSourceQuery enclosingInstance)
-			{
-				this.enclosingInstance = enclosingInstance;
-			}
-			private ValueSourceQuery enclosingInstance;
-			public ValueSourceQuery Enclosing_Instance
-			{
-				get
-				{
-					return enclosingInstance;
-				}
-				
-			}
-			private ValueSourceWeight weight;
-			private float qWeight;
-			private DocValues vals;
-			private TermDocs termDocs;
-			private int doc = - 1;
-			
-			// constructor
-			internal ValueSourceScorer(ValueSourceQuery enclosingInstance, Similarity similarity, IndexReader reader, ValueSourceWeight w):base(similarity)
-			{
-				InitBlock(enclosingInstance);
-				this.weight = w;
-				this.qWeight = w.GetValue();
-				// this is when/where the values are first created.
-				vals = Enclosing_Instance.valSrc.GetValues(reader);
-				termDocs = reader.TermDocs(null);
-			}
-			
-			/// <deprecated> use <see cref="NextDoc()" /> instead. 
-			/// </deprecated>
-            [Obsolete("use NextDoc() instead. ")]
-			public override bool Next()
-			{
-				return termDocs.Next();
-			}
-			
-			public override int NextDoc()
-			{
-				return doc = termDocs.Next()?termDocs.Doc():NO_MORE_DOCS;
-			}
-			
-			/// <deprecated> use <see cref="DocID()" /> instead. 
-			/// </deprecated>
-            [Obsolete("use DocID() instead.")]
-			public override int Doc()
-			{
-				return termDocs.Doc();
-			}
-			
-			public override int DocID()
-			{
-				return doc;
-			}
-			
-			/*(non-Javadoc) <see cref="Lucene.Net.Search.Scorer.score() */
-			public override float Score()
-			{
-				return qWeight * vals.FloatVal(termDocs.Doc());
-			}
-			
-			/// <deprecated> use <see cref="Advance(int)" /> instead. 
-			/// </deprecated>
-            [Obsolete("use Advance(int)} instead.")]
-			public override bool SkipTo(int target)
-			{
-				return termDocs.SkipTo(target);
-			}
-			
-			public override int Advance(int target)
-			{
-				return doc = termDocs.SkipTo(target)?termDocs.Doc():NO_MORE_DOCS;
-			}
-			
-			/*(non-Javadoc) <see cref="Lucene.Net.Search.Scorer.explain(int) */
-			public override Explanation Explain(int doc)
-			{
-				float sc = qWeight * vals.FloatVal(doc);
-				
-				Explanation result = new ComplexExplanation(true, sc, Enclosing_Instance.ToString() + ", product of:");
-				
-				result.AddDetail(vals.Explain(doc));
-				result.AddDetail(new Explanation(Enclosing_Instance.GetBoost(), "boost"));
-				result.AddDetail(new Explanation(weight.queryNorm, "queryNorm"));
-				return result;
-			}
-		}
-		
+        private class ValueSourceScorer : Scorer
+        {
+            private void InitBlock(ValueSourceQuery enclosingInstance)
+            {
+                this.enclosingInstance = enclosingInstance;
+            }
+            private ValueSourceQuery enclosingInstance;
+            public ValueSourceQuery Enclosing_Instance
+            {
+                get
+                {
+                    return enclosingInstance;
+                }
+
+            }
+            private ValueSourceWeight weight;
+            private float qWeight;
+            private DocValues vals;
+            private TermDocs termDocs;
+            private int doc = -1;
+
+            // constructor
+            internal ValueSourceScorer(ValueSourceQuery enclosingInstance, Similarity similarity, IndexReader reader, ValueSourceWeight w)
+                : base(similarity)
+            {
+                InitBlock(enclosingInstance);
+                this.weight = w;
+                this.qWeight = w.GetValue();
+                // this is when/where the values are first created.
+                vals = Enclosing_Instance.valSrc.GetValues(reader);
+                termDocs = reader.TermDocs(null);
+            }
+
+            public override int NextDoc()
+            {
+                return doc = termDocs.Next() ? termDocs.Doc() : NO_MORE_DOCS;
+            }
+
+            public override int DocID()
+            {
+                return doc;
+            }
+
+            public override int Advance(int target)
+            {
+                return doc = termDocs.SkipTo(target) ? termDocs.Doc() : NO_MORE_DOCS;
+            }
+
+            /*(non-Javadoc) <see cref="Lucene.Net.Search.Scorer.explain(int) */
+            public override float Score()
+            {
+                return qWeight * vals.FloatVal(termDocs.Doc());
+            }
+        }
+
 		public override Weight CreateWeight(Searcher searcher)
 		{
 			return new ValueSourceQuery.ValueSourceWeight(this, searcher);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FuzzyQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FuzzyQuery.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FuzzyQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FuzzyQuery.cs Wed Nov  9 21:03:47 2011
@@ -16,10 +16,9 @@
  */
 
 using System;
-
+using Lucene.Net.Util;
 using IndexReader = Lucene.Net.Index.IndexReader;
 using Term = Lucene.Net.Index.Term;
-using PriorityQueue = Lucene.Net.Util.PriorityQueue;
 using ToStringUtils = Lucene.Net.Util.ToStringUtils;
 
 namespace Lucene.Net.Search
@@ -34,7 +33,7 @@ namespace Lucene.Net.Search
 	/// 
 	/// </summary>
 	[Serializable]
-	public class FuzzyQuery:MultiTermQuery
+	public class FuzzyQuery : MultiTermQuery
 	{
 		
 		public const float defaultMinSimilarity = 0.5f;
@@ -65,8 +64,8 @@ namespace Lucene.Net.Search
 		/// <throws>  IllegalArgumentException if minimumSimilarity is &gt;= 1 or &lt; 0 </throws>
 		/// <summary> or if prefixLength &lt; 0
 		/// </summary>
-		public FuzzyQuery(Term term, float minimumSimilarity, int prefixLength):base(term)
-		{ // will be removed in 3.0
+		public FuzzyQuery(Term term, float minimumSimilarity, int prefixLength)
+		{
 			this.term = term;
 			
 			if (minimumSimilarity >= 1.0f)
@@ -113,14 +112,14 @@ namespace Lucene.Net.Search
 			return prefixLength;
 		}
 		
+        // TODO: Why is this public?  Java has this protected (C# protected internal is closer to it than public)
 		public /*protected internal*/ override FilteredTermEnum GetEnum(IndexReader reader)
 		{
 			return new FuzzyTermEnum(reader, GetTerm(), minimumSimilarity, prefixLength);
 		}
 		
 		/// <summary> Returns the pattern term.</summary>
-        [Obsolete("Lucene.Net-2.9.1. This method overrides obsolete member Lucene.Net.Search.MultiTermQuery.GetTerm()")]
-		public override Term GetTerm()
+		public Term GetTerm()
 		{
 			return term;
 		}
@@ -137,7 +136,7 @@ namespace Lucene.Net.Search
 				// can only match if it's exact
 				return new TermQuery(term);
 			}
-			
+
 			FilteredTermEnum enumerator = GetEnum(reader);
 			int maxClauseCount = BooleanQuery.GetMaxClauseCount();
 			ScoreTermQueue stQueue = new ScoreTermQueue(maxClauseCount);
@@ -219,7 +218,7 @@ namespace Lucene.Net.Search
 			}
 		}
 		
-		protected internal class ScoreTermQueue:PriorityQueue
+		protected internal class ScoreTermQueue:PriorityQueue<ScoreTerm>
 		{
 			
 			public ScoreTermQueue(int size)
@@ -230,10 +229,8 @@ namespace Lucene.Net.Search
 			/* (non-Javadoc)
 			* <see cref="Lucene.Net.Util.PriorityQueue.lessThan(java.lang.Object, java.lang.Object)"/>
 			*/
-			public override bool LessThan(System.Object a, System.Object b)
+            public override bool LessThan(ScoreTerm termA, ScoreTerm termB)
 			{
-				ScoreTerm termA = (ScoreTerm) a;
-				ScoreTerm termB = (ScoreTerm) b;
 				if (termA.score == termB.score)
 					return termA.term.CompareTo(termB.term) > 0;
 				else

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/HitQueue.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/HitQueue.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/HitQueue.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/HitQueue.cs Wed Nov  9 21:03:47 2011
@@ -16,13 +16,12 @@
  */
 
 using System;
-
-using PriorityQueue = Lucene.Net.Util.PriorityQueue;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Search
 {
 	
-	public sealed class HitQueue:PriorityQueue
+	public sealed class HitQueue  :PriorityQueue<ScoreDoc>
 	{
 		
 		private bool prePopulate;
@@ -73,18 +72,16 @@ namespace Lucene.Net.Search
 		}
 		
 		// Returns null if prePopulate is false.
-		protected internal override System.Object GetSentinelObject()
+        protected internal override ScoreDoc GetSentinelObject()
 		{
 			// Always set the doc Id to MAX_VALUE so that it won't be favored by
 			// lessThan. This generally should not happen since if score is not NEG_INF,
 			// TopScoreDocCollector will always add the object to the queue.
 			return !prePopulate?null:new ScoreDoc(System.Int32.MaxValue, System.Single.NegativeInfinity);
 		}
-		
-		public override bool LessThan(System.Object a, System.Object b)
+
+        public override bool LessThan(ScoreDoc hitA, ScoreDoc hitB)
 		{
-			ScoreDoc hitA = (ScoreDoc) a;
-			ScoreDoc hitB = (ScoreDoc) b;
 			if (hitA.score == hitB.score)
 				return hitA.doc > hitB.doc;
 			else



Mime
View raw message