You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2014/09/19 16:19:34 UTC

[01/21] git commit: Fixed VirtualMethod.TestGeneral and VirtualMethod.TestExceptions

Repository: lucenenet
Updated Branches:
  refs/heads/master 8452d3099 -> 433a340a4


Fixed VirtualMethod.TestGeneral and VirtualMethod.TestExceptions

Changed the reflection code to be in line with the Java code's
intention.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/b7640302
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/b7640302
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/b7640302

Branch: refs/heads/master
Commit: b764030253126e5a98cf7dbe1a777995bbad3559
Parents: caa463f
Author: Prad Nelluru <pr...@microsoft.com>
Authored: Mon Sep 15 17:21:32 2014 -0700
Committer: Prad Nelluru <pr...@microsoft.com>
Committed: Mon Sep 15 17:21:32 2014 -0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/VirtualMethod.cs       | 20 ++++++++++++--------
 .../core/Util/TestVirtualMethod.cs              | 13 +++++++++----
 2 files changed, 21 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b7640302/src/Lucene.Net.Core/Util/VirtualMethod.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/VirtualMethod.cs b/src/Lucene.Net.Core/Util/VirtualMethod.cs
index 7c29e31..faa5a70 100644
--- a/src/Lucene.Net.Core/Util/VirtualMethod.cs
+++ b/src/Lucene.Net.Core/Util/VirtualMethod.cs
@@ -1,3 +1,4 @@
+using System.Linq;
 using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
@@ -77,7 +78,12 @@ namespace Lucene.Net.Util
             this.Parameters = parameters;
             try
             {
-                if (!SingletonSet.Add(baseClass.GetMethod(method, parameters)))
+                MethodInfo mi = baseClass.GetMethod(method, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, parameters, null);
+                if (mi == null)
+                {
+                    throw new System.ArgumentException(baseClass.Name + " has no such method.");
+                }
+                else if (!SingletonSet.Add(mi))
                 {
                     throw new System.NotSupportedException("VirtualMethod instances must be singletons and therefore " + "assigned to static final members in the same class, they use as baseClass ctor param.");
                 }
@@ -127,14 +133,12 @@ namespace Lucene.Net.Util
                 // lookup method, if success mark as overridden
                 if (!overridden)
                 {
-                    try
-                    {
-                        clazz.GetMethod(Method, Parameters);
+                    MethodInfo mi = clazz.GetMethod(Method, 
+                        BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly, 
+                        null, Parameters, null);
+
+                    if (mi != null)
                         overridden = true;
-                    }
-                    catch (NotSupportedException nsme)
-                    {
-                    }
                 }
 
                 // increment distance if overridden

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b7640302/src/Lucene.Net.Tests/core/Util/TestVirtualMethod.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestVirtualMethod.cs b/src/Lucene.Net.Tests/core/Util/TestVirtualMethod.cs
index 3311d39..27b13f7 100644
--- a/src/Lucene.Net.Tests/core/Util/TestVirtualMethod.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestVirtualMethod.cs
@@ -40,6 +40,7 @@ namespace Lucene.Net.Util
         {
         }
 
+        [Ignore]
         internal class TestClass1 : TestVirtualMethod
         {
             public override void PublicTest(string test)
@@ -51,6 +52,7 @@ namespace Lucene.Net.Util
             }
         }
 
+        [Ignore]
         internal class TestClass2 : TestClass1
         {
             protected override void ProtectedTest(int test) // make it public here
@@ -58,6 +60,7 @@ namespace Lucene.Net.Util
             }
         }
 
+        [Ignore]
         internal class TestClass3 : TestClass2
         {
             public override void PublicTest(string test)
@@ -65,10 +68,12 @@ namespace Lucene.Net.Util
             }
         }
 
+        [Ignore]
         internal class TestClass4 : TestVirtualMethod
         {
         }
 
+        [Ignore]
         internal class TestClass5 : TestClass4
         {
         }
@@ -110,7 +115,7 @@ namespace Lucene.Net.Util
 
             try
             {
-                new VirtualMethod<Type>(typeof(TestVirtualMethod), "bogus");
+                new VirtualMethod<TestVirtualMethod>(typeof(TestVirtualMethod), "bogus");
                 Assert.Fail("Method bogus() does not exist, so IAE should be thrown");
             }
             catch (System.ArgumentException arg)
@@ -120,7 +125,7 @@ namespace Lucene.Net.Util
 
             try
             {
-                new VirtualMethod<Type>(typeof(TestClass2), "PublicTest", typeof(string));
+                new VirtualMethod<TestClass2>(typeof(TestClass2), "PublicTest", typeof(string));
             }
             catch (System.ArgumentException arg)
             {
@@ -130,10 +135,10 @@ namespace Lucene.Net.Util
             try
             {
                 // try to create a second instance of the same baseClass / method combination
-                new VirtualMethod<Type>(typeof(TestVirtualMethod), "PublicTest", typeof(string));
+                new VirtualMethod<TestVirtualMethod>(typeof(TestVirtualMethod), "PublicTest", typeof(string));
                 Assert.Fail("Violating singleton status succeeded");
             }
-            catch (System.NotSupportedException arg)
+            catch (System.ArgumentException arg)
             {
                 // pass
             }


[16/21] More work on Lucene.Net.Queries

Posted by sy...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs
index 97806b5..7a738f7 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs
@@ -16,8 +16,8 @@
  */
 using System;
 using System.Collections;
-using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
+using Lucene.Net.Index;
+using Lucene.Net.Queries.Function.DocValues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -37,14 +37,12 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		this.lv = (long)constant;
 	  }
 
-	  public override string description()
-	  {
-		return "const(" + constant + ")";
-	  }
+        public override string Description
+        {
+            get { return "const(" + constant + ")"; }
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 		return new DoubleDocValuesAnonymousInnerClassHelper(this, this);
 	  }
@@ -53,60 +51,60 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  {
 		  private readonly DoubleConstValueSource outerInstance;
 
-		  public DoubleDocValuesAnonymousInnerClassHelper(DoubleConstValueSource outerInstance, DoubleConstValueSource this) : base(this)
+		  public DoubleDocValuesAnonymousInnerClassHelper(DoubleConstValueSource outerInstance, DoubleConstValueSource @this) : base(@this)
 		  {
 			  this.outerInstance = outerInstance;
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
 			return outerInstance.fv;
 		  }
 
-		  public override int intVal(int doc)
+		  public override int IntVal(int doc)
 		  {
 			return (int) outerInstance.lv;
 		  }
 
-		  public override long longVal(int doc)
+		  public override long LongVal(int doc)
 		  {
 			return outerInstance.lv;
 		  }
 
-		  public override double doubleVal(int doc)
+		  public override double DoubleVal(int doc)
 		  {
 			return outerInstance.constant;
 		  }
 
-		  public override string strVal(int doc)
+		  public override string StrVal(int doc)
 		  {
 			return Convert.ToString(outerInstance.constant);
 		  }
 
-		  public override object objectVal(int doc)
+		  public override object ObjectVal(int doc)
 		  {
 			return outerInstance.constant;
 		  }
 
 		  public override string ToString(int doc)
 		  {
-			return outerInstance.description();
+			return outerInstance.Description;
 		  }
 	  }
 
 	  public override int GetHashCode()
 	  {
-		long bits = double.doubleToRawLongBits(constant);
+		long bits = NumberUtil.DoubleToRawLongBits(constant);
 		return (int)(bits ^ ((long)((ulong)bits >> 32)));
 	  }
 
 	  public override bool Equals(object o)
 	  {
-		if (!(o is DoubleConstValueSource))
+	      var other = o as DoubleConstValueSource;
+		if (other == null)
 		{
 			return false;
 		}
-		DoubleConstValueSource other = (DoubleConstValueSource) o;
 		return this.constant == other.constant;
 	  }
 
@@ -158,5 +156,4 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		  }
 	  }
 	}
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/DoubleFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DoubleFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/DoubleFieldSource.cs
index d9c09dc..3965bca 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/DoubleFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DoubleFieldSource.cs
@@ -15,8 +15,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
+using Lucene.Net.Index;
+using Lucene.Net.Queries.Function.DocValues;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
+using Lucene.Net.Util.Mutable;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -27,7 +30,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	public class DoubleFieldSource : FieldCacheSource
 	{
 
-	  protected internal readonly FieldCache.DoubleParser parser;
+	  protected internal readonly FieldCache_Fields.DoubleParser parser;
 
 	  public DoubleFieldSource(string field) : this(field, null)
 	  {
@@ -38,21 +41,21 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		this.parser = parser;
 	  }
 
-	  public override string description()
-	  {
-		return "double(" + field + ')';
-	  }
+        public override string Description
+        {
+            get { return "double(" + field + ')'; }
+        }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Doubles arr = cache.getDoubles(readerContext.reader(), field, parser, true);
 		FieldCache.Doubles arr = cache.getDoubles(readerContext.reader(), field, parser, true);
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final org.apache.lucene.util.Bits valid = cache.getDocsWithField(readerContext.reader(), field);
-		Bits valid = cache.getDocsWithField(readerContext.reader(), field);
+		var valid = cache.getDocsWithField(readerContext.reader(), field);
 		return new DoubleDocValuesAnonymousInnerClassHelper(this, this, arr, valid);
 
 	  }
@@ -71,7 +74,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.valid = valid;
 		  }
 
-		  public override double doubleVal(int doc)
+		  public override double DoubleVal(int doc)
 		  {
 			return arr.get(doc);
 		  }
@@ -89,7 +92,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  }
 		  }
 
-		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
+		  private class ValueFillerAnonymousInnerClassHelper : AbstractValueFiller
 		  {
 			  private readonly DoubleDocValuesAnonymousInnerClassHelper outerInstance;
 
@@ -109,10 +112,10 @@ namespace Lucene.Net.Queries.Function.ValueSources
 				  }
 			  }
 
-			  public override void fillValue(int doc)
+			  public override void FillValue(int doc)
 			  {
-				mval.value = outerInstance.arr.get(doc);
-				mval.exists = mval.value != 0 || outerInstance.valid.get(doc);
+				mval.Value = outerInstance.arr.Get(doc);
+				mval.Exists = mval.Value != 0 || outerInstance.valid.Get(doc);
 			  }
 		  }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/DualFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DualFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/DualFloatFunction.cs
index 47a0b42..412d3cf 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/DualFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DualFloatFunction.cs
@@ -15,102 +15,95 @@
  * limitations under the License.
  */
 using System.Collections;
-using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
+using Lucene.Net.Index;
+using Lucene.Net.Queries.Function.DocValues;
+using Lucene.Net.Search;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
     /// <summary>
-	/// Abstract <seealso cref="ValueSource"/> implementation which wraps two ValueSources
-	/// and applies an extendible float function to their values.
-	/// 
-	/// </summary>
-	public abstract class DualFloatFunction : ValueSource
-	{
-	  protected internal readonly ValueSource a;
-	  protected internal readonly ValueSource b;
+    /// Abstract <seealso cref="ValueSource"/> implementation which wraps two ValueSources
+    /// and applies an extendible float function to their values.
+    /// 
+    /// </summary>
+    public abstract class DualFloatFunction : ValueSource
+    {
+        protected internal readonly ValueSource a;
+        protected internal readonly ValueSource b;
 
-	 /// <param name="a">  the base. </param>
-	 /// <param name="b">  the exponent. </param>
-	  public DualFloatFunction(ValueSource a, ValueSource b)
-	  {
-		this.a = a;
-		this.b = b;
-	  }
+        /// <param name="a">  the base. </param>
+        /// <param name="b">  the exponent. </param>
+        protected DualFloatFunction(ValueSource a, ValueSource b)
+        {
+            this.a = a;
+            this.b = b;
+        }
 
-	  protected internal abstract string name();
-	  protected internal abstract float func(int doc, FunctionValues aVals, FunctionValues bVals);
+        protected abstract string Name { get; }
+        protected abstract float Func(int doc, FunctionValues aVals, FunctionValues bVals);
 
-	  public override string description()
-	  {
-		return name() + "(" + a.description() + "," + b.description() + ")";
-	  }
+        public override string Description
+        {
+            get { return Name + "(" + a.Description + "," + b.Description + ")"; }
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues aVals = a.getValues(context, readerContext);
-		FunctionValues aVals = a.getValues(context, readerContext);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues bVals = b.getValues(context, readerContext);
-		FunctionValues bVals = b.getValues(context, readerContext);
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, aVals, bVals);
-	  }
+        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
+        {
+            FunctionValues aVals = a.GetValues(context, readerContext);
+            FunctionValues bVals = b.GetValues(context, readerContext);
+            return new FloatDocValuesAnonymousInnerClassHelper(this, this, aVals, bVals);
+        }
 
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly DualFloatFunction outerInstance;
+        private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+        {
+            private readonly DualFloatFunction outerInstance;
 
-		  private FunctionValues aVals;
-		  private FunctionValues bVals;
+            private readonly FunctionValues aVals;
+            private readonly FunctionValues bVals;
 
-		  public FloatDocValuesAnonymousInnerClassHelper(DualFloatFunction outerInstance, DualFloatFunction this, FunctionValues aVals, FunctionValues bVals) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.aVals = aVals;
-			  this.bVals = bVals;
-		  }
+            public FloatDocValuesAnonymousInnerClassHelper(DualFloatFunction outerInstance, DualFloatFunction @this, FunctionValues aVals, FunctionValues bVals)
+                : base(@this)
+            {
+                this.outerInstance = outerInstance;
+                this.aVals = aVals;
+                this.bVals = bVals;
+            }
 
-		  public override float floatVal(int doc)
-		  {
-			return outerInstance.func(doc, aVals, bVals);
-		  }
+            public override float FloatVal(int doc)
+            {
+                return outerInstance.Func(doc, aVals, bVals);
+            }
 
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.name() + '(' + aVals.ToString(doc) + ',' + bVals.ToString(doc) + ')';
-		  }
-	  }
+            public override string ToString(int doc)
+            {
+                return outerInstance.Name + '(' + aVals.ToString(doc) + ',' + bVals.ToString(doc) + ')';
+            }
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		a.createWeight(context,searcher);
-		b.createWeight(context,searcher);
-	  }
+        public override void CreateWeight(IDictionary context, IndexSearcher searcher)
+        {
+            a.CreateWeight(context, searcher);
+            b.CreateWeight(context, searcher);
+        }
 
-	  public override int GetHashCode()
-	  {
-		int h = a.GetHashCode();
-		h ^= (h << 13) | ((int)((uint)h >> 20));
-		h += b.GetHashCode();
-		h ^= (h << 23) | ((int)((uint)h >> 10));
-		h += name().GetHashCode();
-		return h;
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		DualFloatFunction other = (DualFloatFunction)o;
-		return this.a.Equals(other.a) && this.b.Equals(other.b);
-	  }
-	}
+        public override int GetHashCode()
+        {
+            int h = a.GetHashCode();
+            h ^= (h << 13) | ((int)((uint)h >> 20));
+            h += b.GetHashCode();
+            h ^= (h << 23) | ((int)((uint)h >> 10));
+            h += Name.GetHashCode();
+            return h;
+        }
 
+        public override bool Equals(object o)
+        {
+            var other = o as DualFloatFunction;
+            if (other == null)
+            {
+                return false;
+            }
+            return this.a.Equals(other.a) && this.b.Equals(other.b);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
index a7fe04c..ada4ecb 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
@@ -1,8 +1,12 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
-using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
+using System.Globalization;
+using Lucene.Net.Index;
+using Lucene.Net.Queries.Function.DocValues;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
+using Lucene.Net.Util.Mutable;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -26,13 +30,13 @@ namespace Lucene.Net.Queries.Function.ValueSources
     /// <summary>
 	/// Obtains int field values from <seealso cref="FieldCache#getInts"/> and makes
 	/// those values available as other numeric types, casting as needed.
-	/// strVal of the value is not the int value, but its string (displayed) value
+	/// StrVal of the value is not the int value, but its string (displayed) value
 	/// </summary>
 	public class EnumFieldSource : FieldCacheSource
 	{
-	  internal const int? DEFAULT_VALUE = -1;
+	  internal const int DEFAULT_VALUE = -1;
 
-	  internal readonly FieldCache.IntParser parser;
+	  internal readonly FieldCache_Fields.IntParser parser;
 	  internal readonly IDictionary<int?, string> enumIntToStringMap;
 	  internal readonly IDictionary<string, int?> enumStringToIntMap;
 
@@ -43,20 +47,20 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		this.enumStringToIntMap = enumStringToIntMap;
 	  }
 
-	  private static int? tryParseInt(string valueStr)
+	  private static int? TryParseInt(string valueStr)
 	  {
 		int? intValue = null;
 		try
 		{
 		  intValue = Convert.ToInt32(valueStr);
 		}
-		catch (NumberFormatException)
+		catch (FormatException)
 		{
 		}
 		return intValue;
 	  }
 
-	  private string intValueToStringValue(int? intVal)
+	  private string IntValueToStringValue(int? intVal)
 	  {
 		if (intVal == null)
 		{
@@ -71,10 +75,10 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		  return enumString;
 		}
 		// can't find matching enum name - return DEFAULT_VALUE.toString()
-		return DEFAULT_VALUE.ToString();
+		return DEFAULT_VALUE.ToString(CultureInfo.InvariantCulture);
 	  }
 
-	  private int? stringValueToIntValue(string stringVal)
+	  private int? StringValueToIntValue(string stringVal)
 	  {
 		if (stringVal == null)
 		{
@@ -91,7 +95,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		}
 
 		//enum int not found for string
-		intValue = tryParseInt(stringVal);
+		intValue = TryParseInt(stringVal);
 		if (intValue == null) //not Integer
 		{
 		  intValue = DEFAULT_VALUE;
@@ -114,8 +118,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Ints arr = cache.getInts(readerContext.reader(), field, parser, true);
@@ -144,7 +148,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 		  internal readonly MutableValueInt val;
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
 			return (float) arr.get(doc);
 		  }
@@ -154,17 +158,17 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			return arr.get(doc);
 		  }
 
-		  public override long longVal(int doc)
+		  public override long LongVal(int doc)
 		  {
 			return (long) arr.get(doc);
 		  }
 
-		  public override double doubleVal(int doc)
+		  public override double DoubleVal(int doc)
 		  {
 			return (double) arr.get(doc);
 		  }
 
-		  public override string strVal(int doc)
+		  public override string StrVal(int doc)
 		  {
 			int? intValue = arr.get(doc);
 			return outerInstance.intValueToStringValue(intValue);
@@ -182,14 +186,14 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 		  public override string ToString(int doc)
 		  {
-			return outerInstance.description() + '=' + strVal(doc);
+			return outerInstance.description() + '=' + StrVal(doc);
 		  }
 
 
-		  public override ValueSourceScorer getRangeScorer(IndexReader reader, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
+		  public override ValueSourceScorer GetRangeScorer(IndexReader reader, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
 		  {
-			int? lower = outerInstance.stringValueToIntValue(lowerVal);
-			int? upper = outerInstance.stringValueToIntValue(upperVal);
+			int? lower = outerInstance.StringValueToIntValue(lowerVal);
+			int? upper = outerInstance.StringValueToIntValue(upperVal);
 
 			// instead of using separate comparison functions, adjust the endpoints.
 
@@ -241,7 +245,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 				  this.uu = uu;
 			  }
 
-			  public override bool matchesValue(int doc)
+			  public override bool MatchesValue(int doc)
 			  {
 				int val = outerInstance.arr.get(doc);
 				// only check for deleted if it's the default value

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs
index ab76bfa..0d9b7ad 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs
@@ -15,60 +15,60 @@
  * limitations under the License.
  */
 
+using Lucene.Net.Search;
+
 namespace Lucene.Net.Queries.Function.ValueSources
 {
     /// <summary>
-	/// A base class for ValueSource implementations that retrieve values for
-	/// a single field from the <seealso cref="org.apache.lucene.search.FieldCache"/>.
-	/// 
-	/// 
-	/// </summary>
-	public abstract class FieldCacheSource : ValueSource
-	{
-	  protected internal readonly string field;
-	  protected internal readonly FieldCache cache = FieldCache.DEFAULT;
-
-	  public FieldCacheSource(string field)
-	  {
-		this.field = field;
-	  }
-
-	  public virtual FieldCache FieldCache
-	  {
-		  get
-		  {
-			return cache;
-		  }
-	  }
+    /// A base class for ValueSource implementations that retrieve values for
+    /// a single field from the <seealso cref="org.apache.lucene.search.FieldCache"/>.
+    /// 
+    /// 
+    /// </summary>
+    public abstract class FieldCacheSource : ValueSource
+    {
+        protected internal readonly string field;
+        protected internal readonly FieldCache cache = FieldCache_Fields.DEFAULT;
 
-	  public virtual string Field
-	  {
-		  get
-		  {
-			return field;
-		  }
-	  }
+        public FieldCacheSource(string field)
+        {
+            this.field = field;
+        }
 
-	  public override string description()
-	  {
-		return field;
-	  }
+        public virtual FieldCache FieldCache
+        {
+            get
+            {
+                return cache;
+            }
+        }
 
-	  public override bool Equals(object o)
-	  {
-		if (!(o is FieldCacheSource))
-		{
-			return false;
-		}
-		FieldCacheSource other = (FieldCacheSource)o;
-		return this.field.Equals(other.field) && this.cache == other.cache;
-	  }
+        public virtual string Field
+        {
+            get
+            {
+                return field;
+            }
+        }
 
-	  public override int GetHashCode()
-	  {
-		return cache.GetHashCode() + field.GetHashCode();
-	  }
+        public override string Description
+        {
+            get { return field; }
+        }
 
-	}
+        public override bool Equals(object o)
+        {
+            var other = o as FieldCacheSource;
+            if (other == null)
+            {
+                return false;
+            }
+            return field.Equals(other.field) && cache == other.cache;
+        }
 
+        public override int GetHashCode()
+        {
+            return cache.GetHashCode() + field.GetHashCode();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs
index a40f119..023b12a 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -44,8 +44,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Floats arr = cache.getFloats(readerContext.reader(), field, parser, true);
@@ -71,7 +71,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.valid = valid;
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
 			return arr.get(doc);
 		  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs
index 38532e2..80035fd 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 using System.Collections;
+using Lucene.Net.Search.Similarities;
 using org.apache.lucene.queries.function;
 
 namespace Lucene.Net.Queries.Function.ValueSources
@@ -40,8 +41,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 		IndexSearcher searcher = (IndexSearcher)context["searcher"];
 		TFIDFSimilarity sim = asTFIDF(searcher.Similarity, field);
@@ -55,7 +56,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 	  // tries extra hard to cast the sim to TFIDFSimilarity
-	  internal static TFIDFSimilarity asTFIDF(Similarity sim, string field)
+	  internal static TFIDFSimilarity AsTFIDF(Similarity sim, string field)
 	  {
 		while (sim is PerFieldSimilarityWrapper)
 		{

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/IfFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/IfFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/IfFunction.cs
index 8fee427..692dae1 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/IfFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/IfFunction.cs
@@ -38,18 +38,18 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues ifVals = ifSource.getValues(context, readerContext);
-		FunctionValues ifVals = ifSource.getValues(context, readerContext);
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues ifVals = ifSource.GetValues(context, readerContext);
+		FunctionValues ifVals = ifSource.GetValues(context, readerContext);
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues trueVals = trueSource.getValues(context, readerContext);
-		FunctionValues trueVals = trueSource.getValues(context, readerContext);
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues trueVals = trueSource.GetValues(context, readerContext);
+		FunctionValues trueVals = trueSource.GetValues(context, readerContext);
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues falseVals = falseSource.getValues(context, readerContext);
-		FunctionValues falseVals = falseSource.getValues(context, readerContext);
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues falseVals = falseSource.GetValues(context, readerContext);
+		FunctionValues falseVals = falseSource.GetValues(context, readerContext);
 
 		return new FunctionValuesAnonymousInnerClassHelper(this, ifVals, trueVals, falseVals);
 
@@ -71,19 +71,19 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.falseVals = falseVals;
 		  }
 
-		  public override sbyte byteVal(int doc)
+		  public override sbyte ByteVal(int doc)
 		  {
-			return ifVals.boolVal(doc) ? trueVals.byteVal(doc) : falseVals.byteVal(doc);
+			return ifVals.boolVal(doc) ? trueVals.ByteVal(doc) : falseVals.ByteVal(doc);
 		  }
 
-		  public override short shortVal(int doc)
+		  public override short ShortVal(int doc)
 		  {
-			return ifVals.boolVal(doc) ? trueVals.shortVal(doc) : falseVals.shortVal(doc);
+			return ifVals.boolVal(doc) ? trueVals.ShortVal(doc) : falseVals.ShortVal(doc);
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
-			return ifVals.boolVal(doc) ? trueVals.floatVal(doc) : falseVals.floatVal(doc);
+			return ifVals.boolVal(doc) ? trueVals.FloatVal(doc) : falseVals.FloatVal(doc);
 		  }
 
 		  public override int intVal(int doc)
@@ -91,19 +91,19 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			return ifVals.boolVal(doc) ? trueVals.intVal(doc) : falseVals.intVal(doc);
 		  }
 
-		  public override long longVal(int doc)
+		  public override long LongVal(int doc)
 		  {
-			return ifVals.boolVal(doc) ? trueVals.longVal(doc) : falseVals.longVal(doc);
+			return ifVals.boolVal(doc) ? trueVals.LongVal(doc) : falseVals.LongVal(doc);
 		  }
 
-		  public override double doubleVal(int doc)
+		  public override double DoubleVal(int doc)
 		  {
-			return ifVals.boolVal(doc) ? trueVals.doubleVal(doc) : falseVals.doubleVal(doc);
+			return ifVals.boolVal(doc) ? trueVals.DoubleVal(doc) : falseVals.DoubleVal(doc);
 		  }
 
-		  public override string strVal(int doc)
+		  public override string StrVal(int doc)
 		  {
-			return ifVals.boolVal(doc) ? trueVals.strVal(doc) : falseVals.strVal(doc);
+			return ifVals.boolVal(doc) ? trueVals.StrVal(doc) : falseVals.StrVal(doc);
 		  }
 
 		  public override bool boolVal(int doc)
@@ -166,12 +166,12 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
-		ifSource.createWeight(context, searcher);
-		trueSource.createWeight(context, searcher);
-		falseSource.createWeight(context, searcher);
+		ifSource.CreateWeight(context, searcher);
+		trueSource.CreateWeight(context, searcher);
+		falseSource.CreateWeight(context, searcher);
 	  }
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs
index 5ed7345..63a8e31 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs
@@ -16,8 +16,8 @@
  */
 using System;
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -45,8 +45,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Ints arr = cache.getInts(readerContext.reader(), field, parser, true);
@@ -75,7 +75,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 		  internal readonly MutableValueInt val;
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
 			return (float)arr.get(doc);
 		  }
@@ -85,17 +85,17 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			return arr.get(doc);
 		  }
 
-		  public override long longVal(int doc)
+		  public override long LongVal(int doc)
 		  {
 			return (long)arr.get(doc);
 		  }
 
-		  public override double doubleVal(int doc)
+		  public override double DoubleVal(int doc)
 		  {
 			return (double)arr.get(doc);
 		  }
 
-		  public override string strVal(int doc)
+		  public override string StrVal(int doc)
 		  {
 			return Convert.ToString(arr.get(doc));
 		  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs
index 3319eda..ba9572f 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs
@@ -16,8 +16,8 @@
  */
 using System;
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -44,8 +44,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final org.apache.lucene.index.BinaryDocValues terms = cache.getTerms(readerContext.reader(), field, false, org.apache.lucene.util.packed.PackedInts.FAST);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs
index 7924547..bf92522 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -47,12 +47,12 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
-		FunctionValues vals = source.getValues(context, readerContext);
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.GetValues(context, readerContext);
+		FunctionValues vals = source.GetValues(context, readerContext);
 		return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals);
 	  }
 
@@ -68,9 +68,9 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.vals = vals;
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
-			return vals.floatVal(doc) * outerInstance.slope + outerInstance.intercept;
+			return vals.FloatVal(doc) * outerInstance.slope + outerInstance.intercept;
 		  }
 		  public override string ToString(int doc)
 		  {
@@ -79,17 +79,17 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
-		source.createWeight(context, searcher);
+		source.CreateWeight(context, searcher);
 	  }
 
 	  public override int GetHashCode()
 	  {
-		int h = float.floatToIntBits(slope);
+		int h = Number.FloatToIntBits(slope);
 		h = ((int)((uint)h >> 2)) | (h << 30);
-		h += float.floatToIntBits(intercept);
+		h += Number.FloatToIntBits(intercept);
 		h ^= (h << 14) | ((int)((uint)h >> 19));
 		return h + source.GetHashCode();
 	  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs
index 4b91199..0b7bcea 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs
@@ -1,6 +1,6 @@
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -47,8 +47,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 
 		return new StrDocValuesAnonymousInnerClassHelper(this, this);
@@ -63,7 +63,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.outerInstance = outerInstance;
 		  }
 
-		  public override string strVal(int doc)
+		  public override string StrVal(int doc)
 		  {
 			return outerInstance.@string;
 		  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs
index 00b902f..9216c48 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs
@@ -16,8 +16,8 @@
  */
 using System;
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -60,8 +60,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Longs arr = cache.getLongs(readerContext.reader(), field, parser, true);
@@ -87,7 +87,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.valid = valid;
 		  }
 
-		  public override long longVal(int doc)
+		  public override long LongVal(int doc)
 		  {
 			return arr.get(doc);
 		  }
@@ -102,7 +102,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			return valid.get(doc) ? outerInstance.longToObject(arr.get(doc)) : null;
 		  }
 
-		  public override string strVal(int doc)
+		  public override string StrVal(int doc)
 		  {
 			return valid.get(doc) ? outerInstance.longToString(arr.get(doc)) : null;
 		  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/MaxDocValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MaxDocValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/MaxDocValueSource.cs
index 0d65888..be0e939 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/MaxDocValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MaxDocValueSource.cs
@@ -40,15 +40,15 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
 		context["searcher"] = searcher;
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 		IndexSearcher searcher = (IndexSearcher)context["searcher"];
 		return new ConstIntDocValues(searcher.IndexReader.maxDoc(), this);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/MaxFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MaxFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MaxFloatFunction.cs
index ba86891..417c4ba 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/MaxFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MaxFloatFunction.cs
@@ -44,7 +44,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		float val = float.NegativeInfinity;
 		foreach (FunctionValues vals in valsArr)
 		{
-		  val = Math.Max(vals.floatVal(doc), val);
+		  val = Math.Max(vals.FloatVal(doc), val);
 		}
 		return val;
 	  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/MinFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MinFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MinFloatFunction.cs
index 8905f5b..9457ee1 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/MinFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MinFloatFunction.cs
@@ -44,7 +44,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		float val = float.PositiveInfinity;
 		foreach (FunctionValues vals in valsArr)
 		{
-		  val = Math.Min(vals.floatVal(doc), val);
+		  val = Math.Min(vals.FloatVal(doc), val);
 		}
 		return val;
 	  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
index 5419e47..7e44df3 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
@@ -17,8 +17,8 @@
 using System.Collections;
 using System.Collections.Generic;
 using System.Text;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -41,8 +41,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  protected internal abstract bool func(int doc, FunctionValues[] vals);
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.docvalues.BoolDocValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override BoolDocValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.docvalues.BoolDocValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override BoolDocValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues[] vals = new org.apache.lucene.queries.function.FunctionValues[sources.size()];
@@ -50,7 +50,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		int i = 0;
 		foreach (ValueSource source in sources)
 		{
-		  vals[i++] = source.getValues(context, readerContext);
+		  vals[i++] = source.GetValues(context, readerContext);
 		}
 
 		return new BoolDocValuesAnonymousInnerClassHelper(this, this, vals);
@@ -130,12 +130,12 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
 		foreach (ValueSource source in sources)
 		{
-		  source.createWeight(context, searcher);
+		  source.CreateWeight(context, searcher);
 		}
 	  }
 	}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs
index a32c2c0..98678c9 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs
@@ -1,7 +1,6 @@
 using System.Collections;
 using System.Text;
-using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
+using Lucene.Net.Queries.Function.DocValues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -60,15 +59,15 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues[] valsArr = new org.apache.lucene.queries.function.FunctionValues[sources.length];
 		FunctionValues[] valsArr = new FunctionValues[sources.Length];
 		for (int i = 0; i < sources.Length; i++)
 		{
-		  valsArr[i] = sources[i].getValues(context, readerContext);
+		  valsArr[i] = sources[i].GetValues(context, readerContext);
 		}
 
 		return new FloatDocValuesAnonymousInnerClassHelper(this, this, valsArr);
@@ -86,7 +85,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.valsArr = valsArr;
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
 			return outerInstance.func(doc, valsArr);
 		  }
@@ -113,12 +112,12 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
 		foreach (ValueSource source in sources)
 		{
-		  source.createWeight(context, searcher);
+		  source.CreateWeight(context, searcher);
 		}
 	  }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs
index 91a13fb..e45c77f 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs
@@ -1,156 +1,140 @@
 using System.Collections;
 using System.Collections.Generic;
 using System.Text;
-using org.apache.lucene.queries.function;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
     /// <summary>
-	/// Abstract parent class for <seealso cref="ValueSource"/> implementations that wrap multiple
-	/// ValueSources and apply their own logic.
-	/// </summary>
-	public abstract class MultiFunction : ValueSource
-	{
-	  protected internal readonly IList<ValueSource> sources;
-
-	  public MultiFunction(IList<ValueSource> sources)
-	  {
-		this.sources = sources;
-	  }
-
-	  protected internal abstract string name();
-
-	  public override string description()
-	  {
-		return description(name(), sources);
-	  }
-
-	  public static string description(string name, IList<ValueSource> sources)
-	  {
-		StringBuilder sb = new StringBuilder();
-		sb.Append(name).Append('(');
-		bool firstTime = true;
-		foreach (ValueSource source in sources)
-		{
-		  if (firstTime)
-		  {
-			firstTime = false;
-		  }
-		  else
-		  {
-			sb.Append(',');
-		  }
-		  sb.Append((object) source);
-		}
-		sb.Append(')');
-		return sb.ToString();
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public static org.apache.lucene.queries.function.FunctionValues[] valsArr(java.util.List<org.apache.lucene.queries.function.ValueSource> sources, java.util.Map fcontext, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public static FunctionValues[] valsArr(IList<ValueSource> sources, IDictionary fcontext, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues[] valsArr = new org.apache.lucene.queries.function.FunctionValues[sources.size()];
-		FunctionValues[] valsArr = new FunctionValues[sources.Count];
-		int i = 0;
-		foreach (ValueSource source in sources)
-		{
-		  valsArr[i++] = source.getValues(fcontext, readerContext);
-		}
-		return valsArr;
-	  }
-
-	  public class Values : FunctionValues
-	  {
-		  private readonly MultiFunction outerInstance;
-
-		internal readonly FunctionValues[] valsArr;
-
-		public Values(MultiFunction outerInstance, FunctionValues[] valsArr)
-		{
-			this.outerInstance = outerInstance;
-		  this.valsArr = valsArr;
-		}
-
-		public override string ToString(int doc)
-		{
-		  return MultiFunction.ToString(outerInstance.name(), valsArr, doc);
-		}
-
-		public override ValueFiller ValueFiller
-		{
-			get
-			{
-			  // TODO: need ValueSource.type() to determine correct type
-			  return base.ValueFiller;
-			}
-		}
-	  }
-
-
-	  public static string ToString(string name, FunctionValues[] valsArr, int doc)
-	  {
-		StringBuilder sb = new StringBuilder();
-		sb.Append(name).Append('(');
-		bool firstTime = true;
-		foreach (FunctionValues vals in valsArr)
-		{
-		  if (firstTime)
-		  {
-			firstTime = false;
-		  }
-		  else
-		  {
-			sb.Append(',');
-		  }
-		  sb.Append(vals.ToString(doc));
-		}
-		sb.Append(')');
-		return sb.ToString();
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		foreach (ValueSource source in sources)
-		{
-		  source.createWeight(context, searcher);
-		}
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return sources.GetHashCode() + name().GetHashCode();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		MultiFunction other = (MultiFunction)o;
-		return this.sources.Equals(other.sources);
-	  }
-	}
-
-
+    /// Abstract parent class for <seealso cref="ValueSource"/> implementations that wrap multiple
+    /// ValueSources and apply their own logic.
+    /// </summary>
+    public abstract class MultiFunction : ValueSource
+    {
+        protected internal readonly IList<ValueSource> sources;
+
+        public MultiFunction(IList<ValueSource> sources)
+        {
+            this.sources = sources;
+        }
+
+        protected abstract string Name { get; }
+
+        public override string Description
+        {
+            get { return GetDescription(Name, sources); }
+        }
+
+        public static string GetDescription(string name, IList<ValueSource> sources)
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append(name).Append('(');
+            bool firstTime = true;
+            foreach (ValueSource source in sources)
+            {
+                if (firstTime)
+                {
+                    firstTime = false;
+                }
+                else
+                {
+                    sb.Append(',');
+                }
+                sb.Append((object)source);
+            }
+            sb.Append(')');
+            return sb.ToString();
+        }
+
+        public static FunctionValues[] ValsArr(IList<ValueSource> sources, IDictionary fcontext, AtomicReaderContext readerContext)
+        {
+            var valsArr = new FunctionValues[sources.Count];
+            int i = 0;
+            foreach (var source in sources)
+            {
+                valsArr[i++] = source.GetValues(fcontext, readerContext);
+            }
+            return valsArr;
+        }
+
+        public class Values : FunctionValues
+        {
+            private readonly MultiFunction outerInstance;
+
+            internal readonly FunctionValues[] valsArr;
+
+            public Values(MultiFunction outerInstance, FunctionValues[] valsArr)
+            {
+                this.outerInstance = outerInstance;
+                this.valsArr = valsArr;
+            }
+
+            public override string ToString(int doc)
+            {
+                return MultiFunction.ToString(outerInstance.Name, valsArr, doc);
+            }
+        }
+
+
+        public static string ToString(string name, FunctionValues[] valsArr, int doc)
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append(name).Append('(');
+            bool firstTime = true;
+            foreach (FunctionValues vals in valsArr)
+            {
+                if (firstTime)
+                {
+                    firstTime = false;
+                }
+                else
+                {
+                    sb.Append(',');
+                }
+                sb.Append(vals.ToString(doc));
+            }
+            sb.Append(')');
+            return sb.ToString();
+        }
+
+        public override void CreateWeight(IDictionary context, IndexSearcher searcher)
+        {
+            foreach (ValueSource source in sources)
+            {
+                source.CreateWeight(context, searcher);
+            }
+        }
+
+        public override int GetHashCode()
+        {
+            return sources.GetHashCode() + Name.GetHashCode();
+        }
+
+        public override bool Equals(object o)
+        {
+            if (this.GetType() != o.GetType())
+            {
+                return false;
+            }
+            var other = (MultiFunction)o;
+            return this.sources.Equals(other.sources);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs
index babb01f..a948905 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -48,15 +48,15 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
 		context["searcher"] = searcher;
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 		IndexSearcher searcher = (IndexSearcher)context["searcher"];
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
@@ -92,7 +92,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.norms = norms;
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
 			return similarity.decodeNormValue(norms.get(doc));
 		  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/NumDocsValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/NumDocsValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/NumDocsValueSource.cs
index 3a9014a..ea30074 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/NumDocsValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/NumDocsValueSource.cs
@@ -38,8 +38,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 		// Searcher has no numdocs so we must use the reader instead
 		return new ConstIntDocValues(ReaderUtil.getTopLevelContext(readerContext).reader().numDocs(), this);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
index 4828d86..8a46432 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -56,8 +56,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 	  // TODO: this is trappy? perhaps this query instead should make you pass a slow reader yourself?
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final int off = readerContext.docBase;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/PowFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/PowFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/PowFloatFunction.cs
index ec1be2a..da8c3bc 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/PowFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/PowFloatFunction.cs
@@ -39,7 +39,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 	  protected internal override float func(int doc, FunctionValues aVals, FunctionValues bVals)
 	  {
-		return (float)Math.Pow(aVals.floatVal(doc), bVals.floatVal(doc));
+		return (float)Math.Pow(aVals.FloatVal(doc), bVals.FloatVal(doc));
 	  }
 	}
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/ProductFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ProductFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/ProductFloatFunction.cs
index 85fb92b..2a21615 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ProductFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ProductFloatFunction.cs
@@ -40,7 +40,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		float val = 1.0f;
 		foreach (FunctionValues vals in valsArr)
 		{
-		  val *= vals.floatVal(doc);
+		  val *= vals.FloatVal(doc);
 		}
 		return val;
 	  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/QueryValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/QueryValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/QueryValueSource.cs
index 8ff11cb..2949747 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/QueryValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/QueryValueSource.cs
@@ -16,8 +16,8 @@
  */
 using System;
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -56,8 +56,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map fcontext, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary fcontext, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map fcontext, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary fcontext, AtomicReaderContext readerContext)
 	  {
 		return new QueryDocValues(this, readerContext, fcontext);
 	  }
@@ -78,8 +78,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
 		Weight w = searcher.createNormalizedWeight(q);
 		context[this] = w;
@@ -132,13 +132,13 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  weightSearcher = new IndexSearcher(ReaderUtil.getTopLevelContext(readerContext));
 			}
 		  }
-		  vs.createWeight(fcontext, weightSearcher);
+		  vs.CreateWeight(fcontext, weightSearcher);
 		  w = (Weight)fcontext[vs];
 		}
 		weight = w;
 	  }
 
-	  public override float floatVal(int doc)
+	  public override float FloatVal(int doc)
 	  {
 		try
 		{
@@ -313,7 +313,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 	  public override string ToString(int doc)
 	  {
-		return "query(" + q + ",def=" + defVal + ")=" + floatVal(doc);
+		return "query(" + q + ",def=" + defVal + ")=" + FloatVal(doc);
 	  }
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs
index b5993a7..de729df 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -55,18 +55,18 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
-		FunctionValues vals = source.getValues(context, readerContext);
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.GetValues(context, readerContext);
+		FunctionValues vals = source.GetValues(context, readerContext);
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues targets = target.getValues(context, readerContext);
-		FunctionValues targets = target.getValues(context, readerContext);
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues targets = target.GetValues(context, readerContext);
+		FunctionValues targets = target.GetValues(context, readerContext);
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues defaults = (this.defaultVal == null) ? null : defaultVal.getValues(context, readerContext);
-		FunctionValues defaults = (this.defaultVal == null) ? null : defaultVal.getValues(context, readerContext);
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues defaults = (this.defaultVal == null) ? null : defaultVal.GetValues(context, readerContext);
+		FunctionValues defaults = (this.defaultVal == null) ? null : defaultVal.GetValues(context, readerContext);
 		return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals, targets, defaults);
 	  }
 
@@ -86,10 +86,10 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.defaults = defaults;
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
-			float val = vals.floatVal(doc);
-			return (val >= outerInstance.min && val <= outerInstance.max) ? targets.floatVal(doc) : (outerInstance.defaultVal == null ? val : defaults.floatVal(doc));
+			float val = vals.FloatVal(doc);
+			return (val >= outerInstance.min && val <= outerInstance.max) ? targets.FloatVal(doc) : (outerInstance.defaultVal == null ? val : defaults.FloatVal(doc));
 		  }
 		  public override string ToString(int doc)
 		  {
@@ -98,19 +98,19 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
-		source.createWeight(context, searcher);
+		source.CreateWeight(context, searcher);
 	  }
 
 	  public override int GetHashCode()
 	  {
 		int h = source.GetHashCode();
 		h ^= (h << 10) | ((int)((uint)h >> 23));
-		h += float.floatToIntBits(min);
+		h += Number.FloatToIntBits(min);
 		h ^= (h << 14) | ((int)((uint)h >> 19));
-		h += float.floatToIntBits(max);
+		h += Number.FloatToIntBits(max);
 		h += target.GetHashCode();
 		if (defaultVal != null)
 		{

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs
index bcd0ebf..6a4a248 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs
@@ -16,8 +16,8 @@
  */
 using System;
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -61,12 +61,12 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
-		FunctionValues vals = source.getValues(context, readerContext);
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.GetValues(context, readerContext);
+		FunctionValues vals = source.GetValues(context, readerContext);
 		return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals);
 	  }
 
@@ -82,9 +82,9 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.vals = vals;
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
-			return outerInstance.a / (outerInstance.m * vals.floatVal(doc) + outerInstance.b);
+			return outerInstance.a / (outerInstance.m * vals.FloatVal(doc) + outerInstance.b);
 		  }
 		  public override string ToString(int doc)
 		  {
@@ -93,10 +93,10 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
-		source.createWeight(context, searcher);
+		source.CreateWeight(context, searcher);
 	  }
 
 	  public override string description()
@@ -106,9 +106,9 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 	  public override int GetHashCode()
 	  {
-		int h = float.floatToIntBits(a) + float.floatToIntBits(m);
+		int h = Number.FloatToIntBits(a) + Number.FloatToIntBits(m);
 		h ^= (h << 13) | ((int)((uint)h >> 20));
-		return h + (float.floatToIntBits(b)) + source.GetHashCode();
+		return h + (Number.FloatToIntBits(b)) + source.GetHashCode();
 	  }
 
 	  public override bool Equals(object o)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs
index 6628ea0..7a67668 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -58,8 +58,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 	  // TODO: this is trappy? perhaps this query instead should make you pass a slow reader yourself?
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final org.apache.lucene.index.IndexReader topReader = org.apache.lucene.index.ReaderUtil.getTopLevelContext(readerContext).reader();


[06/21] git commit: Merge remote-tracking branch 'pradn/fixing-tests'

Posted by sy...@apache.org.
Merge remote-tracking branch 'pradn/fixing-tests'


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/4c2aa1c9
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/4c2aa1c9
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/4c2aa1c9

Branch: refs/heads/master
Commit: 4c2aa1c9998b43ba23e56e2679b37aa3f2fc5ed5
Parents: 8452d30 99262d7
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Fri Sep 19 10:41:08 2014 +0300
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Fri Sep 19 10:41:08 2014 +0300

----------------------------------------------------------------------
 src/Lucene.Net.Core/Support/Arrays.cs           |  6 +--
 src/Lucene.Net.Core/Util/IOUtils.cs             | 20 +++++++---
 src/Lucene.Net.Core/Util/VirtualMethod.cs       | 20 ++++++----
 .../core/Util/TestDoubleBarrelLRUCache.cs       | 13 +++---
 src/Lucene.Net.Tests/core/Util/TestIOUtils.cs   | 42 +++++---------------
 src/Lucene.Net.Tests/core/Util/TestSetOnce.cs   |  5 ++-
 .../core/Util/TestVirtualMethod.cs              | 13 ++++--
 7 files changed, 60 insertions(+), 59 deletions(-)
----------------------------------------------------------------------



[02/21] git commit: Fixed TestSetOnce tests

Posted by sy...@apache.org.
Fixed TestSetOnce tests

These tests expect exceptions to be thrown, so I added that requirement
as a test attribute.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/95cd6c26
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/95cd6c26
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/95cd6c26

Branch: refs/heads/master
Commit: 95cd6c2645293ac3a9c209c86d156713bffd2601
Parents: b764030
Author: Prad Nelluru <pr...@microsoft.com>
Authored: Tue Sep 16 11:09:10 2014 -0700
Committer: Prad Nelluru <pr...@microsoft.com>
Committed: Tue Sep 16 11:09:10 2014 -0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/core/Util/TestSetOnce.cs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/95cd6c26/src/Lucene.Net.Tests/core/Util/TestSetOnce.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestSetOnce.cs b/src/Lucene.Net.Tests/core/Util/TestSetOnce.cs
index 8cdd7cf..2a97413 100644
--- a/src/Lucene.Net.Tests/core/Util/TestSetOnce.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestSetOnce.cs
@@ -64,6 +64,7 @@ namespace Lucene.Net.Util
         }
 
         [Test]
+        [ExpectedException(typeof(SetOnce<int?>.AlreadySetException))]
         public virtual void TestSettingCtor()
         {
             SetOnce<int?> set = new SetOnce<int?>(new int?(5));
@@ -72,6 +73,7 @@ namespace Lucene.Net.Util
         }
 
         [Test]
+        [ExpectedException(typeof(SetOnce<int?>.AlreadySetException))]
         public virtual void TestSetOnce_mem()
         {
             SetOnce<int?> set = new SetOnce<int?>();
@@ -85,9 +87,10 @@ namespace Lucene.Net.Util
         {
             SetOnce<int?> set = new SetOnce<int?>();
             SetOnceThread[] threads = new SetOnceThread[10];
+            Random random = Random();
             for (int i = 0; i < threads.Length; i++)
             {
-                threads[i] = new SetOnceThread(Random());
+                threads[i] = new SetOnceThread(random);
                 threads[i].Name = "t-" + (i + 1);
                 threads[i].Set = set;
             }


[12/21] Moving ValueSource -> ValueSources to avoid name conflicts

Posted by sy...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/JoinDocFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/JoinDocFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/JoinDocFreqValueSource.cs
deleted file mode 100644
index 46cc5c7..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/JoinDocFreqValueSource.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-using System;
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using BinaryDocValues = org.apache.lucene.index.BinaryDocValues;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using MultiFields = org.apache.lucene.index.MultiFields;
-	using ReaderUtil = org.apache.lucene.index.ReaderUtil;
-	using Terms = org.apache.lucene.index.Terms;
-	using TermsEnum = org.apache.lucene.index.TermsEnum;
-	using IntDocValues = org.apache.lucene.queries.function.docvalues.IntDocValues;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-	using PackedInts = org.apache.lucene.util.packed.PackedInts;
-
-	/// <summary>
-	/// Use a field value and find the Document Frequency within another field.
-	/// 
-	/// @since solr 4.0
-	/// </summary>
-	public class JoinDocFreqValueSource : FieldCacheSource
-	{
-
-	  public const string NAME = "joindf";
-
-	  protected internal readonly string qfield;
-
-	  public JoinDocFreqValueSource(string field, string qfield) : base(field)
-	  {
-		this.qfield = qfield;
-	  }
-
-	  public override string description()
-	  {
-		return NAME + "(" + field + ":(" + qfield + "))";
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.BinaryDocValues terms = cache.getTerms(readerContext.reader(), field, false, org.apache.lucene.util.packed.PackedInts.FAST);
-		BinaryDocValues terms = cache.getTerms(readerContext.reader(), field, false, PackedInts.FAST);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.IndexReader top = org.apache.lucene.index.ReaderUtil.getTopLevelContext(readerContext).reader();
-		IndexReader top = ReaderUtil.getTopLevelContext(readerContext).reader();
-		Terms t = MultiFields.getTerms(top, qfield);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.TermsEnum termsEnum = t == null ? org.apache.lucene.index.TermsEnum.EMPTY : t.iterator(null);
-		TermsEnum termsEnum = t == null ? TermsEnum.EMPTY : t.iterator(null);
-
-		return new IntDocValuesAnonymousInnerClassHelper(this, this, terms, termsEnum);
-	  }
-
-	  private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
-	  {
-		  private readonly JoinDocFreqValueSource outerInstance;
-
-		  private BinaryDocValues terms;
-		  private TermsEnum termsEnum;
-
-		  public IntDocValuesAnonymousInnerClassHelper(JoinDocFreqValueSource outerInstance, org.apache.lucene.queries.function.valuesource.JoinDocFreqValueSource this, BinaryDocValues terms, TermsEnum termsEnum) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.terms = terms;
-			  this.termsEnum = termsEnum;
-			  @ref = new BytesRef();
-		  }
-
-		  internal readonly BytesRef @ref;
-
-		  public override int intVal(int doc)
-		  {
-			try
-			{
-			  terms.get(doc, @ref);
-			  if (termsEnum.seekExact(@ref))
-			  {
-				return termsEnum.docFreq();
-			  }
-			  else
-			  {
-				return 0;
-			  }
-			}
-			catch (IOException e)
-			{
-			  throw new Exception("caught exception in function " + outerInstance.description() + " : doc=" + doc, e);
-			}
-		  }
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (o.GetType() != typeof(JoinDocFreqValueSource))
-		{
-			return false;
-		}
-		JoinDocFreqValueSource other = (JoinDocFreqValueSource)o;
-		if (!qfield.Equals(other.qfield))
-		{
-			return false;
-		}
-		return base.Equals(other);
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return qfield.GetHashCode() + base.GetHashCode();
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/LinearFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/LinearFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/LinearFloatFunction.cs
deleted file mode 100644
index a03268c..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/LinearFloatFunction.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using FloatDocValues = org.apache.lucene.queries.function.docvalues.FloatDocValues;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-
-
-	/// <summary>
-	/// <code>LinearFloatFunction</code> implements a linear function over
-	/// another <seealso cref="ValueSource"/>.
-	/// <br>
-	/// Normally Used as an argument to a <seealso cref="org.apache.lucene.queries.function.FunctionQuery"/>
-	/// 
-	/// 
-	/// </summary>
-	public class LinearFloatFunction : ValueSource
-	{
-	  protected internal readonly ValueSource source;
-	  protected internal readonly float slope;
-	  protected internal readonly float intercept;
-
-	  public LinearFloatFunction(ValueSource source, float slope, float intercept)
-	  {
-		this.source = source;
-		this.slope = slope;
-		this.intercept = intercept;
-	  }
-
-	  public override string description()
-	  {
-		return slope + "*float(" + source.description() + ")+" + intercept;
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
-		FunctionValues vals = source.getValues(context, readerContext);
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly LinearFloatFunction outerInstance;
-
-		  private FunctionValues vals;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(LinearFloatFunction outerInstance, org.apache.lucene.queries.function.valuesource.LinearFloatFunction this, FunctionValues vals) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.vals = vals;
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return vals.floatVal(doc) * outerInstance.slope + outerInstance.intercept;
-		  }
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.slope + "*float(" + vals.ToString(doc) + ")+" + outerInstance.intercept;
-		  }
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		source.createWeight(context, searcher);
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = float.floatToIntBits(slope);
-		h = ((int)((uint)h >> 2)) | (h << 30);
-		h += float.floatToIntBits(intercept);
-		h ^= (h << 14) | ((int)((uint)h >> 19));
-		return h + source.GetHashCode();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (typeof(LinearFloatFunction) != o.GetType())
-		{
-			return false;
-		}
-		LinearFloatFunction other = (LinearFloatFunction)o;
-		return this.slope == other.slope && this.intercept == other.intercept && this.source.Equals(other.source);
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/LiteralValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/LiteralValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/LiteralValueSource.cs
deleted file mode 100644
index 6107a28..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/LiteralValueSource.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-using System.Collections;
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using StrDocValues = org.apache.lucene.queries.function.docvalues.StrDocValues;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-
-
-
-	/// <summary>
-	/// Pass a the field value through as a String, no matter the type // Q: doesn't this mean it's a "string"?
-	/// 
-	/// 
-	/// </summary>
-	public class LiteralValueSource : ValueSource
-	{
-	  protected internal readonly string @string;
-	  protected internal readonly BytesRef bytesRef;
-
-	  public LiteralValueSource(string @string)
-	  {
-		this.@string = @string;
-		this.bytesRef = new BytesRef(@string);
-	  }
-
-	  /// <summary>
-	  /// returns the literal value </summary>
-	  public virtual string Value
-	  {
-		  get
-		  {
-			return @string;
-		  }
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-
-		return new StrDocValuesAnonymousInnerClassHelper(this, this);
-	  }
-
-	  private class StrDocValuesAnonymousInnerClassHelper : StrDocValues
-	  {
-		  private readonly LiteralValueSource outerInstance;
-
-		  public StrDocValuesAnonymousInnerClassHelper(LiteralValueSource outerInstance, org.apache.lucene.queries.function.valuesource.LiteralValueSource this) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-		  }
-
-		  public override string strVal(int doc)
-		  {
-			return outerInstance.@string;
-		  }
-
-		  public override bool bytesVal(int doc, BytesRef target)
-		  {
-			target.copyBytes(outerInstance.bytesRef);
-			return true;
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.@string;
-		  }
-	  }
-
-	  public override string description()
-	  {
-		return "literal(" + @string + ")";
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this == o)
-		{
-			return true;
-		}
-		if (!(o is LiteralValueSource))
-		{
-			return false;
-		}
-
-		LiteralValueSource that = (LiteralValueSource) o;
-
-		return @string.Equals(that.@string);
-
-	  }
-
-	  public static readonly int hash = typeof(LiteralValueSource).GetHashCode();
-	  public override int GetHashCode()
-	  {
-		return hash + @string.GetHashCode();
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/LongFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/LongFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/LongFieldSource.cs
deleted file mode 100644
index d831ebd..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/LongFieldSource.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-using System;
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using LongDocValues = org.apache.lucene.queries.function.docvalues.LongDocValues;
-	using FieldCache = org.apache.lucene.search.FieldCache;
-	using Bits = org.apache.lucene.util.Bits;
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueLong = org.apache.lucene.util.mutable.MutableValueLong;
-
-	/// <summary>
-	/// Obtains long field values from <seealso cref="FieldCache#getLongs"/> and makes those
-	/// values available as other numeric types, casting as needed.
-	/// </summary>
-	public class LongFieldSource : FieldCacheSource
-	{
-
-	  protected internal readonly FieldCache.LongParser parser;
-
-	  public LongFieldSource(string field) : this(field, null)
-	  {
-	  }
-
-	  public LongFieldSource(string field, FieldCache.LongParser parser) : base(field)
-	  {
-		this.parser = parser;
-	  }
-
-	  public override string description()
-	  {
-		return "long(" + field + ')';
-	  }
-
-	  public virtual long externalToLong(string extVal)
-	  {
-		return Convert.ToInt64(extVal);
-	  }
-
-	  public virtual object longToObject(long val)
-	  {
-		return val;
-	  }
-
-	  public virtual string longToString(long val)
-	  {
-		return longToObject(val).ToString();
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Longs arr = cache.getLongs(readerContext.reader(), field, parser, true);
-		FieldCache.Longs arr = cache.getLongs(readerContext.reader(), field, parser, true);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.Bits valid = cache.getDocsWithField(readerContext.reader(), field);
-		Bits valid = cache.getDocsWithField(readerContext.reader(), field);
-
-		return new LongDocValuesAnonymousInnerClassHelper(this, this, arr, valid);
-	  }
-
-	  private class LongDocValuesAnonymousInnerClassHelper : LongDocValues
-	  {
-		  private readonly LongFieldSource outerInstance;
-
-		  private FieldCache.Longs arr;
-		  private Bits valid;
-
-		  public LongDocValuesAnonymousInnerClassHelper(LongFieldSource outerInstance, org.apache.lucene.queries.function.valuesource.LongFieldSource this, FieldCache.Longs arr, Bits valid) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.arr = arr;
-			  this.valid = valid;
-		  }
-
-		  public override long longVal(int doc)
-		  {
-			return arr.get(doc);
-		  }
-
-		  public override bool exists(int doc)
-		  {
-			return arr.get(doc) != 0 || valid.get(doc);
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return valid.get(doc) ? outerInstance.longToObject(arr.get(doc)) : null;
-		  }
-
-		  public override string strVal(int doc)
-		  {
-			return valid.get(doc) ? outerInstance.longToString(arr.get(doc)) : null;
-		  }
-
-		  protected internal override long externalToLong(string extVal)
-		  {
-			return outerInstance.externalToLong(extVal);
-		  }
-
-		  public override ValueFiller ValueFiller
-		  {
-			  get
-			  {
-				return new ValueFillerAnonymousInnerClassHelper(this);
-			  }
-		  }
-
-		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-		  {
-			  private readonly LongDocValuesAnonymousInnerClassHelper outerInstance;
-
-			  public ValueFillerAnonymousInnerClassHelper(LongDocValuesAnonymousInnerClassHelper outerInstance)
-			  {
-				  this.outerInstance = outerInstance;
-				  mval = outerInstance.outerInstance.newMutableValueLong();
-			  }
-
-			  private readonly MutableValueLong mval;
-
-			  public override MutableValue Value
-			  {
-				  get
-				  {
-					return mval;
-				  }
-			  }
-
-			  public override void fillValue(int doc)
-			  {
-				mval.value = outerInstance.arr.get(doc);
-				mval.exists = mval.value != 0 || outerInstance.valid.get(doc);
-			  }
-		  }
-
-	  }
-
-	  protected internal virtual MutableValueLong newMutableValueLong()
-	  {
-		return new MutableValueLong();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (o.GetType() != this.GetType())
-		{
-			return false;
-		}
-		LongFieldSource other = (LongFieldSource) o;
-		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = parser == null ? this.GetType().GetHashCode() : parser.GetType().GetHashCode();
-		h += base.GetHashCode();
-		return h;
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/MaxDocValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/MaxDocValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/MaxDocValueSource.cs
deleted file mode 100644
index 0e00953..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/MaxDocValueSource.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexReader = org.apache.lucene.index.IndexReader; // javadocs
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-
-
-	/// <summary>
-	/// Returns the value of <seealso cref="IndexReader#maxDoc()"/>
-	/// for every document. This is the number of documents
-	/// including deletions.
-	/// </summary>
-	public class MaxDocValueSource : ValueSource
-	{
-	  public virtual string name()
-	  {
-		return "maxdoc";
-	  }
-
-	  public override string description()
-	  {
-		return name() + "()";
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		context["searcher"] = searcher;
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		IndexSearcher searcher = (IndexSearcher)context["searcher"];
-		return new ConstIntDocValues(searcher.IndexReader.maxDoc(), this);
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		return this.GetType() == o.GetType();
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return this.GetType().GetHashCode();
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/MaxFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/MaxFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/MaxFloatFunction.cs
deleted file mode 100644
index 24034c3..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/MaxFloatFunction.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	/// <summary>
-	/// <code>MaxFloatFunction</code> returns the max of it's components.
-	/// </summary>
-	public class MaxFloatFunction : MultiFloatFunction
-	{
-	  public MaxFloatFunction(ValueSource[] sources) : base(sources)
-	  {
-	  }
-
-	  protected internal override string name()
-	  {
-		return "max";
-	  }
-
-	  protected internal override float func(int doc, FunctionValues[] valsArr)
-	  {
-		if (valsArr.Length == 0)
-		{
-			return 0.0f;
-		}
-		float val = float.NegativeInfinity;
-		foreach (FunctionValues vals in valsArr)
-		{
-		  val = Math.Max(vals.floatVal(doc), val);
-		}
-		return val;
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/MinFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/MinFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/MinFloatFunction.cs
deleted file mode 100644
index f4abce7..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/MinFloatFunction.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	/// <summary>
-	/// <code>MinFloatFunction</code> returns the min of it's components.
-	/// </summary>
-	public class MinFloatFunction : MultiFloatFunction
-	{
-	  public MinFloatFunction(ValueSource[] sources) : base(sources)
-	  {
-	  }
-
-	  protected internal override string name()
-	  {
-		return "min";
-	  }
-
-	  protected internal override float func(int doc, FunctionValues[] valsArr)
-	  {
-		if (valsArr.Length == 0)
-		{
-			return 0.0f;
-		}
-		float val = float.PositiveInfinity;
-		foreach (FunctionValues vals in valsArr)
-		{
-		  val = Math.Min(vals.floatVal(doc), val);
-		}
-		return val;
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/MultiBoolFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/MultiBoolFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/MultiBoolFunction.cs
deleted file mode 100644
index 56810a3..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/MultiBoolFunction.cs
+++ /dev/null
@@ -1,148 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using System.Text;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using BoolDocValues = org.apache.lucene.queries.function.docvalues.BoolDocValues;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-
-
-	/// <summary>
-	/// Abstract <seealso cref="ValueSource"/> implementation which wraps multiple ValueSources
-	/// and applies an extendible boolean function to their values.
-	/// 
-	/// </summary>
-	public abstract class MultiBoolFunction : BoolFunction
-	{
-	  protected internal readonly IList<ValueSource> sources;
-
-	  public MultiBoolFunction(IList<ValueSource> sources)
-	  {
-		this.sources = sources;
-	  }
-
-	  protected internal abstract string name();
-
-	  protected internal abstract bool func(int doc, FunctionValues[] vals);
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.docvalues.BoolDocValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override BoolDocValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues[] vals = new org.apache.lucene.queries.function.FunctionValues[sources.size()];
-		FunctionValues[] vals = new FunctionValues[sources.Count];
-		int i = 0;
-		foreach (ValueSource source in sources)
-		{
-		  vals[i++] = source.getValues(context, readerContext);
-		}
-
-		return new BoolDocValuesAnonymousInnerClassHelper(this, this, vals);
-	  }
-
-	  private class BoolDocValuesAnonymousInnerClassHelper : BoolDocValues
-	  {
-		  private readonly MultiBoolFunction outerInstance;
-
-		  private FunctionValues[] vals;
-
-		  public BoolDocValuesAnonymousInnerClassHelper(MultiBoolFunction outerInstance, org.apache.lucene.queries.function.valuesource.MultiBoolFunction this, FunctionValues[] vals) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.vals = vals;
-		  }
-
-		  public override bool boolVal(int doc)
-		  {
-			return outerInstance.func(doc, vals);
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			StringBuilder sb = new StringBuilder(outerInstance.name());
-			sb.Append('(');
-			bool first = true;
-			foreach (FunctionValues dv in vals)
-			{
-			  if (first)
-			  {
-				first = false;
-			  }
-			  else
-			  {
-				sb.Append(',');
-			  }
-			  sb.Append(dv.ToString(doc));
-			}
-			return sb.ToString();
-		  }
-	  }
-
-	  public override string description()
-	  {
-		StringBuilder sb = new StringBuilder(name());
-		sb.Append('(');
-		bool first = true;
-		foreach (ValueSource source in sources)
-		{
-		  if (first)
-		  {
-			first = false;
-		  }
-		  else
-		  {
-			sb.Append(',');
-		  }
-		  sb.Append(source.description());
-		}
-		return sb.ToString();
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return sources.GetHashCode() + name().GetHashCode();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		MultiBoolFunction other = (MultiBoolFunction)o;
-		return this.sources.Equals(other.sources);
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		foreach (ValueSource source in sources)
-		{
-		  source.createWeight(context, searcher);
-		}
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/MultiFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/MultiFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/MultiFloatFunction.cs
deleted file mode 100644
index 90b56ff..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/MultiFloatFunction.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-using System.Collections;
-using System.Text;
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using FloatDocValues = org.apache.lucene.queries.function.docvalues.FloatDocValues;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-
-
-
-	/// <summary>
-	/// Abstract <seealso cref="ValueSource"/> implementation which wraps multiple ValueSources
-	/// and applies an extendible float function to their values.
-	/// 
-	/// </summary>
-	public abstract class MultiFloatFunction : ValueSource
-	{
-	  protected internal readonly ValueSource[] sources;
-
-	  public MultiFloatFunction(ValueSource[] sources)
-	  {
-		this.sources = sources;
-	  }
-
-	  protected internal abstract string name();
-	  protected internal abstract float func(int doc, FunctionValues[] valsArr);
-
-	  public override string description()
-	  {
-		StringBuilder sb = new StringBuilder();
-		sb.Append(name()).Append('(');
-		bool firstTime = true;
-		foreach (ValueSource source in sources)
-		{
-		  if (firstTime)
-		  {
-			firstTime = false;
-		  }
-		  else
-		  {
-			sb.Append(',');
-		  }
-		  sb.Append(source);
-		}
-		sb.Append(')');
-		return sb.ToString();
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues[] valsArr = new org.apache.lucene.queries.function.FunctionValues[sources.length];
-		FunctionValues[] valsArr = new FunctionValues[sources.Length];
-		for (int i = 0; i < sources.Length; i++)
-		{
-		  valsArr[i] = sources[i].getValues(context, readerContext);
-		}
-
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, valsArr);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly MultiFloatFunction outerInstance;
-
-		  private FunctionValues[] valsArr;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(MultiFloatFunction outerInstance, org.apache.lucene.queries.function.valuesource.MultiFloatFunction this, FunctionValues[] valsArr) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.valsArr = valsArr;
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return outerInstance.func(doc, valsArr);
-		  }
-		   public override string ToString(int doc)
-		   {
-			StringBuilder sb = new StringBuilder();
-			sb.Append(outerInstance.name()).Append('(');
-			bool firstTime = true;
-			foreach (FunctionValues vals in valsArr)
-			{
-			  if (firstTime)
-			  {
-				firstTime = false;
-			  }
-			  else
-			  {
-				sb.Append(',');
-			  }
-			  sb.Append(vals.ToString(doc));
-			}
-			sb.Append(')');
-			return sb.ToString();
-		   }
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		foreach (ValueSource source in sources)
-		{
-		  source.createWeight(context, searcher);
-		}
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return Arrays.GetHashCode(sources) + name().GetHashCode();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		MultiFloatFunction other = (MultiFloatFunction)o;
-		return this.name().Equals(other.name()) && Arrays.Equals(this.sources, other.sources);
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/MultiFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/MultiFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/MultiFunction.cs
deleted file mode 100644
index 089d21c..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/MultiFunction.cs
+++ /dev/null
@@ -1,161 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using System.Text;
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-
-
-	/// <summary>
-	/// Abstract parent class for <seealso cref="ValueSource"/> implementations that wrap multiple
-	/// ValueSources and apply their own logic.
-	/// </summary>
-	public abstract class MultiFunction : ValueSource
-	{
-	  protected internal readonly IList<ValueSource> sources;
-
-	  public MultiFunction(IList<ValueSource> sources)
-	  {
-		this.sources = sources;
-	  }
-
-	  protected internal abstract string name();
-
-	  public override string description()
-	  {
-		return description(name(), sources);
-	  }
-
-	  public static string description(string name, IList<ValueSource> sources)
-	  {
-		StringBuilder sb = new StringBuilder();
-		sb.Append(name).Append('(');
-		bool firstTime = true;
-		foreach (ValueSource source in sources)
-		{
-		  if (firstTime)
-		  {
-			firstTime = false;
-		  }
-		  else
-		  {
-			sb.Append(',');
-		  }
-		  sb.Append(source);
-		}
-		sb.Append(')');
-		return sb.ToString();
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public static org.apache.lucene.queries.function.FunctionValues[] valsArr(java.util.List<org.apache.lucene.queries.function.ValueSource> sources, java.util.Map fcontext, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public static FunctionValues[] valsArr(IList<ValueSource> sources, IDictionary fcontext, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues[] valsArr = new org.apache.lucene.queries.function.FunctionValues[sources.size()];
-		FunctionValues[] valsArr = new FunctionValues[sources.Count];
-		int i = 0;
-		foreach (ValueSource source in sources)
-		{
-		  valsArr[i++] = source.getValues(fcontext, readerContext);
-		}
-		return valsArr;
-	  }
-
-	  public class Values : FunctionValues
-	  {
-		  private readonly MultiFunction outerInstance;
-
-		internal readonly FunctionValues[] valsArr;
-
-		public Values(MultiFunction outerInstance, FunctionValues[] valsArr)
-		{
-			this.outerInstance = outerInstance;
-		  this.valsArr = valsArr;
-		}
-
-		public override string ToString(int doc)
-		{
-		  return MultiFunction.ToString(outerInstance.name(), valsArr, doc);
-		}
-
-		public override ValueFiller ValueFiller
-		{
-			get
-			{
-			  // TODO: need ValueSource.type() to determine correct type
-			  return base.ValueFiller;
-			}
-		}
-	  }
-
-
-	  public static string ToString(string name, FunctionValues[] valsArr, int doc)
-	  {
-		StringBuilder sb = new StringBuilder();
-		sb.Append(name).Append('(');
-		bool firstTime = true;
-		foreach (FunctionValues vals in valsArr)
-		{
-		  if (firstTime)
-		  {
-			firstTime = false;
-		  }
-		  else
-		  {
-			sb.Append(',');
-		  }
-		  sb.Append(vals.ToString(doc));
-		}
-		sb.Append(')');
-		return sb.ToString();
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		foreach (ValueSource source in sources)
-		{
-		  source.createWeight(context, searcher);
-		}
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return sources.GetHashCode() + name().GetHashCode();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		MultiFunction other = (MultiFunction)o;
-		return this.sources.Equals(other.sources);
-	  }
-	}
-
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/MultiValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/MultiValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/MultiValueSource.cs
deleted file mode 100644
index 908eae9..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/MultiValueSource.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-namespace org.apache.lucene.queries.function.valuesource
-{
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-
-	/// <summary>
-	/// A <seealso cref="ValueSource"/> that abstractly represents <seealso cref="ValueSource"/>s for
-	/// poly fields, and other things.
-	/// 
-	/// </summary>
-	public abstract class MultiValueSource : ValueSource
-	{
-
-	  public abstract int dimension();
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/NormValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/NormValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/NormValueSource.cs
deleted file mode 100644
index d0de6c1..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/NormValueSource.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using NumericDocValues = org.apache.lucene.index.NumericDocValues;
-	using FloatDocValues = org.apache.lucene.queries.function.docvalues.FloatDocValues;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-	using TFIDFSimilarity = org.apache.lucene.search.similarities.TFIDFSimilarity;
-
-
-	/// <summary>
-	/// Function that returns <seealso cref="TFIDFSimilarity#decodeNormValue(long)"/>
-	/// for every document.
-	/// <para>
-	/// Note that the configured Similarity for the field must be
-	/// a subclass of <seealso cref="TFIDFSimilarity"/>
-	/// @lucene.internal 
-	/// </para>
-	/// </summary>
-	public class NormValueSource : ValueSource
-	{
-	  protected internal readonly string field;
-	  public NormValueSource(string field)
-	  {
-		this.field = field;
-	  }
-
-	  public virtual string name()
-	  {
-		return "norm";
-	  }
-
-	  public override string description()
-	  {
-		return name() + '(' + field + ')';
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		context["searcher"] = searcher;
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		IndexSearcher searcher = (IndexSearcher)context["searcher"];
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.similarities.TFIDFSimilarity similarity = IDFValueSource.asTFIDF(searcher.getSimilarity(), field);
-		TFIDFSimilarity similarity = IDFValueSource.asTFIDF(searcher.Similarity, field);
-		if (similarity == null)
-		{
-		  throw new System.NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)");
-		}
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.NumericDocValues norms = readerContext.reader().getNormValues(field);
-		NumericDocValues norms = readerContext.reader().getNormValues(field);
-
-		if (norms == null)
-		{
-		  return new ConstDoubleDocValues(0.0, this);
-		}
-
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, similarity, norms);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly NormValueSource outerInstance;
-
-		  private TFIDFSimilarity similarity;
-		  private NumericDocValues norms;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(NormValueSource outerInstance, org.apache.lucene.queries.function.valuesource.NormValueSource this, TFIDFSimilarity similarity, NumericDocValues norms) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.similarity = similarity;
-			  this.norms = norms;
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return similarity.decodeNormValue(norms.get(doc));
-		  }
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-		  return false;
-		}
-		return this.field.Equals(((NormValueSource)o).field);
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return this.GetType().GetHashCode() + field.GetHashCode();
-	  }
-	}
-
-
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/NumDocsValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/NumDocsValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/NumDocsValueSource.cs
deleted file mode 100644
index b5e6669..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/NumDocsValueSource.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using ReaderUtil = org.apache.lucene.index.ReaderUtil;
-
-
-	/// <summary>
-	/// Returns the value of <seealso cref="IndexReader#numDocs()"/>
-	/// for every document. This is the number of documents
-	/// excluding deletions.
-	/// </summary>
-	public class NumDocsValueSource : ValueSource
-	{
-	  public virtual string name()
-	  {
-		return "numdocs";
-	  }
-
-	  public override string description()
-	  {
-		return name() + "()";
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		// Searcher has no numdocs so we must use the reader instead
-		return new ConstIntDocValues(ReaderUtil.getTopLevelContext(readerContext).reader().numDocs(), this);
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		return this.GetType() == o.GetType();
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return this.GetType().GetHashCode();
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/OrdFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/OrdFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/OrdFieldSource.cs
deleted file mode 100644
index 123327f..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/OrdFieldSource.cs
+++ /dev/null
@@ -1,175 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	using AtomicReader = org.apache.lucene.index.AtomicReader;
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using CompositeReader = org.apache.lucene.index.CompositeReader;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using ReaderUtil = org.apache.lucene.index.ReaderUtil;
-	using SlowCompositeReaderWrapper = org.apache.lucene.index.SlowCompositeReaderWrapper;
-	using SortedDocValues = org.apache.lucene.index.SortedDocValues;
-	using IntDocValues = org.apache.lucene.queries.function.docvalues.IntDocValues;
-	using FieldCache = org.apache.lucene.search.FieldCache;
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueInt = org.apache.lucene.util.mutable.MutableValueInt;
-
-	/// <summary>
-	/// Obtains the ordinal of the field value from the default Lucene <seealso cref="org.apache.lucene.search.FieldCache"/> using getStringIndex().
-	/// <br>
-	/// The native lucene index order is used to assign an ordinal value for each field value.
-	/// <br>Field values (terms) are lexicographically ordered by unicode value, and numbered starting at 1.
-	/// <br>
-	/// Example:<br>
-	///  If there were only three field values: "apple","banana","pear"
-	/// <br>then ord("apple")=1, ord("banana")=2, ord("pear")=3
-	/// <para>
-	/// WARNING: ord() depends on the position in an index and can thus change when other documents are inserted or deleted,
-	///  or if a MultiSearcher is used.
-	/// <br>WARNING: as of Solr 1.4, ord() and rord() can cause excess memory use since they must use a FieldCache entry
-	/// at the top level reader, while sorting and function queries now use entries at the segment level.  Hence sorting
-	/// or using a different function query, in addition to ord()/rord() will double memory use.
-	/// 
-	/// </para>
-	/// </summary>
-
-	public class OrdFieldSource : ValueSource
-	{
-	  protected internal readonly string field;
-
-	  public OrdFieldSource(string field)
-	  {
-		this.field = field;
-	  }
-
-	  public override string description()
-	  {
-		return "ord(" + field + ')';
-	  }
-
-
-	  // TODO: this is trappy? perhaps this query instead should make you pass a slow reader yourself?
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int off = readerContext.docBase;
-		int off = readerContext.docBase;
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.IndexReader topReader = org.apache.lucene.index.ReaderUtil.getTopLevelContext(readerContext).reader();
-		IndexReader topReader = ReaderUtil.getTopLevelContext(readerContext).reader();
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.AtomicReader r = org.apache.lucene.index.SlowCompositeReaderWrapper.wrap(topReader);
-		AtomicReader r = SlowCompositeReaderWrapper.wrap(topReader);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.SortedDocValues sindex = org.apache.lucene.search.FieldCache.DEFAULT.getTermsIndex(r, field);
-		SortedDocValues sindex = FieldCache.DEFAULT.getTermsIndex(r, field);
-		return new IntDocValuesAnonymousInnerClassHelper(this, this, off, sindex);
-	  }
-
-	  private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
-	  {
-		  private readonly OrdFieldSource outerInstance;
-
-		  private int off;
-		  private SortedDocValues sindex;
-
-		  public IntDocValuesAnonymousInnerClassHelper(OrdFieldSource outerInstance, org.apache.lucene.queries.function.valuesource.OrdFieldSource this, int off, SortedDocValues sindex) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.off = off;
-			  this.sindex = sindex;
-		  }
-
-		  protected internal virtual string toTerm(string readableValue)
-		  {
-			return readableValue;
-		  }
-		  public override int intVal(int doc)
-		  {
-			return sindex.getOrd(doc + off);
-		  }
-		  public override int ordVal(int doc)
-		  {
-			return sindex.getOrd(doc + off);
-		  }
-		  public override int numOrd()
-		  {
-			return sindex.ValueCount;
-		  }
-
-		  public override bool exists(int doc)
-		  {
-			return sindex.getOrd(doc + off) != 0;
-		  }
-
-		  public override ValueFiller ValueFiller
-		  {
-			  get
-			  {
-				return new ValueFillerAnonymousInnerClassHelper(this);
-			  }
-		  }
-
-		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-		  {
-			  private readonly IntDocValuesAnonymousInnerClassHelper outerInstance;
-
-			  public ValueFillerAnonymousInnerClassHelper(IntDocValuesAnonymousInnerClassHelper outerInstance)
-			  {
-				  this.outerInstance = outerInstance;
-				  mval = new MutableValueInt();
-			  }
-
-			  private readonly MutableValueInt mval;
-
-			  public override MutableValue Value
-			  {
-				  get
-				  {
-					return mval;
-				  }
-			  }
-
-			  public override void fillValue(int doc)
-			  {
-				mval.value = outerInstance.sindex.getOrd(doc);
-				mval.exists = mval.value != 0;
-			  }
-		  }
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		return o != null && o.GetType() == typeof(OrdFieldSource) && this.field.Equals(((OrdFieldSource)o).field);
-	  }
-
-	  private static readonly int hcode = typeof(OrdFieldSource).GetHashCode();
-	  public override int GetHashCode()
-	  {
-		return hcode + field.GetHashCode();
-	  }
-
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/PowFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/PowFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/PowFloatFunction.cs
deleted file mode 100644
index 99b4c42..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/PowFloatFunction.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	/// <summary>
-	/// Function to raise the base "a" to the power "b"
-	/// </summary>
-	public class PowFloatFunction : DualFloatFunction
-	{
-	 /// <param name="a">  the base. </param>
-	 /// <param name="b">  the exponent. </param>
-	  public PowFloatFunction(ValueSource a, ValueSource b) : base(a,b)
-	  {
-	  }
-
-	  protected internal override string name()
-	  {
-		return "pow";
-	  }
-
-	  protected internal override float func(int doc, FunctionValues aVals, FunctionValues bVals)
-	  {
-		return (float)Math.Pow(aVals.floatVal(doc), bVals.floatVal(doc));
-	  }
-	}
-
-
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/ProductFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/ProductFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/ProductFloatFunction.cs
deleted file mode 100644
index 92cc4d7..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/ProductFloatFunction.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	/// <summary>
-	/// <code>ProductFloatFunction</code> returns the product of it's components.
-	/// </summary>
-	public class ProductFloatFunction : MultiFloatFunction
-	{
-	  public ProductFloatFunction(ValueSource[] sources) : base(sources)
-	  {
-	  }
-
-	  protected internal override string name()
-	  {
-		return "product";
-	  }
-
-	  protected internal override float func(int doc, FunctionValues[] valsArr)
-	  {
-		float val = 1.0f;
-		foreach (FunctionValues vals in valsArr)
-		{
-		  val *= vals.floatVal(doc);
-		}
-		return val;
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/QueryValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/QueryValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/QueryValueSource.cs
deleted file mode 100644
index 9abc198..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/QueryValueSource.cs
+++ /dev/null
@@ -1,328 +0,0 @@
-using System;
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using ReaderUtil = org.apache.lucene.index.ReaderUtil;
-	using FloatDocValues = org.apache.lucene.queries.function.docvalues.FloatDocValues;
-	using org.apache.lucene.search;
-	using Bits = org.apache.lucene.util.Bits;
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueFloat = org.apache.lucene.util.mutable.MutableValueFloat;
-
-
-	/// <summary>
-	/// <code>QueryValueSource</code> returns the relevance score of the query
-	/// </summary>
-	public class QueryValueSource : ValueSource
-	{
-	  internal readonly Query q;
-	  internal readonly float defVal;
-
-	  public QueryValueSource(Query q, float defVal)
-	  {
-		this.q = q;
-		this.defVal = defVal;
-	  }
-
-	  public virtual Query Query
-	  {
-		  get
-		  {
-			  return q;
-		  }
-	  }
-	  public virtual float DefaultValue
-	  {
-		  get
-		  {
-			  return defVal;
-		  }
-	  }
-
-	  public override string description()
-	  {
-		return "query(" + q + ",def=" + defVal + ")";
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map fcontext, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary fcontext, AtomicReaderContext readerContext)
-	  {
-		return new QueryDocValues(this, readerContext, fcontext);
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return q.GetHashCode() * 29;
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (typeof(QueryValueSource) != o.GetType())
-		{
-			return false;
-		}
-		QueryValueSource other = (QueryValueSource)o;
-		return this.q.Equals(other.q) && this.defVal == other.defVal;
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		Weight w = searcher.createNormalizedWeight(q);
-		context[this] = w;
-	  }
-	}
-
-
-	internal class QueryDocValues : FloatDocValues
-	{
-	  internal readonly AtomicReaderContext readerContext;
-	  internal readonly Bits acceptDocs;
-	  internal readonly Weight weight;
-	  internal readonly float defVal;
-	  internal readonly IDictionary fcontext;
-	  internal readonly Query q;
-
-	  internal Scorer scorer;
-	  internal int scorerDoc; // the document the scorer is on
-	  internal bool noMatches = false;
-
-	  // the last document requested... start off with high value
-	  // to trigger a scorer reset on first access.
-	  internal int lastDocRequested = int.MaxValue;
-
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public QueryDocValues(QueryValueSource vs, org.apache.lucene.index.AtomicReaderContext readerContext, java.util.Map fcontext) throws java.io.IOException
-	  public QueryDocValues(QueryValueSource vs, AtomicReaderContext readerContext, IDictionary fcontext) : base(vs)
-	  {
-
-		this.readerContext = readerContext;
-		this.acceptDocs = readerContext.reader().LiveDocs;
-		this.defVal = vs.defVal;
-		this.q = vs.q;
-		this.fcontext = fcontext;
-
-		Weight w = fcontext == null ? null : (Weight)fcontext[vs];
-		if (w == null)
-		{
-		  IndexSearcher weightSearcher;
-		  if (fcontext == null)
-		  {
-			weightSearcher = new IndexSearcher(ReaderUtil.getTopLevelContext(readerContext));
-		  }
-		  else
-		  {
-			weightSearcher = (IndexSearcher)fcontext["searcher"];
-			if (weightSearcher == null)
-			{
-			  weightSearcher = new IndexSearcher(ReaderUtil.getTopLevelContext(readerContext));
-			}
-		  }
-		  vs.createWeight(fcontext, weightSearcher);
-		  w = (Weight)fcontext[vs];
-		}
-		weight = w;
-	  }
-
-	  public override float floatVal(int doc)
-	  {
-		try
-		{
-		  if (doc < lastDocRequested)
-		  {
-			if (noMatches)
-			{
-				return defVal;
-			}
-			scorer = weight.scorer(readerContext, acceptDocs);
-			if (scorer == null)
-			{
-			  noMatches = true;
-			  return defVal;
-			}
-			scorerDoc = -1;
-		  }
-		  lastDocRequested = doc;
-
-		  if (scorerDoc < doc)
-		  {
-			scorerDoc = scorer.advance(doc);
-		  }
-
-		  if (scorerDoc > doc)
-		  {
-			// query doesn't match this document... either because we hit the
-			// end, or because the next doc is after this doc.
-			return defVal;
-		  }
-
-		  // a match!
-		  return scorer.score();
-		}
-		catch (IOException e)
-		{
-		  throw new Exception("caught exception in QueryDocVals(" + q + ") doc=" + doc, e);
-		}
-	  }
-
-	  public override bool exists(int doc)
-	  {
-		try
-		{
-		  if (doc < lastDocRequested)
-		  {
-			if (noMatches)
-			{
-				return false;
-			}
-			scorer = weight.scorer(readerContext, acceptDocs);
-			scorerDoc = -1;
-			if (scorer == null)
-			{
-			  noMatches = true;
-			  return false;
-			}
-		  }
-		  lastDocRequested = doc;
-
-		  if (scorerDoc < doc)
-		  {
-			scorerDoc = scorer.advance(doc);
-		  }
-
-		  if (scorerDoc > doc)
-		  {
-			// query doesn't match this document... either because we hit the
-			// end, or because the next doc is after this doc.
-			return false;
-		  }
-
-		  // a match!
-		  return true;
-		}
-		catch (IOException e)
-		{
-		  throw new Exception("caught exception in QueryDocVals(" + q + ") doc=" + doc, e);
-		}
-	  }
-
-	   public override object objectVal(int doc)
-	   {
-		 try
-		 {
-		   return exists(doc) ? scorer.score() : null;
-		 }
-		 catch (IOException e)
-		 {
-		   throw new Exception("caught exception in QueryDocVals(" + q + ") doc=" + doc, e);
-		 }
-	   }
-
-	  public override ValueFiller ValueFiller
-	  {
-		  get
-		  {
-			//
-			// TODO: if we want to support more than one value-filler or a value-filler in conjunction with
-			// the FunctionValues, then members like "scorer" should be per ValueFiller instance.
-			// Or we can say that the user should just instantiate multiple FunctionValues.
-			//
-			return new ValueFillerAnonymousInnerClassHelper(this);
-		  }
-	  }
-
-	  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-	  {
-		  private readonly QueryDocValues outerInstance;
-
-		  public ValueFillerAnonymousInnerClassHelper(QueryDocValues outerInstance)
-		  {
-			  this.outerInstance = outerInstance;
-			  mval = new MutableValueFloat();
-		  }
-
-		  private readonly MutableValueFloat mval;
-
-		  public override MutableValue Value
-		  {
-			  get
-			  {
-				return mval;
-			  }
-		  }
-
-		  public override void fillValue(int doc)
-		  {
-			try
-			{
-			  if (outerInstance.noMatches)
-			  {
-				mval.value = outerInstance.defVal;
-				mval.exists = false;
-				return;
-			  }
-			  outerInstance.scorer = outerInstance.weight.scorer(outerInstance.readerContext, outerInstance.acceptDocs);
-			  outerInstance.scorerDoc = -1;
-			  if (outerInstance.scorer == null)
-			  {
-				outerInstance.noMatches = true;
-				mval.value = outerInstance.defVal;
-				mval.exists = false;
-				return;
-			  }
-			  outerInstance.lastDocRequested = doc;
-
-			  if (outerInstance.scorerDoc < doc)
-			  {
-				outerInstance.scorerDoc = outerInstance.scorer.advance(doc);
-			  }
-
-			  if (outerInstance.scorerDoc > doc)
-			  {
-				// query doesn't match this document... either because we hit the
-				// end, or because the next doc is after this doc.
-				mval.value = outerInstance.defVal;
-				mval.exists = false;
-				return;
-			  }
-
-			  // a match!
-			  mval.value = outerInstance.scorer.score();
-			  mval.exists = true;
-			}
-			catch (IOException e)
-			{
-			  throw new Exception("caught exception in QueryDocVals(" + outerInstance.q + ") doc=" + doc, e);
-			}
-		  }
-	  }
-
-	  public override string ToString(int doc)
-	  {
-		return "query(" + q + ",def=" + defVal + ")=" + floatVal(doc);
-	  }
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/RangeMapFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/RangeMapFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/RangeMapFloatFunction.cs
deleted file mode 100644
index d6cf6df..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/RangeMapFloatFunction.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using FloatDocValues = org.apache.lucene.queries.function.docvalues.FloatDocValues;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-
-
-	/// <summary>
-	/// <code>RangeMapFloatFunction</code> implements a map function over
-	/// another <seealso cref="ValueSource"/> whose values fall within min and max inclusive to target.
-	/// <br>
-	/// Normally Used as an argument to a <seealso cref="org.apache.lucene.queries.function.FunctionQuery"/>
-	/// 
-	/// 
-	/// </summary>
-	public class RangeMapFloatFunction : ValueSource
-	{
-	  protected internal readonly ValueSource source;
-	  protected internal readonly float min;
-	  protected internal readonly float max;
-	  protected internal readonly ValueSource target;
-	  protected internal readonly ValueSource defaultVal;
-
-	  public RangeMapFloatFunction(ValueSource source, float min, float max, float target, float? def) : this(source, min, max, new ConstValueSource(target), def == null ? null : new ConstValueSource(def.Value))
-	  {
-	  }
-
-	  public RangeMapFloatFunction(ValueSource source, float min, float max, ValueSource target, ValueSource def)
-	  {
-		this.source = source;
-		this.min = min;
-		this.max = max;
-		this.target = target;
-		this.defaultVal = def;
-	  }
-
-	  public override string description()
-	  {
-		return "map(" + source.description() + "," + min + "," + max + "," + target.description() + ")";
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
-		FunctionValues vals = source.getValues(context, readerContext);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues targets = target.getValues(context, readerContext);
-		FunctionValues targets = target.getValues(context, readerContext);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues defaults = (this.defaultVal == null) ? null : defaultVal.getValues(context, readerContext);
-		FunctionValues defaults = (this.defaultVal == null) ? null : defaultVal.getValues(context, readerContext);
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals, targets, defaults);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly RangeMapFloatFunction outerInstance;
-
-		  private FunctionValues vals;
-		  private FunctionValues targets;
-		  private FunctionValues defaults;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(RangeMapFloatFunction outerInstance, org.apache.lucene.queries.function.valuesource.RangeMapFloatFunction this, FunctionValues vals, FunctionValues targets, FunctionValues defaults) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.vals = vals;
-			  this.targets = targets;
-			  this.defaults = defaults;
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			float val = vals.floatVal(doc);
-			return (val >= outerInstance.min && val <= outerInstance.max) ? targets.floatVal(doc) : (outerInstance.defaultVal == null ? val : defaults.floatVal(doc));
-		  }
-		  public override string ToString(int doc)
-		  {
-			return "map(" + vals.ToString(doc) + ",min=" + outerInstance.min + ",max=" + outerInstance.max + ",target=" + targets.ToString(doc) + ")";
-		  }
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		source.createWeight(context, searcher);
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = source.GetHashCode();
-		h ^= (h << 10) | ((int)((uint)h >> 23));
-		h += float.floatToIntBits(min);
-		h ^= (h << 14) | ((int)((uint)h >> 19));
-		h += float.floatToIntBits(max);
-		h += target.GetHashCode();
-		if (defaultVal != null)
-		{
-		  h += defaultVal.GetHashCode();
-		}
-		return h;
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (typeof(RangeMapFloatFunction) != o.GetType())
-		{
-			return false;
-		}
-		RangeMapFloatFunction other = (RangeMapFloatFunction)o;
-		return this.min == other.min && this.max == other.max && this.target.Equals(other.target) && this.source.Equals(other.source) && (this.defaultVal == other.defaultVal || (this.defaultVal != null && this.defaultVal.Equals(other.defaultVal)));
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/ReciprocalFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/ReciprocalFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/ReciprocalFloatFunction.cs
deleted file mode 100644
index 9fcf24c..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/ReciprocalFloatFunction.cs
+++ /dev/null
@@ -1,130 +0,0 @@
-using System;
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using FloatDocValues = org.apache.lucene.queries.function.docvalues.FloatDocValues;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-
-
-	/// <summary>
-	/// <code>ReciprocalFloatFunction</code> implements a reciprocal function f(x) = a/(mx+b), based on
-	/// the float value of a field or function as exported by <seealso cref="org.apache.lucene.queries.function.ValueSource"/>.
-	/// <br>
-	/// 
-	/// When a and b are equal, and x>=0, this function has a maximum value of 1 that drops as x increases.
-	/// Increasing the value of a and b together results in a movement of the entire function to a flatter part of the curve.
-	/// <para>These properties make this an idea function for boosting more recent documents.
-	/// </para>
-	/// <para>Example:<code>  recip(ms(NOW,mydatefield),3.16e-11,1,1)</code>
-	/// </para>
-	/// <para>A multiplier of 3.16e-11 changes the units from milliseconds to years (since there are about 3.16e10 milliseconds
-	/// per year).  Thus, a very recent date will yield a value close to 1/(0+1) or 1,
-	/// a date a year in the past will get a multiplier of about 1/(1+1) or 1/2,
-	/// and date two years old will yield 1/(2+1) or 1/3.
-	/// 
-	/// </para>
-	/// </summary>
-	/// <seealso cref= org.apache.lucene.queries.function.FunctionQuery
-	/// 
-	///  </seealso>
-	public class ReciprocalFloatFunction : ValueSource
-	{
-	  protected internal readonly ValueSource source;
-	  protected internal readonly float m;
-	  protected internal readonly float a;
-	  protected internal readonly float b;
-
-	  /// <summary>
-	  ///  f(source) = a/(m*float(source)+b)
-	  /// </summary>
-	  public ReciprocalFloatFunction(ValueSource source, float m, float a, float b)
-	  {
-		this.source = source;
-		this.m = m;
-		this.a = a;
-		this.b = b;
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
-		FunctionValues vals = source.getValues(context, readerContext);
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly ReciprocalFloatFunction outerInstance;
-
-		  private FunctionValues vals;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(ReciprocalFloatFunction outerInstance, org.apache.lucene.queries.function.valuesource.ReciprocalFloatFunction this, FunctionValues vals) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.vals = vals;
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return outerInstance.a / (outerInstance.m * vals.floatVal(doc) + outerInstance.b);
-		  }
-		  public override string ToString(int doc)
-		  {
-			return Convert.ToString(outerInstance.a) + "/(" + outerInstance.m + "*float(" + vals.ToString(doc) + ')' + '+' + outerInstance.b + ')';
-		  }
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		source.createWeight(context, searcher);
-	  }
-
-	  public override string description()
-	  {
-		return Convert.ToString(a) + "/(" + m + "*float(" + source.description() + ")" + "+" + b + ')';
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = float.floatToIntBits(a) + float.floatToIntBits(m);
-		h ^= (h << 13) | ((int)((uint)h >> 20));
-		return h + (float.floatToIntBits(b)) + source.GetHashCode();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (typeof(ReciprocalFloatFunction) != o.GetType())
-		{
-			return false;
-		}
-		ReciprocalFloatFunction other = (ReciprocalFloatFunction)o;
-		return this.m == other.m && this.a == other.a && this.b == other.b && this.source.Equals(other.source);
-	  }
-	}
-
-}
\ No newline at end of file


[17/21] More work on Lucene.Net.Queries

Posted by sy...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/FunctionValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/FunctionValues.cs b/src/Lucene.Net.Queries/Function/FunctionValues.cs
index 862d0ba..b9443dd 100644
--- a/src/Lucene.Net.Queries/Function/FunctionValues.cs
+++ b/src/Lucene.Net.Queries/Function/FunctionValues.cs
@@ -1,362 +1,365 @@
 using System;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
+using Lucene.Net.Util.Mutable;
 
-namespace org.apache.lucene.queries.function
+namespace Lucene.Net.Queries.Function
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using org.apache.lucene.search;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueFloat = org.apache.lucene.util.mutable.MutableValueFloat;
-
-	/// <summary>
-	/// Represents field values as different types.
-	/// Normally created via a <seealso cref="ValueSource"/> for a particular field and reader.
-	/// 
-	/// 
-	/// </summary>
-
-	// FunctionValues is distinct from ValueSource because
-	// there needs to be an object created at query evaluation time that
-	// is not referenced by the query itself because:
-	// - Query objects should be MT safe
-	// - For caching, Query objects are often used as keys... you don't
-	//   want the Query carrying around big objects
-	public abstract class FunctionValues
-	{
-
-	  public virtual sbyte byteVal(int doc)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-	  public virtual short shortVal(int doc)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-
-	  public virtual float floatVal(int doc)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-	  public virtual int intVal(int doc)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-	  public virtual long longVal(int doc)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-	  public virtual double doubleVal(int doc)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-	  // TODO: should we make a termVal, returns BytesRef?
-	  public virtual string strVal(int doc)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-
-	  public virtual bool boolVal(int doc)
-	  {
-		return intVal(doc) != 0;
-	  }
-
-	  /// <summary>
-	  /// returns the bytes representation of the string val - TODO: should this return the indexed raw bytes not? </summary>
-	  public virtual bool bytesVal(int doc, BytesRef target)
-	  {
-		string s = strVal(doc);
-		if (s == null)
-		{
-		  target.length = 0;
-		  return false;
-		}
-		target.copyChars(s);
-		return true;
-	  }
-
-	  /// <summary>
-	  /// Native Java Object representation of the value </summary>
-	  public virtual object objectVal(int doc)
-	  {
-		// most FunctionValues are functions, so by default return a Float()
-		return floatVal(doc);
-	  }
-
-	  /// <summary>
-	  /// Returns true if there is a value for this document </summary>
-	  public virtual bool exists(int doc)
-	  {
-		return true;
-	  }
-
-	  /// <param name="doc"> The doc to retrieve to sort ordinal for </param>
-	  /// <returns> the sort ordinal for the specified doc
-	  /// TODO: Maybe we can just use intVal for this... </returns>
-	  public virtual int ordVal(int doc)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-
-	  /// <returns> the number of unique sort ordinals this instance has </returns>
-	  public virtual int numOrd()
-	  {
-		  throw new System.NotSupportedException();
-	  }
-	  public abstract string ToString(int doc);
-
-	  /// <summary>
-	  /// Abstraction of the logic required to fill the value of a specified doc into
-	  /// a reusable <seealso cref="MutableValue"/>.  Implementations of <seealso cref="FunctionValues"/>
-	  /// are encouraged to define their own implementations of ValueFiller if their
-	  /// value is not a float.
-	  /// 
-	  /// @lucene.experimental
-	  /// </summary>
-	  public abstract class ValueFiller
-	  {
-		/// <summary>
-		/// MutableValue will be reused across calls </summary>
-		public abstract MutableValue Value {get;}
-
-		/// <summary>
-		/// MutableValue will be reused across calls.  Returns true if the value exists. </summary>
-		public abstract void fillValue(int doc);
-	  }
-
-	  /// <summary>
-	  /// @lucene.experimental </summary>
-	  public virtual ValueFiller ValueFiller
-	  {
-		  get
-		  {
-			return new ValueFillerAnonymousInnerClassHelper(this);
-		  }
-	  }
-
-	  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-	  {
-		  private readonly FunctionValues outerInstance;
-
-		  public ValueFillerAnonymousInnerClassHelper(FunctionValues outerInstance)
-		  {
-			  this.outerInstance = outerInstance;
-			  mval = new MutableValueFloat();
-		  }
-
-		  private readonly MutableValueFloat mval;
-
-		  public override MutableValue Value
-		  {
-			  get
-			  {
-				return mval;
-			  }
-		  }
-
-		  public override void fillValue(int doc)
-		  {
-			mval.value = outerInstance.floatVal(doc);
-		  }
-	  }
-
-	  //For Functions that can work with multiple values from the same document.  This does not apply to all functions
-	  public virtual void byteVal(int doc, sbyte[] vals)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-	  public virtual void shortVal(int doc, short[] vals)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-
-	  public virtual void floatVal(int doc, float[] vals)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-	  public virtual void intVal(int doc, int[] vals)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-	  public virtual void longVal(int doc, long[] vals)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-	  public virtual void doubleVal(int doc, double[] vals)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-
-	  // TODO: should we make a termVal, fills BytesRef[]?
-	  public virtual void strVal(int doc, string[] vals)
-	  {
-		  throw new System.NotSupportedException();
-	  }
-
-	  public virtual Explanation explain(int doc)
-	  {
-		return new Explanation(floatVal(doc), ToString(doc));
-	  }
-
-	  public virtual ValueSourceScorer getScorer(IndexReader reader)
-	  {
-		return new ValueSourceScorer(reader, this);
-	  }
-
-	  // A RangeValueSource can't easily be a ValueSource that takes another ValueSource
-	  // because it needs different behavior depending on the type of fields.  There is also
-	  // a setup cost - parsing and normalizing params, and doing a binary search on the StringIndex.
-	  // TODO: change "reader" to AtomicReaderContext
-	  public virtual ValueSourceScorer getRangeScorer(IndexReader reader, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
-	  {
-		float lower;
-		float upper;
-
-		if (lowerVal == null)
-		{
-		  lower = float.NegativeInfinity;
-		}
-		else
-		{
-		  lower = Convert.ToSingle(lowerVal);
-		}
-		if (upperVal == null)
-		{
-		  upper = float.PositiveInfinity;
-		}
-		else
-		{
-		  upper = Convert.ToSingle(upperVal);
-		}
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final float l = lower;
-		float l = lower;
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final float u = upper;
-		float u = upper;
-
-		if (includeLower && includeUpper)
-		{
-		  return new ValueSourceScorerAnonymousInnerClassHelper(this, reader, this, l, u);
-		}
-		else if (includeLower && !includeUpper)
-		{
-		   return new ValueSourceScorerAnonymousInnerClassHelper2(this, reader, this, l, u);
-		}
-		else if (!includeLower && includeUpper)
-		{
-		   return new ValueSourceScorerAnonymousInnerClassHelper3(this, reader, this, l, u);
-		}
-		else
-		{
-		   return new ValueSourceScorerAnonymousInnerClassHelper4(this, reader, this, l, u);
-		}
-	  }
-
-	  private class ValueSourceScorerAnonymousInnerClassHelper : ValueSourceScorer
-	  {
-		  private readonly FunctionValues outerInstance;
-
-		  private float l;
-		  private float u;
-
-		  public ValueSourceScorerAnonymousInnerClassHelper(FunctionValues outerInstance, IndexReader reader, org.apache.lucene.queries.function.FunctionValues this, float l, float u) : base(reader, this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.l = l;
-			  this.u = u;
-		  }
-
-		  public override bool matchesValue(int doc)
-		  {
-			float docVal = outerInstance.floatVal(doc);
-			return docVal >= l && docVal <= u;
-		  }
-	  }
-
-	  private class ValueSourceScorerAnonymousInnerClassHelper2 : ValueSourceScorer
-	  {
-		  private readonly FunctionValues outerInstance;
-
-		  private float l;
-		  private float u;
-
-		  public ValueSourceScorerAnonymousInnerClassHelper2(FunctionValues outerInstance, IndexReader reader, org.apache.lucene.queries.function.FunctionValues this, float l, float u) : base(reader, this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.l = l;
-			  this.u = u;
-		  }
-
-		  public override bool matchesValue(int doc)
-		  {
-			float docVal = outerInstance.floatVal(doc);
-			return docVal >= l && docVal < u;
-		  }
-	  }
-
-	  private class ValueSourceScorerAnonymousInnerClassHelper3 : ValueSourceScorer
-	  {
-		  private readonly FunctionValues outerInstance;
-
-		  private float l;
-		  private float u;
-
-		  public ValueSourceScorerAnonymousInnerClassHelper3(FunctionValues outerInstance, IndexReader reader, org.apache.lucene.queries.function.FunctionValues this, float l, float u) : base(reader, this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.l = l;
-			  this.u = u;
-		  }
-
-		  public override bool matchesValue(int doc)
-		  {
-			float docVal = outerInstance.floatVal(doc);
-			return docVal > l && docVal <= u;
-		  }
-	  }
-
-	  private class ValueSourceScorerAnonymousInnerClassHelper4 : ValueSourceScorer
-	  {
-		  private readonly FunctionValues outerInstance;
-
-		  private float l;
-		  private float u;
-
-		  public ValueSourceScorerAnonymousInnerClassHelper4(FunctionValues outerInstance, IndexReader reader, org.apache.lucene.queries.function.FunctionValues this, float l, float u) : base(reader, this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.l = l;
-			  this.u = u;
-		  }
-
-		  public override bool matchesValue(int doc)
-		  {
-			float docVal = outerInstance.floatVal(doc);
-			return docVal > l && docVal < u;
-		  }
-	  }
-	}
-
-
-
-
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+
+    /// <summary>
+    /// Represents field values as different types.
+    /// Normally created via a <seealso cref="ValueSource"/> for a particular field and reader.
+    /// 
+    /// 
+    /// </summary>
+
+    // FunctionValues is distinct from ValueSource because
+    // there needs to be an object created at query evaluation time that
+    // is not referenced by the query itself because:
+    // - Query objects should be MT safe
+    // - For caching, Query objects are often used as keys... you don't
+    //   want the Query carrying around big objects
+    public abstract class FunctionValues
+    {
+
+        public virtual sbyte ByteVal(int doc)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public virtual short ShortVal(int doc)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public virtual float FloatVal(int doc)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public virtual int IntVal(int doc)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public virtual long LongVal(int doc)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public virtual double DoubleVal(int doc)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        // TODO: should we make a termVal, returns BytesRef?
+        public virtual string StrVal(int doc)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public virtual bool BoolVal(int doc)
+        {
+            return IntVal(doc) != 0;
+        }
+
+        /// <summary>
+        /// returns the bytes representation of the string val - TODO: should this return the indexed raw bytes not? </summary>
+        public virtual bool BytesVal(int doc, BytesRef target)
+        {
+            string s = StrVal(doc);
+            if (s == null)
+            {
+                target.Length = 0;
+                return false;
+            }
+            target.CopyChars(s);
+            return true;
+        }
+
+        /// <summary>
+        /// Native Java Object representation of the value </summary>
+        public virtual object ObjectVal(int doc)
+        {
+            // most FunctionValues are functions, so by default return a Float()
+            return FloatVal(doc);
+        }
+
+        /// <summary>
+        /// Returns true if there is a value for this document </summary>
+        public virtual bool Exists(int doc)
+        {
+            return true;
+        }
+
+        /// <param name="doc"> The doc to retrieve to sort ordinal for </param>
+        /// <returns> the sort ordinal for the specified doc
+        /// TODO: Maybe we can just use intVal for this... </returns>
+        public virtual int OrdVal(int doc)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        /// <returns> the number of unique sort ordinals this instance has </returns>
+        public virtual int NumOrd()
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public abstract string ToString(int doc);
+
+        /// <summary>
+        /// Abstraction of the logic required to fill the value of a specified doc into
+        /// a reusable <seealso cref="MutableValue"/>.  Implementations of <seealso cref="FunctionValues"/>
+        /// are encouraged to define their own implementations of ValueFiller if their
+        /// value is not a float.
+        /// 
+        /// @lucene.experimental
+        /// </summary>
+        public abstract class AbstractValueFiller
+        {
+            /// <summary>
+            /// MutableValue will be reused across calls </summary>
+            public abstract MutableValue Value { get; }
+
+            /// <summary>
+            /// MutableValue will be reused across calls.  Returns true if the value exists. </summary>
+            public abstract void FillValue(int doc);
+        }
+
+        /// <summary>
+        /// @lucene.experimental </summary>
+        public virtual AbstractValueFiller ValueFiller
+        {
+            get { return new ValueFillerAnonymousInnerClassHelper(this); }
+        }
+
+        private class ValueFillerAnonymousInnerClassHelper : AbstractValueFiller
+        {
+            private readonly FunctionValues outerInstance;
+
+            public ValueFillerAnonymousInnerClassHelper(FunctionValues outerInstance)
+            {
+                this.outerInstance = outerInstance;
+                mval = new MutableValueFloat();
+            }
+
+            private readonly MutableValueFloat mval;
+
+            public override MutableValue Value
+            {
+                get { return mval; }
+            }
+
+            public override void FillValue(int doc)
+            {
+                mval.Value = outerInstance.FloatVal(doc);
+            }
+        }
+
+        //For Functions that can work with multiple values from the same document.  This does not apply to all functions
+        public virtual void ByteVal(int doc, sbyte[] vals)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public virtual void ShortVal(int doc, short[] vals)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public virtual void FloatVal(int doc, float[] vals)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public virtual void IntVal(int doc, int[] vals)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public virtual void LongVal(int doc, long[] vals)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public virtual void DoubleVal(int doc, double[] vals)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        // TODO: should we make a termVal, fills BytesRef[]?
+        public virtual void StrVal(int doc, string[] vals)
+        {
+            throw new System.NotSupportedException();
+        }
+
+        public virtual Explanation Explain(int doc)
+        {
+            return new Explanation(FloatVal(doc), ToString(doc));
+        }
+
+        public virtual ValueSourceScorer GetScorer(IndexReader reader)
+        {
+            return new ValueSourceScorer(reader, this);
+        }
+
+        // A RangeValueSource can't easily be a ValueSource that takes another ValueSource
+        // because it needs different behavior depending on the type of fields.  There is also
+        // a setup cost - parsing and normalizing params, and doing a binary search on the StringIndex.
+        // TODO: change "reader" to AtomicReaderContext
+        public virtual ValueSourceScorer GetRangeScorer(IndexReader reader, string lowerVal, string upperVal,
+            bool includeLower, bool includeUpper)
+        {
+            float lower;
+            float upper;
+
+            if (lowerVal == null)
+            {
+                lower = float.NegativeInfinity;
+            }
+            else
+            {
+                lower = Convert.ToSingle(lowerVal);
+            }
+            if (upperVal == null)
+            {
+                upper = float.PositiveInfinity;
+            }
+            else
+            {
+                upper = Convert.ToSingle(upperVal);
+            }
+
+            float l = lower;
+            float u = upper;
+
+            if (includeLower && includeUpper)
+            {
+                return new ValueSourceScorerAnonymousInnerClassHelper(this, reader, this, l, u);
+            }
+            else if (includeLower && !includeUpper)
+            {
+                return new ValueSourceScorerAnonymousInnerClassHelper2(this, reader, this, l, u);
+            }
+            else if (!includeLower && includeUpper)
+            {
+                return new ValueSourceScorerAnonymousInnerClassHelper3(this, reader, this, l, u);
+            }
+            else
+            {
+                return new ValueSourceScorerAnonymousInnerClassHelper4(this, reader, this, l, u);
+            }
+        }
+
+        private class ValueSourceScorerAnonymousInnerClassHelper : ValueSourceScorer
+        {
+            private readonly FunctionValues outerInstance;
+
+            private float l;
+            private float u;
+
+            public ValueSourceScorerAnonymousInnerClassHelper(FunctionValues outerInstance, IndexReader reader,
+                FunctionValues @this, float l, float u)
+                : base(reader, @this)
+            {
+                this.outerInstance = outerInstance;
+                this.l = l;
+                this.u = u;
+            }
+
+            public override bool MatchesValue(int doc)
+            {
+                float docVal = outerInstance.FloatVal(doc);
+                return docVal >= l && docVal <= u;
+            }
+        }
+
+        private class ValueSourceScorerAnonymousInnerClassHelper2 : ValueSourceScorer
+        {
+            private readonly FunctionValues outerInstance;
+
+            private float l;
+            private float u;
+
+            public ValueSourceScorerAnonymousInnerClassHelper2(FunctionValues outerInstance, IndexReader reader,
+                FunctionValues @this, float l, float u)
+                : base(reader, @this)
+            {
+                this.outerInstance = outerInstance;
+                this.l = l;
+                this.u = u;
+            }
+
+            public override bool MatchesValue(int doc)
+            {
+                float docVal = outerInstance.FloatVal(doc);
+                return docVal >= l && docVal < u;
+            }
+        }
+
+        private class ValueSourceScorerAnonymousInnerClassHelper3 : ValueSourceScorer
+        {
+            private readonly FunctionValues outerInstance;
+
+            private float l;
+            private float u;
+
+            public ValueSourceScorerAnonymousInnerClassHelper3(FunctionValues outerInstance, IndexReader reader,
+                FunctionValues @this, float l, float u)
+                : base(reader, @this)
+            {
+                this.outerInstance = outerInstance;
+                this.l = l;
+                this.u = u;
+            }
+
+            public override bool MatchesValue(int doc)
+            {
+                float docVal = outerInstance.FloatVal(doc);
+                return docVal > l && docVal <= u;
+            }
+        }
+
+        private class ValueSourceScorerAnonymousInnerClassHelper4 : ValueSourceScorer
+        {
+            private readonly FunctionValues outerInstance;
+
+            private float l;
+            private float u;
+
+            public ValueSourceScorerAnonymousInnerClassHelper4(FunctionValues outerInstance, IndexReader reader,
+                FunctionValues @this, float l, float u)
+                : base(reader, @this)
+            {
+                this.outerInstance = outerInstance;
+                this.l = l;
+                this.u = u;
+            }
+
+            public override bool MatchesValue(int doc)
+            {
+                float docVal = outerInstance.FloatVal(doc);
+                return docVal > l && docVal < u;
+            }
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource.cs
index bb131af..2e29a02 100644
--- a/src/Lucene.Net.Queries/Function/ValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSource.cs
@@ -1,223 +1,202 @@
 using System.Collections;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Support;
 
-namespace org.apache.lucene.queries.function
+namespace Lucene.Net.Queries.Function
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using FieldComparator = org.apache.lucene.search.FieldComparator;
-	using FieldComparatorSource = org.apache.lucene.search.FieldComparatorSource;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-	using SortField = org.apache.lucene.search.SortField;
-
-
-	/// <summary>
-	/// Instantiates <seealso cref="FunctionValues"/> for a particular reader.
-	/// <br>
-	/// Often used when creating a <seealso cref="FunctionQuery"/>.
-	/// 
-	/// 
-	/// </summary>
-	public abstract class ValueSource
-	{
-
-	  /// <summary>
-	  /// Gets the values for this reader and the context that was previously
-	  /// passed to createWeight()
-	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public abstract FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException;
-	  public abstract FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext);
-
-	  public override abstract bool Equals(object o);
-
-	  public override abstract int GetHashCode();
-
-	  /// <summary>
-	  /// description of field, used in explain()
-	  /// </summary>
-	  public abstract string description();
-
-	  public override string ToString()
-	  {
-		return description();
-	  }
-
-
-	  /// <summary>
-	  /// Implementations should propagate createWeight to sub-ValueSources which can optionally store
-	  /// weight info in the context. The context object will be passed to getValues()
-	  /// where this info can be retrieved.
-	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public virtual void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-	  }
-
-	  /// <summary>
-	  /// Returns a new non-threadsafe context map.
-	  /// </summary>
-	  public static IDictionary newContext(IndexSearcher searcher)
-	  {
-		IDictionary context = new IdentityHashMap();
-		context["searcher"] = searcher;
-		return context;
-	  }
-
-
-	  //
-	  // Sorting by function
-	  //
-
-	  /// <summary>
-	  /// EXPERIMENTAL: This method is subject to change.
-	  /// <para>
-	  /// Get the SortField for this ValueSource.  Uses the <seealso cref="#getValues(java.util.Map, AtomicReaderContext)"/>
-	  /// to populate the SortField.
-	  /// 
-	  /// </para>
-	  /// </summary>
-	  /// <param name="reverse"> true if this is a reverse sort. </param>
-	  /// <returns> The <seealso cref="org.apache.lucene.search.SortField"/> for the ValueSource </returns>
-	  public virtual SortField getSortField(bool reverse)
-	  {
-		return new ValueSourceSortField(this, reverse);
-	  }
-
-	  internal class ValueSourceSortField : SortField
-	  {
-		  private readonly ValueSource outerInstance;
-
-		public ValueSourceSortField(ValueSource outerInstance, bool reverse) : base(outerInstance.description(), SortField.Type.REWRITEABLE, reverse)
-		{
-			this.outerInstance = outerInstance;
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.search.SortField rewrite(org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-		public override SortField rewrite(IndexSearcher searcher)
-		{
-		  IDictionary context = newContext(searcher);
-		  outerInstance.createWeight(context, searcher);
-		  return new SortField(Field, new ValueSourceComparatorSource(outerInstance, context), Reverse);
-		}
-	  }
-
-	  internal class ValueSourceComparatorSource : FieldComparatorSource
-	  {
-		  private readonly ValueSource outerInstance;
-
-		internal readonly IDictionary context;
-
-		public ValueSourceComparatorSource(ValueSource outerInstance, IDictionary context)
-		{
-			this.outerInstance = outerInstance;
-		  this.context = context;
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.search.FieldComparator<Double> newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws java.io.IOException
-		public override FieldComparator<double?> newComparator(string fieldname, int numHits, int sortPos, bool reversed)
-		{
-		  return new ValueSourceComparator(outerInstance, context, numHits);
-		}
-	  }
-
-	  /// <summary>
-	  /// Implement a <seealso cref="org.apache.lucene.search.FieldComparator"/> that works
-	  /// off of the <seealso cref="FunctionValues"/> for a ValueSource
-	  /// instead of the normal Lucene FieldComparator that works off of a FieldCache.
-	  /// </summary>
-	  internal class ValueSourceComparator : FieldComparator<double?>
-	  {
-		  private readonly ValueSource outerInstance;
-
-		internal readonly double[] values;
-		internal FunctionValues docVals;
-		internal double bottom;
-		internal readonly IDictionary fcontext;
-		internal double topValue;
-
-		internal ValueSourceComparator(ValueSource outerInstance, IDictionary fcontext, int numHits)
-		{
-			this.outerInstance = outerInstance;
-		  this.fcontext = fcontext;
-		  values = new double[numHits];
-		}
-
-		public override int compare(int slot1, int slot2)
-		{
-		  return values[slot1].CompareTo(values[slot2]);
-		}
-
-		public override int compareBottom(int doc)
-		{
-		  return bottom.CompareTo(docVals.doubleVal(doc));
-		}
-
-		public override void copy(int slot, int doc)
-		{
-		  values[slot] = docVals.doubleVal(doc);
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.search.FieldComparator setNextReader(org.apache.lucene.index.AtomicReaderContext context) throws java.io.IOException
-		public override FieldComparator setNextReader(AtomicReaderContext context)
-		{
-		  docVals = outerInstance.getValues(fcontext, context);
-		  return this;
-		}
-
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-//ORIGINAL LINE: @Override public void setBottom(final int bottom)
-		public override int Bottom
-		{
-			set
-			{
-			  this.bottom = values[value];
-			}
-		}
-
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-//ORIGINAL LINE: @Override public void setTopValue(final Double value)
-		public override double? TopValue
-		{
-			set
-			{
-			  this.topValue = (double)value;
-			}
-		}
-
-		public override double? value(int slot)
-		{
-		  return values[slot];
-		}
-
-		public override int compareTop(int doc)
-		{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final double docValue = docVals.doubleVal(doc);
-		  double docValue = docVals.doubleVal(doc);
-		  return topValue.CompareTo(docValue);
-		}
-	  }
-	}
-
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// Instantiates <seealso cref="FunctionValues"/> for a particular reader.
+    /// <br>
+    /// Often used when creating a <seealso cref="FunctionQuery"/>.
+    /// 
+    /// 
+    /// </summary>
+    public abstract class ValueSource
+    {
+
+        /// <summary>
+        /// Gets the values for this reader and the context that was previously
+        /// passed to CreateWeight()
+        /// </summary>
+        public abstract FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext);
+
+        public override abstract bool Equals(object o);
+
+        public override abstract int GetHashCode();
+
+        /// <summary>
+        /// description of field, used in explain()
+        /// </summary>
+        public abstract string Description { get; }
+
+        public override string ToString()
+        {
+            return Description;
+        }
+
+
+        /// <summary>
+        /// Implementations should propagate CreateWeight to sub-ValueSources which can optionally store
+        /// weight info in the context. The context object will be passed to GetValues()
+        /// where this info can be retrieved.
+        /// </summary>
+        public virtual void CreateWeight(IDictionary context, IndexSearcher searcher)
+        {
+        }
+
+        /// <summary>
+        /// Returns a new non-threadsafe context map.
+        /// </summary>
+        public static IDictionary NewContext(IndexSearcher searcher)
+        {
+            IDictionary context = new IdentityHashMap<,>();
+            context["searcher"] = searcher;
+            return context;
+        }
+
+
+        //
+        // Sorting by function
+        //
+
+        /// <summary>
+        /// EXPERIMENTAL: This method is subject to change.
+        /// <para>
+        /// Get the SortField for this ValueSource.  Uses the <seealso cref="#GetValues(java.util.Map, AtomicReaderContext)"/>
+        /// to populate the SortField.
+        /// 
+        /// </para>
+        /// </summary>
+        /// <param name="reverse"> true if this is a reverse sort. </param>
+        /// <returns> The <seealso cref="org.apache.lucene.search.SortField"/> for the ValueSource </returns>
+        public virtual SortField GetSortField(bool reverse)
+        {
+            return new ValueSourceSortField(this, reverse);
+        }
+
+        internal class ValueSourceSortField : SortField
+        {
+            private readonly ValueSource outerInstance;
+
+            public ValueSourceSortField(ValueSource outerInstance, bool reverse)
+                : base(outerInstance.Description, SortField.Type.REWRITEABLE, reverse)
+            {
+                this.outerInstance = outerInstance;
+            }
+
+            public override SortField Rewrite(IndexSearcher searcher)
+            {
+                IDictionary context = NewContext(searcher);
+                outerInstance.CreateWeight(context, searcher);
+                return new SortField(Field, new ValueSourceComparatorSource(outerInstance, context), Reverse);
+            }
+        }
+
+        internal class ValueSourceComparatorSource : FieldComparatorSource
+        {
+            private readonly ValueSource outerInstance;
+
+            internal readonly IDictionary context;
+
+            public ValueSourceComparatorSource(ValueSource outerInstance, IDictionary context)
+            {
+                this.outerInstance = outerInstance;
+                this.context = context;
+            }
+
+            public override FieldComparator<double?> NewComparator(string fieldname, int numHits, int sortPos, bool reversed)
+            {
+                return new ValueSourceComparator(outerInstance, context, numHits);
+            }
+        }
+
+        /// <summary>
+        /// Implement a <seealso cref="org.apache.lucene.search.FieldComparator"/> that works
+        /// off of the <seealso cref="FunctionValues"/> for a ValueSource
+        /// instead of the normal Lucene FieldComparator that works off of a FieldCache.
+        /// </summary>
+        internal class ValueSourceComparator : FieldComparator<double?>
+        {
+            private readonly ValueSource outerInstance;
+
+            internal readonly double[] values;
+            internal FunctionValues docVals;
+            internal double bottom;
+            internal readonly IDictionary fcontext;
+            internal double topValue;
+
+            internal ValueSourceComparator(ValueSource outerInstance, IDictionary fcontext, int numHits)
+            {
+                this.outerInstance = outerInstance;
+                this.fcontext = fcontext;
+                values = new double[numHits];
+            }
+
+            public override int Compare(int slot1, int slot2)
+            {
+                return values[slot1].CompareTo(values[slot2]);
+            }
+
+            public override int CompareBottom(int doc)
+            {
+                return bottom.CompareTo(docVals.DoubleVal(doc));
+            }
+
+            public override void Copy(int slot, int doc)
+            {
+                values[slot] = docVals.DoubleVal(doc);
+            }
+
+            public override FieldComparator SetNextReader(AtomicReaderContext context)
+            {
+                docVals = outerInstance.GetValues(fcontext, context);
+                return this;
+            }
+
+            public override int Bottom
+            {
+                set
+                {
+                    this.bottom = values[value];
+                }
+            }
+
+            public override double? TopValue
+            {
+                set
+                {
+                    this.topValue = (double)value;
+                }
+            }
+
+            public override double? Value(int slot)
+            {
+                return values[slot];
+            }
+
+            public override int CompareTop(int doc)
+            {
+                double docValue = docVals.DoubleVal(doc);
+                return topValue.CompareTo(docValue);
+            }
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSourceScorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSourceScorer.cs b/src/Lucene.Net.Queries/Function/ValueSourceScorer.cs
index fa79903..a313b66 100644
--- a/src/Lucene.Net.Queries/Function/ValueSourceScorer.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSourceScorer.cs
@@ -1,126 +1,116 @@
-namespace org.apache.lucene.queries.function
-{
-
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
 
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using MultiFields = org.apache.lucene.index.MultiFields;
-	using Scorer = org.apache.lucene.search.Scorer;
-	using Bits = org.apache.lucene.util.Bits;
-
-	/// <summary>
-	/// <seealso cref="Scorer"/> which returns the result of <seealso cref="FunctionValues#floatVal(int)"/> as
-	/// the score for a document.
-	/// </summary>
-	public class ValueSourceScorer : Scorer
-	{
-	  protected internal readonly IndexReader reader;
-	  private int doc = -1;
-	  protected internal readonly int maxDoc;
-	  protected internal readonly FunctionValues values;
-	  protected internal bool checkDeletes;
-	  private readonly Bits liveDocs;
+namespace Lucene.Net.Queries.Function
+{
 
-	  protected internal ValueSourceScorer(IndexReader reader, FunctionValues values) : base(null)
-	  {
-		this.reader = reader;
-		this.maxDoc = reader.maxDoc();
-		this.values = values;
-		CheckDeletes = true;
-		this.liveDocs = MultiFields.getLiveDocs(reader);
-	  }
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// <seealso cref="Scorer"/> which returns the result of <seealso cref="FunctionValues#FloatVal(int)"/> as
+    /// the score for a document.
+    /// </summary>
+    public class ValueSourceScorer : Scorer
+    {
+        protected internal readonly IndexReader reader;
+        private int doc = -1;
+        protected internal readonly int maxDoc;
+        protected internal readonly FunctionValues values;
+        protected internal bool checkDeletes;
+        private readonly Bits liveDocs;
 
-	  public virtual IndexReader Reader
-	  {
-		  get
-		  {
-			return reader;
-		  }
-	  }
+        protected internal ValueSourceScorer(IndexReader reader, FunctionValues values)
+            : base(null)
+        {
+            this.reader = reader;
+            this.maxDoc = reader.MaxDoc;
+            this.values = values;
+            CheckDeletes = true;
+            this.liveDocs = MultiFields.GetLiveDocs(reader);
+        }
 
-	  public virtual bool CheckDeletes
-	  {
-		  set
-		  {
-			this.checkDeletes = value && reader.hasDeletions();
-		  }
-	  }
+        public virtual IndexReader Reader
+        {
+            get
+            {
+                return reader;
+            }
+        }
 
-	  public virtual bool matches(int doc)
-	  {
-		return (!checkDeletes || liveDocs.get(doc)) && matchesValue(doc);
-	  }
+        public virtual bool CheckDeletes
+        {
+            set
+            {
+                this.checkDeletes = value && reader.HasDeletions;
+            }
+        }
 
-	  public virtual bool matchesValue(int doc)
-	  {
-		return true;
-	  }
+        public virtual bool Matches(int doc)
+        {
+            return (!checkDeletes || liveDocs.Get(doc)) && MatchesValue(doc);
+        }
 
-	  public override int docID()
-	  {
-		return doc;
-	  }
+        public virtual bool MatchesValue(int doc)
+        {
+            return true;
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public int nextDoc() throws java.io.IOException
-	  public override int nextDoc()
-	  {
-		for (; ;)
-		{
-		  doc++;
-		  if (doc >= maxDoc)
-		  {
-			  return doc = NO_MORE_DOCS;
-		  }
-		  if (matches(doc))
-		  {
-			  return doc;
-		  }
-		}
-	  }
+        public override int DocID()
+        {
+            return doc;
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public int advance(int target) throws java.io.IOException
-	  public override int advance(int target)
-	  {
-		// also works fine when target==NO_MORE_DOCS
-		doc = target - 1;
-		return nextDoc();
-	  }
+        public override int NextDoc()
+        {
+            for (; ; )
+            {
+                doc++;
+                if (doc >= maxDoc)
+                {
+                    return doc = NO_MORE_DOCS;
+                }
+                if (Matches(doc))
+                {
+                    return doc;
+                }
+            }
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public float score() throws java.io.IOException
-	  public override float score()
-	  {
-		return values.floatVal(doc);
-	  }
+        public override int Advance(int target)
+        {
+            // also works fine when target==NO_MORE_DOCS
+            doc = target - 1;
+            return NextDoc();
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public int freq() throws java.io.IOException
-	  public override int freq()
-	  {
-		return 1;
-	  }
+        public override float Score()
+        {
+            return values.FloatVal(doc);
+        }
 
-	  public override long cost()
-	  {
-		return maxDoc;
-	  }
-	}
+        public override int Freq()
+        {
+            return 1;
+        }
 
+        public override long Cost()
+        {
+            return maxDoc;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/BoolFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/BoolFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/BoolFunction.cs
index 9a2fab7..d166b6c 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/BoolFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/BoolFunction.cs
@@ -17,14 +17,12 @@
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
-
-	/// <summary>
-	/// Abstract parent class for those <seealso cref="ValueSource"/> implementations which
-	/// apply boolean logic to their values
-	/// </summary>
-	public abstract class BoolFunction : ValueSource
-	{
-	  // TODO: placeholder to return type, among other common future functionality
-	}
-
+    /// <summary>
+    /// Abstract parent class for those <seealso cref="ValueSource"/> implementations which
+    /// apply boolean logic to their values
+    /// </summary>
+    public abstract class BoolFunction : ValueSource
+    {
+        // TODO: placeholder to return type, among other common future functionality
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs
index b0ad08a..2b8bc7e 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs
@@ -1,138 +1,136 @@
 using System;
 using System.Collections;
-using org.apache.lucene.queries.function;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
     /// <summary>
-	/// Obtains int field values from the <seealso cref="org.apache.lucene.search.FieldCache"/>
-	/// using <code>getInts()</code>
-	/// and makes those values available as other numeric types, casting as needed. *
-	/// 
-	/// 
-	/// </summary>
-	[Obsolete]
-	public class ByteFieldSource : FieldCacheSource
-	{
-
-	  private readonly FieldCache.ByteParser parser;
-
-	  public ByteFieldSource(string field) : this(field, null)
-	  {
-	  }
-
-	  public ByteFieldSource(string field, FieldCache.ByteParser parser) : base(field)
-	  {
-		this.parser = parser;
-	  }
-
-	  public override string description()
-	  {
-		return "byte(" + field + ')';
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Bytes arr = cache.getBytes(readerContext.reader(), field, parser, false);
-		FieldCache.Bytes arr = cache.getBytes(readerContext.reader(), field, parser, false);
-
-		return new FunctionValuesAnonymousInnerClassHelper(this, arr);
-	  }
-
-	  private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
-	  {
-		  private readonly ByteFieldSource outerInstance;
-
-		  private FieldCache.Bytes arr;
-
-		  public FunctionValuesAnonymousInnerClassHelper(ByteFieldSource outerInstance, FieldCache.Bytes arr)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.arr = arr;
-		  }
-
-		  public override sbyte byteVal(int doc)
-		  {
-			return arr.get(doc);
-		  }
-
-		  public override short shortVal(int doc)
-		  {
-			return (short) arr.get(doc);
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return (float) arr.get(doc);
-		  }
-
-		  public override int intVal(int doc)
-		  {
-			return (int) arr.get(doc);
-		  }
-
-		  public override long longVal(int doc)
-		  {
-			return (long) arr.get(doc);
-		  }
-
-		  public override double doubleVal(int doc)
-		  {
-			return (double) arr.get(doc);
-		  }
-
-		  public override string strVal(int doc)
-		  {
-			return Convert.ToString(arr.get(doc));
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.description() + '=' + byteVal(doc);
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return arr.get(doc); // TODO: valid?
-		  }
-
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (o.GetType() != typeof(ByteFieldSource))
-		{
-			return false;
-		}
-		ByteFieldSource other = (ByteFieldSource) o;
-		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = parser == null ? typeof(sbyte?).GetHashCode() : parser.GetType().GetHashCode();
-		h += base.GetHashCode();
-		return h;
-	  }
-	}
+    /// Obtains int field values from the <seealso cref="org.apache.lucene.search.FieldCache"/>
+    /// using <code>getInts()</code>
+    /// and makes those values available as other numeric types, casting as needed. *
+    /// 
+    /// 
+    /// </summary>
+    [Obsolete]
+    public class ByteFieldSource : FieldCacheSource
+    {
+
+        private readonly FieldCache_Fields.IByteParser parser;
+
+        public ByteFieldSource(string field)
+            : this(field, null)
+        {
+        }
+
+        public ByteFieldSource(string field, FieldCache_Fields.IByteParser parser)
+            : base(field)
+        {
+            this.parser = parser;
+        }
+
+        public override string Description
+        {
+            get { return "byte(" + field + ')'; }
+        }
+
+        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
+        {
+            FieldCache_Fields.Bytes arr = cache.GetBytes(readerContext.AtomicReader, field, parser, false);
+
+            return new FunctionValuesAnonymousInnerClassHelper(this, arr);
+        }
+
+        private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
+        {
+            private readonly ByteFieldSource outerInstance;
+            private readonly FieldCache_Fields.Bytes arr;
+
+            public FunctionValuesAnonymousInnerClassHelper(ByteFieldSource outerInstance, FieldCache_Fields.Bytes arr)
+            {
+                this.outerInstance = outerInstance;
+                this.arr = arr;
+            }
+
+            public override sbyte ByteVal(int doc)
+            {
+                return arr.Get(doc);
+            }
+
+            public override short ShortVal(int doc)
+            {
+                return (short)arr.Get(doc);
+            }
+
+            public override float FloatVal(int doc)
+            {
+                return (float)arr.Get(doc);
+            }
+
+            public override int IntVal(int doc)
+            {
+                return (int)arr.Get(doc);
+            }
+
+            public override long LongVal(int doc)
+            {
+                return (long)arr.Get(doc);
+            }
+
+            public override double DoubleVal(int doc)
+            {
+                return (double)arr.Get(doc);
+            }
+
+            public override string StrVal(int doc)
+            {
+                return Convert.ToString(arr.Get(doc));
+            }
+
+            public override string ToString(int doc)
+            {
+                return outerInstance.Description + '=' + ByteVal(doc);
+            }
+
+            public override object ObjectVal(int doc)
+            {
+                return arr.Get(doc); // TODO: valid?
+            }
+
+        }
+
+        public override bool Equals(object o)
+        {
+            if (o.GetType() != typeof(ByteFieldSource))
+            {
+                return false;
+            }
+            ByteFieldSource other = (ByteFieldSource)o;
+            return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
+        }
+
+        public override int GetHashCode()
+        {
+            int h = parser == null ? typeof(sbyte?).GetHashCode() : parser.GetType().GetHashCode();
+            h += base.GetHashCode();
+            return h;
+        }
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/BytesRefFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/BytesRefFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/BytesRefFieldSource.cs
index 625ac5b..0ed87a8 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/BytesRefFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/BytesRefFieldSource.cs
@@ -1,131 +1,125 @@
 using System.Collections;
+using Lucene.Net.Index;
 using Lucene.Net.Queries.Function.DocValues;
-using org.apache.lucene.queries.function;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
     /// <summary>
-	/// An implementation for retrieving <seealso cref="FunctionValues"/> instances for string based fields.
-	/// </summary>
-	public class BytesRefFieldSource : FieldCacheSource
-	{
-
-	  public BytesRefFieldSource(string field) : base(field)
-	  {
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.FieldInfo fieldInfo = readerContext.reader().getFieldInfos().fieldInfo(field);
-		FieldInfo fieldInfo = readerContext.reader().FieldInfos.fieldInfo(field);
-		// To be sorted or not to be sorted, that is the question
-		// TODO: do it cleaner?
-		if (fieldInfo != null && fieldInfo.DocValuesType == FieldInfo.DocValuesType.BINARY)
-		{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.BinaryDocValues binaryValues = org.apache.lucene.search.FieldCache.DEFAULT.getTerms(readerContext.reader(), field, true);
-		  BinaryDocValues binaryValues = FieldCache.DEFAULT.getTerms(readerContext.reader(), field, true);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.Bits docsWithField = org.apache.lucene.search.FieldCache.DEFAULT.getDocsWithField(readerContext.reader(), field);
-		  Bits docsWithField = FieldCache.DEFAULT.getDocsWithField(readerContext.reader(), field);
-		  return new FunctionValuesAnonymousInnerClassHelper(this, binaryValues, docsWithField);
-		}
-		else
-		{
-		  return new DocTermsIndexDocValuesAnonymousInnerClassHelper(this, this, readerContext, field);
-		}
-	  }
-
-	  private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
-	  {
-		  private readonly BytesRefFieldSource outerInstance;
-
-		  private BinaryDocValues binaryValues;
-		  private Bits docsWithField;
-
-		  public FunctionValuesAnonymousInnerClassHelper(BytesRefFieldSource outerInstance, BinaryDocValues binaryValues, Bits docsWithField)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.binaryValues = binaryValues;
-			  this.docsWithField = docsWithField;
-		  }
-
-
-		  public override bool exists(int doc)
-		  {
-			return docsWithField.get(doc);
-		  }
-
-		  public override bool bytesVal(int doc, BytesRef target)
-		  {
-			binaryValues.get(doc, target);
-			return target.length > 0;
-		  }
-
-		  public override string strVal(int doc)
-		  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.BytesRef bytes = new org.apache.lucene.util.BytesRef();
-			BytesRef bytes = new BytesRef();
-			return bytesVal(doc, bytes) ? bytes.utf8ToString() : null;
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return strVal(doc);
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.description() + '=' + strVal(doc);
-		  }
-	  }
-
-	  private class DocTermsIndexDocValuesAnonymousInnerClassHelper : DocTermsIndexDocValues
-	  {
-		  private readonly BytesRefFieldSource outerInstance;
-
-		  public DocTermsIndexDocValuesAnonymousInnerClassHelper(BytesRefFieldSource outerInstance, BytesRefFieldSource this, AtomicReaderContext readerContext, string field) : base(this, readerContext, field)
-		  {
-			  this.outerInstance = outerInstance;
-		  }
-
-
-		  protected internal override string toTerm(string readableValue)
-		  {
-			return readableValue;
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return strVal(doc);
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.description() + '=' + strVal(doc);
-		  }
-	  }
-	}
+    /// An implementation for retrieving <seealso cref="FunctionValues"/> instances for string based fields.
+    /// </summary>
+    public class BytesRefFieldSource : FieldCacheSource
+    {
+
+        public BytesRefFieldSource(string field)
+            : base(field)
+        {
+        }
+
+        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
+        {
+            FieldInfo fieldInfo = readerContext.AtomicReader.FieldInfos.FieldInfo(field);
+            // To be sorted or not to be sorted, that is the question
+            // TODO: do it cleaner?
+            if (fieldInfo != null && fieldInfo.DocValuesType == FieldInfo.DocValuesType_e.BINARY)
+            {
+                BinaryDocValues binaryValues = FieldCache_Fields.DEFAULT.GetTerms(readerContext.AtomicReader, field, true);
+                Bits docsWithField = FieldCache_Fields.DEFAULT.GetDocsWithField(readerContext.AtomicReader, field);
+                return new FunctionValuesAnonymousInnerClassHelper(this, binaryValues, docsWithField);
+            }
+            else
+            {
+                return new DocTermsIndexDocValuesAnonymousInnerClassHelper(this, this, readerContext, field);
+            }
+        }
+
+        private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
+        {
+            private readonly BytesRefFieldSource outerInstance;
+
+            private BinaryDocValues binaryValues;
+            private Bits docsWithField;
+
+            public FunctionValuesAnonymousInnerClassHelper(BytesRefFieldSource outerInstance, BinaryDocValues binaryValues, Bits docsWithField)
+            {
+                this.outerInstance = outerInstance;
+                this.binaryValues = binaryValues;
+                this.docsWithField = docsWithField;
+            }
+
+
+            public override bool Exists(int doc)
+            {
+                return docsWithField.Get(doc);
+            }
+
+            public override bool BytesVal(int doc, BytesRef target)
+            {
+                binaryValues.Get(doc, target);
+                return target.Length > 0;
+            }
+
+            public override string StrVal(int doc)
+            {
+                var bytes = new BytesRef();
+                return BytesVal(doc, bytes) ? bytes.Utf8ToString() : null;
+            }
+
+            public override object ObjectVal(int doc)
+            {
+                return StrVal(doc);
+            }
+
+            public override string ToString(int doc)
+            {
+                return outerInstance.Description + '=' + StrVal(doc);
+            }
+        }
+
+        private class DocTermsIndexDocValuesAnonymousInnerClassHelper : DocTermsIndexDocValues
+        {
+            private readonly BytesRefFieldSource outerInstance;
+
+            public DocTermsIndexDocValuesAnonymousInnerClassHelper(BytesRefFieldSource outerInstance, BytesRefFieldSource @this, AtomicReaderContext readerContext, string field)
+                : base(@this, readerContext, field)
+            {
+                this.outerInstance = outerInstance;
+            }
+
+
+            protected internal override string toTerm(string readableValue)
+            {
+                return readableValue;
+            }
+
+            public override object ObjectVal(int doc)
+            {
+                return StrVal(doc);
+            }
+
+            public override string ToString(int doc)
+            {
+                return outerInstance.Description + '=' + StrVal(doc);
+            }
+        }
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs
index cadbbce..d179c4d 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs
@@ -15,20 +15,22 @@
  * limitations under the License.
  */
 
+using Lucene.Net.Support;
+
 namespace Lucene.Net.Queries.Function.ValueSources
 {
 
-	/// <summary>
-	/// <code>ConstNumberSource</code> is the base class for all constant numbers
-	/// </summary>
-	public abstract class ConstNumberSource : ValueSource
-	{
-	  public abstract int Int {get;}
-	  public abstract long Long {get;}
-	  public abstract float Float {get;}
-	  public abstract double Double {get;}
-	  public abstract Number Number {get;}
-	  public abstract bool Bool {get;}
-	}
+    /// <summary>
+    /// <code>ConstNumberSource</code> is the base class for all constant numbers
+    /// </summary>
+    public abstract class ConstNumberSource : ValueSource
+    {
+        public abstract int Int { get; }
+        public abstract long Long { get; }
+        public abstract float Float { get; }
+        public abstract double Double { get; }
+        public abstract Number Number { get; }
+        public abstract bool Bool { get; }
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs
index 79a751c..36ab51e 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -40,8 +40,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 		return new FloatDocValuesAnonymousInnerClassHelper(this, this);
 	  }
@@ -55,7 +55,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.outerInstance = outerInstance;
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
 			return outerInstance.constant;
 		  }
@@ -63,11 +63,11 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		  {
 			return (int)outerInstance.constant;
 		  }
-		  public override long longVal(int doc)
+		  public override long LongVal(int doc)
 		  {
 			return (long)outerInstance.constant;
 		  }
-		  public override double doubleVal(int doc)
+		  public override double DoubleVal(int doc)
 		  {
 			return outerInstance.dv;
 		  }
@@ -87,7 +87,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 	  public override int GetHashCode()
 	  {
-		return float.floatToIntBits(constant) * 31;
+		return Number.FloatToIntBits(constant) * 31;
 	  }
 
 	  public override bool Equals(object o)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/DefFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DefFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/DefFunction.cs
index 05910e5..bbdbe2e 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/DefFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DefFunction.cs
@@ -1,6 +1,7 @@
 using System.Collections;
 using System.Collections.Generic;
-using org.apache.lucene.queries.function;
+using Lucene.Net.Index;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -37,13 +38,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		return "def";
 	  }
 
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map fcontext, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary fcontext, AtomicReaderContext readerContext)
+	  public override FunctionValues GetValues(IDictionary fcontext, AtomicReaderContext readerContext)
 	  {
-
-
 		return new ValuesAnonymousInnerClassHelper(this, valsArr(sources, fcontext, readerContext));
 	  }
 
@@ -59,12 +55,12 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 		  internal readonly int upto;
 
-		  private FunctionValues get(int doc)
+		  private FunctionValues Get(int doc)
 		  {
 			for (int i = 0; i < upto; i++)
 			{
 			  FunctionValues vals = valsArr[i];
-			  if (vals.exists(doc))
+			  if (vals.Exists(doc))
 			  {
 				return vals;
 			  }
@@ -72,77 +68,68 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			return valsArr[upto];
 		  }
 
-		  public override sbyte byteVal(int doc)
+		  public override sbyte ByteVal(int doc)
 		  {
-			return get(doc).byteVal(doc);
+			return Get(doc).ByteVal(doc);
 		  }
 
-		  public override short shortVal(int doc)
+		  public override short ShortVal(int doc)
 		  {
-			return get(doc).shortVal(doc);
+			return Get(doc).ShortVal(doc);
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
-			return get(doc).floatVal(doc);
+			return Get(doc).FloatVal(doc);
 		  }
 
-		  public override int intVal(int doc)
+		  public override int IntVal(int doc)
 		  {
-			return get(doc).intVal(doc);
+			return Get(doc).IntVal(doc);
 		  }
 
-		  public override long longVal(int doc)
+		  public override long LongVal(int doc)
 		  {
-			return get(doc).longVal(doc);
+			return Get(doc).LongVal(doc);
 		  }
 
-		  public override double doubleVal(int doc)
+		  public override double DoubleVal(int doc)
 		  {
-			return get(doc).doubleVal(doc);
+			return Get(doc).DoubleVal(doc);
 		  }
 
-		  public override string strVal(int doc)
+		  public override string StrVal(int doc)
 		  {
-			return get(doc).strVal(doc);
+			return Get(doc).StrVal(doc);
 		  }
 
-		  public override bool boolVal(int doc)
+		  public override bool BoolVal(int doc)
 		  {
-			return get(doc).boolVal(doc);
+			return Get(doc).BoolVal(doc);
 		  }
 
-		  public override bool bytesVal(int doc, BytesRef target)
+		  public override bool BytesVal(int doc, BytesRef target)
 		  {
-			return get(doc).bytesVal(doc, target);
+			return Get(doc).BytesVal(doc, target);
 		  }
 
-		  public override object objectVal(int doc)
+		  public override object ObjectVal(int doc)
 		  {
-			return get(doc).objectVal(doc);
+			return Get(doc).ObjectVal(doc);
 		  }
 
-		  public override bool exists(int doc)
+		  public override bool Exists(int doc)
 		  {
 			// return true if any source is exists?
 			foreach (FunctionValues vals in valsArr)
 			{
-			  if (vals.exists(doc))
+			  if (vals.Exists(doc))
 			  {
 				return true;
 			  }
 			}
 			return false;
 		  }
-
-		  public override ValueFiller ValueFiller
-		  {
-			  get
-			  {
-				// TODO: need ValueSource.type() to determine correct type
-				return base.ValueFiller;
-			  }
-		  }
 	  }
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/DivFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DivFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/DivFloatFunction.cs
index ff1b0b3..9510bc2 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/DivFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DivFloatFunction.cs
@@ -15,32 +15,30 @@
  * limitations under the License.
  */
 
-using org.apache.lucene.queries.function;
-
 namespace Lucene.Net.Queries.Function.ValueSources
 {
 
 
-	/// <summary>
-	/// Function to divide "a" by "b"
-	/// </summary>
-	public class DivFloatFunction : DualFloatFunction
-	{
-	 /// <param name="a">  the numerator. </param>
-	 /// <param name="b">  the denominator. </param>
-	  public DivFloatFunction(ValueSource a, ValueSource b) : base(a,b)
-	  {
-	  }
-
-	  protected internal override string name()
-	  {
-		return "div";
-	  }
+    /// <summary>
+    /// Function to divide "a" by "b"
+    /// </summary>
+    public class DivFloatFunction : DualFloatFunction
+    {
+        /// <param name="a">  the numerator. </param>
+        /// <param name="b">  the denominator. </param>
+        public DivFloatFunction(ValueSource a, ValueSource b)
+            : base(a, b)
+        {
+        }
 
-	  protected internal override float func(int doc, FunctionValues aVals, FunctionValues bVals)
-	  {
-		return aVals.floatVal(doc) / bVals.floatVal(doc);
-	  }
-	}
+        protected override string Name
+        {
+            get { return "div"; }
+        }
 
+        protected override float Func(int doc, FunctionValues aVals, FunctionValues bVals)
+        {
+            return aVals.FloatVal(doc) / bVals.FloatVal(doc);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs
index c9b467a..238a392 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs
@@ -16,162 +16,160 @@
  */
 using System;
 using System.Collections;
-using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
+using Lucene.Net.Index;
+using Lucene.Net.Queries.Function.DocValues;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
     internal class ConstIntDocValues : IntDocValues
-	{
-	  internal readonly int ival;
-	  internal readonly float fval;
-	  internal readonly double dval;
-	  internal readonly long lval;
-	  internal readonly string sval;
-	  internal readonly ValueSource parent;
-
-	  internal ConstIntDocValues(int val, ValueSource parent) : base(parent)
-	  {
-		ival = val;
-		fval = val;
-		dval = val;
-		lval = val;
-		sval = Convert.ToString(val);
-		this.parent = parent;
-	  }
-
-	  public override float floatVal(int doc)
-	  {
-		return fval;
-	  }
-	  public override int intVal(int doc)
-	  {
-		return ival;
-	  }
-	  public override long longVal(int doc)
-	  {
-		return lval;
-	  }
-	  public override double doubleVal(int doc)
-	  {
-		return dval;
-	  }
-	  public override string strVal(int doc)
-	  {
-		return sval;
-	  }
-	  public override string ToString(int doc)
-	  {
-		return parent.description() + '=' + sval;
-	  }
-	}
-
-	internal class ConstDoubleDocValues : DoubleDocValues
-	{
-	  internal readonly int ival;
-	  internal readonly float fval;
-	  internal readonly double dval;
-	  internal readonly long lval;
-	  internal readonly string sval;
-	  internal readonly ValueSource parent;
-
-	  internal ConstDoubleDocValues(double val, ValueSource parent) : base(parent)
-	  {
-		ival = (int)val;
-		fval = (float)val;
-		dval = val;
-		lval = (long)val;
-		sval = Convert.ToString(val);
-		this.parent = parent;
-	  }
-
-	  public override float floatVal(int doc)
-	  {
-		return fval;
-	  }
-	  public override int intVal(int doc)
-	  {
-		return ival;
-	  }
-	  public override long longVal(int doc)
-	  {
-		return lval;
-	  }
-	  public override double doubleVal(int doc)
-	  {
-		return dval;
-	  }
-	  public override string strVal(int doc)
-	  {
-		return sval;
-	  }
-	  public override string ToString(int doc)
-	  {
-		return parent.description() + '=' + sval;
-	  }
-	}
-
-
-	/// <summary>
-	/// <code>DocFreqValueSource</code> returns the number of documents containing the term.
-	/// @lucene.internal
-	/// </summary>
-	public class DocFreqValueSource : ValueSource
-	{
-	  protected internal readonly string field;
-	  protected internal readonly string indexedField;
-	  protected internal readonly string val;
-	  protected internal readonly BytesRef indexedBytes;
-
-	  public DocFreqValueSource(string field, string val, string indexedField, BytesRef indexedBytes)
-	  {
-		this.field = field;
-		this.val = val;
-		this.indexedField = indexedField;
-		this.indexedBytes = indexedBytes;
-	  }
-
-	  public virtual string name()
-	  {
-		return "docfreq";
-	  }
-
-	  public override string description()
-	  {
-		return name() + '(' + field + ',' + val + ')';
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		IndexSearcher searcher = (IndexSearcher)context["searcher"];
-		int docfreq = searcher.IndexReader.docFreq(new Term(indexedField, indexedBytes));
-		return new ConstIntDocValues(docfreq, this);
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		context["searcher"] = searcher;
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return this.GetType().GetHashCode() + indexedField.GetHashCode() * 29 + indexedBytes.GetHashCode();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		DocFreqValueSource other = (DocFreqValueSource)o;
-		return this.indexedField.Equals(other.indexedField) && this.indexedBytes.Equals(other.indexedBytes);
-	  }
-	}
-
-
+    {
+        internal readonly int ival;
+        internal readonly float fval;
+        internal readonly double dval;
+        internal readonly long lval;
+        internal readonly string sval;
+        internal readonly ValueSource parent;
+
+        internal ConstIntDocValues(int val, ValueSource parent)
+            : base(parent)
+        {
+            ival = val;
+            fval = val;
+            dval = val;
+            lval = val;
+            sval = Convert.ToString(val);
+            this.parent = parent;
+        }
+
+        public override float FloatVal(int doc)
+        {
+            return fval;
+        }
+        public override int IntVal(int doc)
+        {
+            return ival;
+        }
+        public override long LongVal(int doc)
+        {
+            return lval;
+        }
+        public override double DoubleVal(int doc)
+        {
+            return dval;
+        }
+        public override string StrVal(int doc)
+        {
+            return sval;
+        }
+        public override string ToString(int doc)
+        {
+            return parent.Description + '=' + sval;
+        }
+    }
+
+    internal class ConstDoubleDocValues : DoubleDocValues
+    {
+        internal readonly int ival;
+        internal readonly float fval;
+        internal readonly double dval;
+        internal readonly long lval;
+        internal readonly string sval;
+        internal readonly ValueSource parent;
+
+        internal ConstDoubleDocValues(double val, ValueSource parent)
+            : base(parent)
+        {
+            ival = (int)val;
+            fval = (float)val;
+            dval = val;
+            lval = (long)val;
+            sval = Convert.ToString(val);
+            this.parent = parent;
+        }
+
+        public override float FloatVal(int doc)
+        {
+            return fval;
+        }
+        public override int IntVal(int doc)
+        {
+            return ival;
+        }
+        public override long LongVal(int doc)
+        {
+            return lval;
+        }
+        public override double DoubleVal(int doc)
+        {
+            return dval;
+        }
+        public override string StrVal(int doc)
+        {
+            return sval;
+        }
+        public override string ToString(int doc)
+        {
+            return parent.Description + '=' + sval;
+        }
+    }
+
+
+    /// <summary>
+    /// <code>DocFreqValueSource</code> returns the number of documents containing the term.
+    /// @lucene.internal
+    /// </summary>
+    public class DocFreqValueSource : ValueSource
+    {
+        protected internal readonly string field;
+        protected internal readonly string indexedField;
+        protected internal readonly string val;
+        protected internal readonly BytesRef indexedBytes;
+
+        public DocFreqValueSource(string field, string val, string indexedField, BytesRef indexedBytes)
+        {
+            this.field = field;
+            this.val = val;
+            this.indexedField = indexedField;
+            this.indexedBytes = indexedBytes;
+        }
+
+        public virtual string Name
+        {
+            get { return "docfreq"; }
+        }
+
+        public override string Description
+        {
+            get { return Name + '(' + field + ',' + val + ')'; }
+        }
+
+        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
+        {
+            var searcher = (IndexSearcher)context["searcher"];
+            int docfreq = searcher.IndexReader.DocFreq(new Term(indexedField, indexedBytes));
+            return new ConstIntDocValues(docfreq, this);
+        }
+
+        public override void CreateWeight(IDictionary context, IndexSearcher searcher)
+        {
+            context["searcher"] = searcher;
+        }
+
+        public override int GetHashCode()
+        {
+            return this.GetType().GetHashCode() + indexedField.GetHashCode() * 29 + indexedBytes.GetHashCode();
+        }
+
+        public override bool Equals(object o)
+        {
+            if (this.GetType() != o.GetType())
+            {
+                return false;
+            }
+            var other = (DocFreqValueSource)o;
+            return this.indexedField.Equals(other.indexedField) && this.indexedBytes.Equals(other.indexedBytes);
+        }
+    }
 }
\ No newline at end of file


[20/21] git commit: More work on Lucene.Net.Queries

Posted by sy...@apache.org.
More work on Lucene.Net.Queries


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/ba0f3c7d
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/ba0f3c7d
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/ba0f3c7d

Branch: refs/heads/master
Commit: ba0f3c7d439cf400c7329022bf29df99c64e4610
Parents: 2b55e53
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Fri Sep 19 17:18:15 2014 +0300
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Fri Sep 19 17:18:15 2014 +0300

----------------------------------------------------------------------
 src/Lucene.Net.Queries/BooleanFilter.cs         |  384 ++--
 src/Lucene.Net.Queries/BoostingQuery.cs         |    8 +-
 src/Lucene.Net.Queries/ChainedFilter.cs         |  507 +++--
 src/Lucene.Net.Queries/CommonTermsQuery.cs      |  944 +++++-----
 src/Lucene.Net.Queries/CustomScoreProvider.cs   |  349 ++--
 src/Lucene.Net.Queries/CustomScoreQuery.cs      |  197 +-
 src/Lucene.Net.Queries/FilterClause.cs          |  166 +-
 src/Lucene.Net.Queries/Function/BoostedQuery.cs |  545 +++---
 .../Function/DocValues/BoolDocValues.cs         |  230 ++-
 .../DocValues/DocTermsIndexDocValues.cs         |  413 ++--
 .../Function/DocValues/DoubleDocValues.cs       |  497 +++--
 .../Function/DocValues/FloatDocValues.cs        |  220 ++-
 .../Function/DocValues/IntDocValues.cs          |  348 ++--
 .../Function/DocValues/LongDocValues.cs         |  368 ++--
 .../Function/DocValues/StrDocValues.cs          |  146 +-
 .../Function/FunctionQuery.cs                   |  511 +++--
 .../Function/FunctionValues.cs                  |  717 +++----
 src/Lucene.Net.Queries/Function/ValueSource.cs  |  415 ++---
 .../Function/ValueSourceScorer.cs               |  214 +--
 .../Function/ValueSources/BoolFunction.cs       |   18 +-
 .../Function/ValueSources/ByteFieldSource.cs    |  258 ++-
 .../ValueSources/BytesRefFieldSource.cs         |  238 ++-
 .../Function/ValueSources/ConstNumberSource.cs  |   26 +-
 .../Function/ValueSources/ConstValueSource.cs   |   14 +-
 .../Function/ValueSources/DefFunction.cs        |   67 +-
 .../Function/ValueSources/DivFloatFunction.cs   |   42 +-
 .../Function/ValueSources/DocFreqValueSource.cs |  306 ++-
 .../ValueSources/DoubleConstValueSource.cs      |   39 +-
 .../Function/ValueSources/DoubleFieldSource.cs  |   33 +-
 .../Function/ValueSources/DualFloatFunction.cs  |  157 +-
 .../Function/ValueSources/EnumFieldSource.cs    |   48 +-
 .../Function/ValueSources/FieldCacheSource.cs   |   94 +-
 .../Function/ValueSources/FloatFieldSource.cs   |    8 +-
 .../Function/ValueSources/IDFValueSource.cs     |    7 +-
 .../Function/ValueSources/IfFunction.cs         |   50 +-
 .../Function/ValueSources/IntFieldSource.cs     |   14 +-
 .../ValueSources/JoinDocFreqValueSource.cs      |    6 +-
 .../ValueSources/LinearFloatFunction.cs         |   24 +-
 .../Function/ValueSources/LiteralValueSource.cs |    8 +-
 .../Function/ValueSources/LongFieldSource.cs    |   10 +-
 .../Function/ValueSources/MaxDocValueSource.cs  |    8 +-
 .../Function/ValueSources/MaxFloatFunction.cs   |    2 +-
 .../Function/ValueSources/MinFloatFunction.cs   |    2 +-
 .../Function/ValueSources/MultiBoolFunction.cs  |   14 +-
 .../Function/ValueSources/MultiFloatFunction.cs |   17 +-
 .../Function/ValueSources/MultiFunction.cs      |  280 ++-
 .../Function/ValueSources/NormValueSource.cs    |   12 +-
 .../Function/ValueSources/NumDocsValueSource.cs |    4 +-
 .../Function/ValueSources/OrdFieldSource.cs     |    6 +-
 .../Function/ValueSources/PowFloatFunction.cs   |    2 +-
 .../ValueSources/ProductFloatFunction.cs        |    2 +-
 .../Function/ValueSources/QueryValueSource.cs   |   16 +-
 .../ValueSources/RangeMapFloatFunction.cs       |   34 +-
 .../ValueSources/ReciprocalFloatFunction.cs     |   24 +-
 .../ValueSources/ReverseOrdFieldSource.cs       |    6 +-
 .../Function/ValueSources/ScaleFloatFunction.cs |   40 +-
 .../Function/ValueSources/ShortFieldSource.cs   |   18 +-
 .../Function/ValueSources/SimpleBoolFunction.cs |   16 +-
 .../ValueSources/SimpleFloatFunction.cs         |    8 +-
 .../Function/ValueSources/SingleFunction.cs     |    6 +-
 .../Function/ValueSources/SumFloatFunction.cs   |    2 +-
 .../ValueSources/SumTotalTermFreqValueSource.cs |   12 +-
 .../Function/ValueSources/TFValueSource.cs      |   51 +-
 .../ValueSources/TermFreqValueSource.cs         |    6 +-
 .../ValueSources/TotalTermFreqValueSource.cs    |   12 +-
 .../Function/ValueSources/VectorValueSource.cs  |  106 +-
 src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs      | 1758 ++++++++----------
 src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs |    7 +-
 src/Lucene.Net.Queries/TermFilter.cs            |  255 ++-
 src/Lucene.Net.Queries/TermsFilter.cs           |   97 +-
 70 files changed, 5471 insertions(+), 5998 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/BooleanFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/BooleanFilter.cs b/src/Lucene.Net.Queries/BooleanFilter.cs
index bcbc6fb..65b6d4e 100644
--- a/src/Lucene.Net.Queries/BooleanFilter.cs
+++ b/src/Lucene.Net.Queries/BooleanFilter.cs
@@ -1,204 +1,202 @@
-using System.Collections.Generic;
+using System.Collections;
+using System.Collections.Generic;
 using System.Diagnostics;
 using System.Text;
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Util;
-using org.apache.lucene.queries;
 
 namespace Lucene.Net.Queries
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
     /// <summary>
-	/// A container Filter that allows Boolean composition of Filters.
-	/// Filters are allocated into one of three logical constructs;
-	/// SHOULD, MUST NOT, MUST
-	/// The results Filter BitSet is constructed as follows:
-	/// SHOULD Filters are OR'd together
-	/// The resulting Filter is NOT'd with the NOT Filters
-	/// The resulting Filter is AND'd with the MUST Filters
-	/// </summary>
-	public class BooleanFilter : Filter, IEnumerable<FilterClause>
-	{
-
-	  private readonly IList<FilterClause> clauses_Renamed = new List<FilterClause>();
-
-	  /// <summary>
-	  /// Returns the a DocIdSetIterator representing the Boolean composition
-	  /// of the filters that have been added.
-	  /// </summary>
-	  public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
-	  {
-		FixedBitSet res = null;
-		AtomicReader reader = context.reader();
-
-		bool hasShouldClauses = false;
-		foreach (FilterClause fc in clauses_Renamed)
-		{
-		  if (fc.Occur == BooleanClause.Occur.SHOULD)
-		  {
-			hasShouldClauses = true;
-			DocIdSetIterator disi = getDISI(fc.Filter, context);
-			if (disi == null)
-			{
-				continue;
-			}
-			if (res == null)
-			{
-			  res = new FixedBitSet(reader.MaxDoc());
-			}
-			res.or(disi);
-		  }
-		}
-		if (hasShouldClauses && res == null)
-		{
-		  return null;
-		}
-
-		foreach (FilterClause fc in clauses_Renamed)
-		{
-		  if (fc.Occur == BooleanClause.Occur.MUST_NOT)
-		  {
-			if (res == null)
-			{
-			  Debug.Assert(!hasShouldClauses);
-			  res = new FixedBitSet(reader.MaxDoc());
-			  res.Set(0, reader.MaxDoc()); // NOTE: may set bits on deleted docs
-			}
-
-              DocIdSetIterator disi = GetDISI(fc.Filter, context);
-			if (disi != null)
-			{
-			  res.AndNot(disi);
-			}
-		  }
-		}
-
-		foreach (FilterClause fc in clauses_Renamed)
-		{
-		  if (fc.Occur == BooleanClause.Occur.MUST)
-		  {
-			DocIdSetIterator disi = GetDISI(fc.Filter, context);
-			if (disi == null)
-			{
-			  return null; // no documents can match
-			}
-			if (res == null)
-			{
-			  res = new FixedBitSet(reader.maxDoc());
-			  res.or(disi);
-			}
-			else
-			{
-			  res.and(disi);
-			}
-		  }
-		}
-
-		return BitsFilteredDocIdSet.wrap(res, acceptDocs);
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private static org.apache.lucene.search.DocIdSetIterator getDISI(org.apache.lucene.search.Filter filter, org.apache.lucene.index.AtomicReaderContext context) throws java.io.IOException
-	  private static DocIdSetIterator GetDISI(Filter filter, AtomicReaderContext context)
-	  {
-		// we dont pass acceptDocs, we will filter at the end using an additional filter
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.DocIdSet set = filter.getDocIdSet(context, null);
-		DocIdSet set = filter.GetDocIdSet(context, null);
-		return set == null ? null : set.GetEnumerator();
-	  }
-
-	  /// <summary>
-	  /// Adds a new FilterClause to the Boolean Filter container </summary>
-	  /// <param name="filterClause"> A FilterClause object containing a Filter and an Occur parameter </param>
-	  public virtual void Add(FilterClause filterClause)
-	  {
-		clauses_Renamed.Add(filterClause);
-	  }
-
-	  public void Add(Filter filter, BooleanClause.Occur occur)
-	  {
-		Add(new FilterClause(filter, occur));
-	  }
-
-	  /// <summary>
-	  /// Returns the list of clauses
-	  /// </summary>
-	  public virtual IList<FilterClause> clauses()
-	  {
-		return clauses_Renamed;
-	  }
-
-	  /// <summary>
-	  /// Returns an iterator on the clauses in this query. It implements the <seealso cref="Iterable"/> interface to
-	  /// make it possible to do:
-	  /// <pre class="prettyprint">for (FilterClause clause : booleanFilter) {}</pre>
-	  /// </summary>
-	  public IEnumerator<FilterClause> GetEnumerator()
-	  {
-		return clauses().GetEnumerator();
-	  }
-
-	  public override bool Equals(object obj)
-	  {
-		if (this == obj)
-		{
-		  return true;
-		}
-
-		if ((obj == null) || (obj.GetType() != this.GetType()))
-		{
-		  return false;
-		}
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final BooleanFilter other = (BooleanFilter)obj;
-		BooleanFilter other = (BooleanFilter)obj;
-		return clauses_Renamed.Equals(other.clauses_Renamed);
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return 657153718 ^ clauses_Renamed.GetHashCode();
-	  }
-
-	  /// <summary>
-	  /// Prints a user-readable version of this Filter. </summary>
-	  public override string ToString()
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final StringBuilder buffer = new StringBuilder("BooleanFilter(");
-		StringBuilder buffer = new StringBuilder("BooleanFilter(");
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int minLen = buffer.length();
-		int minLen = buffer.Length;
-		foreach (FilterClause c in clauses_Renamed)
-		{
-		  if (buffer.Length > minLen)
-		  {
-			buffer.Append(' ');
-		  }
-		  buffer.Append(c);
-		}
-		return buffer.Append(')').ToString();
-	  }
-	}
-
+    /// A container Filter that allows Boolean composition of Filters.
+    /// Filters are allocated into one of three logical constructs;
+    /// SHOULD, MUST NOT, MUST
+    /// The results Filter BitSet is constructed as follows:
+    /// SHOULD Filters are OR'd together
+    /// The resulting Filter is NOT'd with the NOT Filters
+    /// The resulting Filter is AND'd with the MUST Filters
+    /// </summary>
+    public class BooleanFilter : Filter, IEnumerable<FilterClause>
+    {
+
+        private readonly IList<FilterClause> clauses = new List<FilterClause>();
+
+        /// <summary>
+        /// Returns the a DocIdSetIterator representing the Boolean composition
+        /// of the filters that have been added.
+        /// </summary>
+        public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
+        {
+            FixedBitSet res = null;
+            AtomicReader reader = context.AtomicReader;
+
+            bool hasShouldClauses = false;
+            foreach (FilterClause fc in clauses)
+            {
+                if (fc.Occur == BooleanClause.Occur.SHOULD)
+                {
+                    hasShouldClauses = true;
+                    DocIdSetIterator disi = GetDISI(fc.Filter, context);
+                    if (disi == null)
+                    {
+                        continue;
+                    }
+                    if (res == null)
+                    {
+                        res = new FixedBitSet(reader.MaxDoc);
+                    }
+                    res.Or(disi);
+                }
+            }
+            if (hasShouldClauses && res == null)
+            {
+                return null;
+            }
+
+            foreach (FilterClause fc in clauses)
+            {
+                if (fc.Occur == BooleanClause.Occur.MUST_NOT)
+                {
+                    if (res == null)
+                    {
+                        Debug.Assert(!hasShouldClauses);
+                        res = new FixedBitSet(reader.MaxDoc);
+                        res.Set(0, reader.MaxDoc); // NOTE: may set bits on deleted docs
+                    }
+
+                    DocIdSetIterator disi = GetDISI(fc.Filter, context);
+                    if (disi != null)
+                    {
+                        res.AndNot(disi);
+                    }
+                }
+            }
+
+            foreach (FilterClause fc in clauses)
+            {
+                if (fc.Occur == BooleanClause.Occur.MUST)
+                {
+                    DocIdSetIterator disi = GetDISI(fc.Filter, context);
+                    if (disi == null)
+                    {
+                        return null; // no documents can match
+                    }
+                    if (res == null)
+                    {
+                        res = new FixedBitSet(reader.MaxDoc);
+                        res.Or(disi);
+                    }
+                    else
+                    {
+                        res.And(disi);
+                    }
+                }
+            }
+
+            return BitsFilteredDocIdSet.Wrap(res, acceptDocs);
+        }
+
+        private static DocIdSetIterator GetDISI(Filter filter, AtomicReaderContext context)
+        {
+            // we dont pass acceptDocs, we will filter at the end using an additional filter
+            DocIdSet set = filter.GetDocIdSet(context, null);
+            return set == null ? null : set.GetEnumerator();
+        }
+
+        /// <summary>
+        /// Adds a new FilterClause to the Boolean Filter container </summary>
+        /// <param name="filterClause"> A FilterClause object containing a Filter and an Occur parameter </param>
+        public virtual void Add(FilterClause filterClause)
+        {
+            clauses.Add(filterClause);
+        }
+
+        public void Add(Filter filter, BooleanClause.Occur occur)
+        {
+            Add(new FilterClause(filter, occur));
+        }
+
+        /// <summary>
+        /// Returns the list of clauses
+        /// </summary>
+        public virtual IList<FilterClause> Clauses
+        {
+            get { return clauses; }
+        }
+
+        /// <summary>
+        /// Returns an iterator on the clauses in this query. It implements the <seealso cref="Iterable"/> interface to
+        /// make it possible to do:
+        /// <pre class="prettyprint">for (FilterClause clause : booleanFilter) {}</pre>
+        /// </summary>
+        public IEnumerator<FilterClause> GetEnumerator()
+        {
+            return Clauses.GetEnumerator();
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (this == obj)
+            {
+                return true;
+            }
+
+            if ((obj == null) || (obj.GetType() != this.GetType()))
+            {
+                return false;
+            }
+
+            BooleanFilter other = (BooleanFilter)obj;
+            return clauses.Equals(other.clauses);
+        }
+
+        public override int GetHashCode()
+        {
+            return 657153718 ^ clauses.GetHashCode();
+        }
+
+        /// <summary>
+        /// Prints a user-readable version of this Filter. </summary>
+        public override string ToString()
+        {
+            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+            //ORIGINAL LINE: final StringBuilder buffer = new StringBuilder("BooleanFilter(");
+            StringBuilder buffer = new StringBuilder("BooleanFilter(");
+            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+            //ORIGINAL LINE: final int minLen = buffer.length();
+            int minLen = buffer.Length;
+            foreach (FilterClause c in clauses)
+            {
+                if (buffer.Length > minLen)
+                {
+                    buffer.Append(' ');
+                }
+                buffer.Append(c);
+            }
+            return buffer.Append(')').ToString();
+        }
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return GetEnumerator();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/BoostingQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/BoostingQuery.cs b/src/Lucene.Net.Queries/BoostingQuery.cs
index 203a2ae..8212f98 100644
--- a/src/Lucene.Net.Queries/BoostingQuery.cs
+++ b/src/Lucene.Net.Queries/BoostingQuery.cs
@@ -72,8 +72,8 @@
 			}
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public Weight createWeight(IndexSearcher searcher) throws java.io.IOException
-			public override Weight createWeight(IndexSearcher searcher)
+//ORIGINAL LINE: @Override public Weight CreateWeight(IndexSearcher searcher) throws java.io.IOException
+			public override Weight CreateWeight(IndexSearcher searcher)
 			{
 			  return new BooleanWeightAnonymousInnerClassHelper(this, searcher);
 			}
@@ -111,7 +111,7 @@
 		{
 		  const int prime = 31;
 		  int result = base.GetHashCode();
-		  result = prime * result + float.floatToIntBits(boost);
+		  result = prime * result + Number.FloatToIntBits(boost);
 		  result = prime * result + ((context == null) ? 0 : context.GetHashCode());
 		  result = prime * result + ((match == null) ? 0 : match.GetHashCode());
 		  return result;
@@ -138,7 +138,7 @@
 		  }
 
 		  BoostingQuery other = (BoostingQuery) obj;
-		  if (float.floatToIntBits(boost) != float.floatToIntBits(other.boost))
+		  if (Number.FloatToIntBits(boost) != Number.FloatToIntBits(other.boost))
 		  {
 			return false;
 		  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/ChainedFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/ChainedFilter.cs b/src/Lucene.Net.Queries/ChainedFilter.cs
index c6aec63..e0c1112 100644
--- a/src/Lucene.Net.Queries/ChainedFilter.cs
+++ b/src/Lucene.Net.Queries/ChainedFilter.cs
@@ -1,285 +1,266 @@
 using System.Text;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
 
-namespace org.apache.lucene.queries
+namespace Lucene.Net.Queries
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// <para>
+    /// Allows multiple <seealso cref="Filter"/>s to be chained.
+    /// Logical operations such as <b>NOT</b> and <b>XOR</b>
+    /// are applied between filters. One operation can be used
+    /// for all filters, or a specific operation can be declared
+    /// for each filter.
+    /// </para>
+    /// <para>
+    /// Order in which filters are called depends on
+    /// the position of the filter in the chain. It's probably
+    /// more efficient to place the most restrictive filters
+    /// /least computationally-intensive filters first.
+    /// </para>
+    /// </summary>
+    public class ChainedFilter : Filter
+    {
 
-	using AtomicReader = org.apache.lucene.index.AtomicReader;
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using BitsFilteredDocIdSet = org.apache.lucene.search.BitsFilteredDocIdSet;
-	using DocIdSet = org.apache.lucene.search.DocIdSet;
-	using DocIdSetIterator = org.apache.lucene.search.DocIdSetIterator;
-	using Filter = org.apache.lucene.search.Filter;
-	using Bits = org.apache.lucene.util.Bits;
-	using FixedBitSet = org.apache.lucene.util.FixedBitSet;
+        public const int OR = 0;
+        public const int AND = 1;
+        public const int ANDNOT = 2;
+        public const int XOR = 3;
+        /// <summary>
+        /// Logical operation when none is declared. Defaults to OR.
+        /// </summary>
+        public const int DEFAULT = OR;
 
-	/// <summary>
-	/// <para>
-	/// Allows multiple <seealso cref="Filter"/>s to be chained.
-	/// Logical operations such as <b>NOT</b> and <b>XOR</b>
-	/// are applied between filters. One operation can be used
-	/// for all filters, or a specific operation can be declared
-	/// for each filter.
-	/// </para>
-	/// <para>
-	/// Order in which filters are called depends on
-	/// the position of the filter in the chain. It's probably
-	/// more efficient to place the most restrictive filters
-	/// /least computationally-intensive filters first.
-	/// </para>
-	/// </summary>
-	public class ChainedFilter : Filter
-	{
+        /// <summary>
+        /// The filter chain
+        /// </summary>
+        private Filter[] chain = null;
 
-	  public const int OR = 0;
-	  public const int AND = 1;
-	  public const int ANDNOT = 2;
-	  public const int XOR = 3;
-	  /// <summary>
-	  /// Logical operation when none is declared. Defaults to OR.
-	  /// </summary>
-	  public const int DEFAULT = OR;
+        private int[] logicArray;
 
-	  /// <summary>
-	  /// The filter chain
-	  /// </summary>
-	  private Filter[] chain = null;
+        private int logic = -1;
 
-	  private int[] logicArray;
+        /// <summary>
+        /// Ctor.
+        /// </summary>
+        /// <param name="chain"> The chain of filters </param>
+        public ChainedFilter(Filter[] chain)
+        {
+            this.chain = chain;
+        }
 
-	  private int logic = -1;
+        /// <summary>
+        /// Ctor.
+        /// </summary>
+        /// <param name="chain"> The chain of filters </param>
+        /// <param name="logicArray"> Logical operations to apply between filters </param>
+        public ChainedFilter(Filter[] chain, int[] logicArray)
+        {
+            this.chain = chain;
+            this.logicArray = logicArray;
+        }
 
-	  /// <summary>
-	  /// Ctor.
-	  /// </summary>
-	  /// <param name="chain"> The chain of filters </param>
-	  public ChainedFilter(Filter[] chain)
-	  {
-		this.chain = chain;
-	  }
+        /// <summary>
+        /// Ctor.
+        /// </summary>
+        /// <param name="chain"> The chain of filters </param>
+        /// <param name="logic"> Logical operation to apply to ALL filters </param>
+        public ChainedFilter(Filter[] chain, int logic)
+        {
+            this.chain = chain;
+            this.logic = logic;
+        }
 
-	  /// <summary>
-	  /// Ctor.
-	  /// </summary>
-	  /// <param name="chain"> The chain of filters </param>
-	  /// <param name="logicArray"> Logical operations to apply between filters </param>
-	  public ChainedFilter(Filter[] chain, int[] logicArray)
-	  {
-		this.chain = chain;
-		this.logicArray = logicArray;
-	  }
+        /// <summary>
+        /// <seealso cref="Filter#GetDocIdSet"/>.
+        /// </summary>
+        public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
+        {
+            int[] index = new int[1]; // use array as reference to modifiable int;
+            index[0] = 0; // an object attribute would not be thread safe.
+            if (logic != -1)
+            {
+                return BitsFilteredDocIdSet.Wrap(GetDocIdSet(context, logic, index), acceptDocs);
+            }
+            else if (logicArray != null)
+            {
+                return BitsFilteredDocIdSet.Wrap(GetDocIdSet(context, logicArray, index), acceptDocs);
+            }
 
-	  /// <summary>
-	  /// Ctor.
-	  /// </summary>
-	  /// <param name="chain"> The chain of filters </param>
-	  /// <param name="logic"> Logical operation to apply to ALL filters </param>
-	  public ChainedFilter(Filter[] chain, int logic)
-	  {
-		this.chain = chain;
-		this.logic = logic;
-	  }
+            return BitsFilteredDocIdSet.Wrap(GetDocIdSet(context, DEFAULT, index), acceptDocs);
+        }
 
-	  /// <summary>
-	  /// <seealso cref="Filter#getDocIdSet"/>.
-	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.AtomicReaderContext context, org.apache.lucene.util.Bits acceptDocs) throws java.io.IOException
-	  public override DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs)
-	  {
-		int[] index = new int[1]; // use array as reference to modifiable int;
-		index[0] = 0; // an object attribute would not be thread safe.
-		if (logic != -1)
-		{
-		  return BitsFilteredDocIdSet.wrap(getDocIdSet(context, logic, index), acceptDocs);
-		}
-		else if (logicArray != null)
-		{
-		  return BitsFilteredDocIdSet.wrap(getDocIdSet(context, logicArray, index), acceptDocs);
-		}
+        private DocIdSetIterator GetDISI(Filter filter, AtomicReaderContext context)
+        {
+            // we dont pass acceptDocs, we will filter at the end using an additional filter
+            DocIdSet docIdSet = filter.GetDocIdSet(context, null);
+            if (docIdSet == null)
+            {
+                return DocIdSetIterator.Empty();
+            }
+            else
+            {
+                DocIdSetIterator iter = docIdSet.GetEnumerator();
+                if (iter == null)
+                {
+                    return DocIdSetIterator.Empty();
+                }
+                else
+                {
+                    return iter;
+                }
+            }
+        }
 
-		return BitsFilteredDocIdSet.wrap(getDocIdSet(context, DEFAULT, index), acceptDocs);
-	  }
+        private FixedBitSet InitialResult(AtomicReaderContext context, int logic, int[] index)
+        {
+            AtomicReader reader = context.AtomicReader;
+            FixedBitSet result = new FixedBitSet(reader.MaxDoc);
+            if (logic == AND)
+            {
+                result.Or(GetDISI(chain[index[0]], context));
+                ++index[0];
+            }
+            else if (logic == ANDNOT)
+            {
+                result.Or(GetDISI(chain[index[0]], context));
+                result.Flip(0, reader.MaxDoc); // NOTE: may set bits for deleted docs.
+                ++index[0];
+            }
+            return result;
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private org.apache.lucene.search.DocIdSetIterator getDISI(org.apache.lucene.search.Filter filter, org.apache.lucene.index.AtomicReaderContext context) throws java.io.IOException
-	  private DocIdSetIterator getDISI(Filter filter, AtomicReaderContext context)
-	  {
-		// we dont pass acceptDocs, we will filter at the end using an additional filter
-		DocIdSet docIdSet = filter.getDocIdSet(context, null);
-		if (docIdSet == null)
-		{
-		  return DocIdSetIterator.empty();
-		}
-		else
-		{
-		  DocIdSetIterator iter = docIdSet.GetEnumerator();
-		  if (iter == null)
-		  {
-			return DocIdSetIterator.empty();
-		  }
-		  else
-		  {
-			return iter;
-		  }
-		}
-	  }
+        /// <summary>
+        /// Delegates to each filter in the chain.
+        /// </summary>
+        /// <param name="context"> AtomicReaderContext </param>
+        /// <param name="logic"> Logical operation </param>
+        /// <returns> DocIdSet </returns>
+        private DocIdSet GetDocIdSet(AtomicReaderContext context, int logic, int[] index)
+        {
+            FixedBitSet result = InitialResult(context, logic, index);
+            for (; index[0] < chain.Length; index[0]++)
+            {
+                // we dont pass acceptDocs, we will filter at the end using an additional filter
+                doChain(result, logic, chain[index[0]].GetDocIdSet(context, null));
+            }
+            return result;
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private org.apache.lucene.util.FixedBitSet initialResult(org.apache.lucene.index.AtomicReaderContext context, int logic, int[] index) throws java.io.IOException
-	  private FixedBitSet initialResult(AtomicReaderContext context, int logic, int[] index)
-	  {
-		AtomicReader reader = context.reader();
-		FixedBitSet result = new FixedBitSet(reader.maxDoc());
-		if (logic == AND)
-		{
-		  result.or(getDISI(chain[index[0]], context));
-		  ++index[0];
-		}
-		else if (logic == ANDNOT)
-		{
-		  result.or(getDISI(chain[index[0]], context));
-		  result.flip(0, reader.maxDoc()); // NOTE: may set bits for deleted docs.
-		  ++index[0];
-		}
-		return result;
-	  }
+        /// <summary>
+        /// Delegates to each filter in the chain.
+        /// </summary>
+        /// <param name="context"> AtomicReaderContext </param>
+        /// <param name="logic"> Logical operation </param>
+        /// <returns> DocIdSet </returns>
+        private DocIdSet GetDocIdSet(AtomicReaderContext context, int[] logic, int[] index)
+        {
+            if (logic.Length != chain.Length)
+            {
+                throw new System.ArgumentException("Invalid number of elements in logic array");
+            }
 
-	  /// <summary>
-	  /// Delegates to each filter in the chain.
-	  /// </summary>
-	  /// <param name="context"> AtomicReaderContext </param>
-	  /// <param name="logic"> Logical operation </param>
-	  /// <returns> DocIdSet </returns>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.AtomicReaderContext context, int logic, int[] index) throws java.io.IOException
-	  private DocIdSet getDocIdSet(AtomicReaderContext context, int logic, int[] index)
-	  {
-		FixedBitSet result = initialResult(context, logic, index);
-		for (; index[0] < chain.Length; index[0]++)
-		{
-		  // we dont pass acceptDocs, we will filter at the end using an additional filter
-		  doChain(result, logic, chain[index[0]].getDocIdSet(context, null));
-		}
-		return result;
-	  }
+            FixedBitSet result = InitialResult(context, logic[0], index);
+            for (; index[0] < chain.Length; index[0]++)
+            {
+                // we dont pass acceptDocs, we will filter at the end using an additional filter
+                doChain(result, logic[index[0]], chain[index[0]].GetDocIdSet(context, null));
+            }
+            return result;
+        }
 
-	  /// <summary>
-	  /// Delegates to each filter in the chain.
-	  /// </summary>
-	  /// <param name="context"> AtomicReaderContext </param>
-	  /// <param name="logic"> Logical operation </param>
-	  /// <returns> DocIdSet </returns>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.AtomicReaderContext context, int[] logic, int[] index) throws java.io.IOException
-	  private DocIdSet getDocIdSet(AtomicReaderContext context, int[] logic, int[] index)
-	  {
-		if (logic.Length != chain.Length)
-		{
-		  throw new System.ArgumentException("Invalid number of elements in logic array");
-		}
+        public override string ToString()
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append("ChainedFilter: [");
+            foreach (Filter aChain in chain)
+            {
+                sb.Append(aChain);
+                sb.Append(' ');
+            }
+            sb.Append(']');
+            return sb.ToString();
+        }
 
-		FixedBitSet result = initialResult(context, logic[0], index);
-		for (; index[0] < chain.Length; index[0]++)
-		{
-		  // we dont pass acceptDocs, we will filter at the end using an additional filter
-		  doChain(result, logic[index[0]], chain[index[0]].getDocIdSet(context, null));
-		}
-		return result;
-	  }
-
-	  public override string ToString()
-	  {
-		StringBuilder sb = new StringBuilder();
-		sb.Append("ChainedFilter: [");
-		foreach (Filter aChain in chain)
-		{
-		  sb.Append(aChain);
-		  sb.Append(' ');
-		}
-		sb.Append(']');
-		return sb.ToString();
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private void doChain(org.apache.lucene.util.FixedBitSet result, int logic, org.apache.lucene.search.DocIdSet dis) throws java.io.IOException
-	  private void doChain(FixedBitSet result, int logic, DocIdSet dis)
-	  {
-		if (dis is FixedBitSet)
-		{
-		  // optimized case for FixedBitSets
-		  switch (logic)
-		  {
-			case OR:
-			  result.or((FixedBitSet) dis);
-			  break;
-			case AND:
-			  result.and((FixedBitSet) dis);
-			  break;
-			case ANDNOT:
-			  result.andNot((FixedBitSet) dis);
-			  break;
-			case XOR:
-			  result.xor((FixedBitSet) dis);
-			  break;
-			default:
-			  doChain(result, DEFAULT, dis);
-			  break;
-		  }
-		}
-		else
-		{
-		  DocIdSetIterator disi;
-		  if (dis == null)
-		  {
-			disi = DocIdSetIterator.empty();
-		  }
-		  else
-		  {
-			disi = dis.GetEnumerator();
-			if (disi == null)
-			{
-			  disi = DocIdSetIterator.empty();
-			}
-		  }
-
-		  switch (logic)
-		  {
-			case OR:
-			  result.or(disi);
-			  break;
-			case AND:
-			  result.and(disi);
-			  break;
-			case ANDNOT:
-			  result.andNot(disi);
-			  break;
-			case XOR:
-			  result.xor(disi);
-			  break;
-			default:
-			  doChain(result, DEFAULT, dis);
-			  break;
-		  }
-		}
-	  }
-
-	}
+        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+        //ORIGINAL LINE: private void doChain(org.apache.lucene.util.FixedBitSet result, int logic, org.apache.lucene.search.DocIdSet dis) throws java.io.IOException
+        private void doChain(FixedBitSet result, int logic, DocIdSet dis)
+        {
+            if (dis is FixedBitSet)
+            {
+                // optimized case for FixedBitSets
+                switch (logic)
+                {
+                    case OR:
+                        result.Or((FixedBitSet)dis);
+                        break;
+                    case AND:
+                        result.And((FixedBitSet)dis);
+                        break;
+                    case ANDNOT:
+                        result.AndNot((FixedBitSet)dis);
+                        break;
+                    case XOR:
+                        result.Xor((FixedBitSet)dis);
+                        break;
+                    default:
+                        doChain(result, DEFAULT, dis);
+                        break;
+                }
+            }
+            else
+            {
+                DocIdSetIterator disi;
+                if (dis == null)
+                {
+                    disi = DocIdSetIterator.Empty();
+                }
+                else
+                {
+                    disi = dis.GetEnumerator();
+                    if (disi == null)
+                    {
+                        disi = DocIdSetIterator.Empty();
+                    }
+                }
 
+                switch (logic)
+                {
+                    case OR:
+                        result.Or(disi);
+                        break;
+                    case AND:
+                        result.And(disi);
+                        break;
+                    case ANDNOT:
+                        result.AndNot(disi);
+                        break;
+                    case XOR:
+                        result.Xor(disi);
+                        break;
+                    default:
+                        doChain(result, DEFAULT, dis);
+                        break;
+                }
+            }
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/CommonTermsQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/CommonTermsQuery.cs b/src/Lucene.Net.Queries/CommonTermsQuery.cs
index 0d78a68..70f093d 100644
--- a/src/Lucene.Net.Queries/CommonTermsQuery.cs
+++ b/src/Lucene.Net.Queries/CommonTermsQuery.cs
@@ -1,526 +1,480 @@
 using System;
-using System.Diagnostics;
 using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
 using System.Text;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Search.Similarities;
+using Lucene.Net.Support;
+using Lucene.Net.Util;
 
-namespace org.apache.lucene.queries
+namespace Lucene.Net.Queries
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using Fields = org.apache.lucene.index.Fields;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using Term = org.apache.lucene.index.Term;
-	using TermContext = org.apache.lucene.index.TermContext;
-	using Terms = org.apache.lucene.index.Terms;
-	using TermsEnum = org.apache.lucene.index.TermsEnum;
-	using BooleanClause = org.apache.lucene.search.BooleanClause;
-	using Occur = org.apache.lucene.search.BooleanClause.Occur;
-	using BooleanQuery = org.apache.lucene.search.BooleanQuery;
-	using Query = org.apache.lucene.search.Query;
-	using TermQuery = org.apache.lucene.search.TermQuery;
-	using Similarity = org.apache.lucene.search.similarities.Similarity;
-	using ToStringUtils = org.apache.lucene.util.ToStringUtils;
-
-
-	/// <summary>
-	/// A query that executes high-frequency terms in a optional sub-query to prevent
-	/// slow queries due to "common" terms like stopwords. This query
-	/// builds 2 queries off the <seealso cref="#add(Term) added"/> terms: low-frequency
-	/// terms are added to a required boolean clause and high-frequency terms are
-	/// added to an optional boolean clause. The optional clause is only executed if
-	/// the required "low-frequency" clause matches. Scores produced by this query
-	/// will be slightly different than plain <seealso cref="BooleanQuery"/> scorer mainly due to
-	/// differences in the <seealso cref="Similarity#coord(int,int) number of leaf queries"/>
-	/// in the required boolean clause. In most cases, high-frequency terms are
-	/// unlikely to significantly contribute to the document score unless at least
-	/// one of the low-frequency terms are matched.  This query can improve
-	/// query execution times significantly if applicable.
-	/// <para>
-	/// <seealso cref="CommonTermsQuery"/> has several advantages over stopword filtering at
-	/// index or query time since a term can be "classified" based on the actual
-	/// document frequency in the index and can prevent slow queries even across
-	/// domains without specialized stopword files.
-	/// </para>
-	/// <para>
-	/// <b>Note:</b> if the query only contains high-frequency terms the query is
-	/// rewritten into a plain conjunction query ie. all high-frequency terms need to
-	/// match in order to match a document.
-	/// </para>
-	/// </summary>
-	public class CommonTermsQuery : Query
-	{
-	  /*
-	   * TODO maybe it would make sense to abstract this even further and allow to
-	   * rewrite to dismax rather than boolean. Yet, this can already be subclassed
-	   * to do so.
-	   */
-	  protected internal readonly IList<Term> terms = new List<Term>();
-	  protected internal readonly bool disableCoord;
-	  protected internal readonly float maxTermFrequency;
-	  protected internal readonly BooleanClause.Occur lowFreqOccur;
-	  protected internal readonly BooleanClause.Occur highFreqOccur;
-	  protected internal float lowFreqBoost = 1.0f;
-	  protected internal float highFreqBoost = 1.0f;
-	  protected internal float lowFreqMinNrShouldMatch = 0;
-	  protected internal float highFreqMinNrShouldMatch = 0;
-
-	  /// <summary>
-	  /// Creates a new <seealso cref="CommonTermsQuery"/>
-	  /// </summary>
-	  /// <param name="highFreqOccur">
-	  ///          <seealso cref="Occur"/> used for high frequency terms </param>
-	  /// <param name="lowFreqOccur">
-	  ///          <seealso cref="Occur"/> used for low frequency terms </param>
-	  /// <param name="maxTermFrequency">
-	  ///          a value in [0..1) (or absolute number >=1) representing the
-	  ///          maximum threshold of a terms document frequency to be considered a
-	  ///          low frequency term. </param>
-	  /// <exception cref="IllegalArgumentException">
-	  ///           if <seealso cref="Occur#MUST_NOT"/> is pass as lowFreqOccur or
-	  ///           highFreqOccur </exception>
-	  public CommonTermsQuery(BooleanClause.Occur highFreqOccur, BooleanClause.Occur lowFreqOccur, float maxTermFrequency) : this(highFreqOccur, lowFreqOccur, maxTermFrequency, false)
-	  {
-	  }
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// A query that executes high-frequency terms in a optional sub-query to prevent
+    /// slow queries due to "common" terms like stopwords. This query
+    /// builds 2 queries off the <seealso cref="#add(Term) added"/> terms: low-frequency
+    /// terms are added to a required boolean clause and high-frequency terms are
+    /// added to an optional boolean clause. The optional clause is only executed if
+    /// the required "low-frequency" clause matches. Scores produced by this query
+    /// will be slightly different than plain <seealso cref="BooleanQuery"/> scorer mainly due to
+    /// differences in the <seealso cref="Similarity#coord(int,int) number of leaf queries"/>
+    /// in the required boolean clause. In most cases, high-frequency terms are
+    /// unlikely to significantly contribute to the document score unless at least
+    /// one of the low-frequency terms are matched.  This query can improve
+    /// query execution times significantly if applicable.
+    /// <para>
+    /// <seealso cref="CommonTermsQuery"/> has several advantages over stopword filtering at
+    /// index or query time since a term can be "classified" based on the actual
+    /// document frequency in the index and can prevent slow queries even across
+    /// domains without specialized stopword files.
+    /// </para>
+    /// <para>
+    /// <b>Note:</b> if the query only contains high-frequency terms the query is
+    /// rewritten into a plain conjunction query ie. all high-frequency terms need to
+    /// match in order to match a document.
+    /// </para>
+    /// </summary>
+    public class CommonTermsQuery : Query
+    {
+        /*
+         * TODO maybe it would make sense to abstract this even further and allow to
+         * rewrite to dismax rather than boolean. Yet, this can already be subclassed
+         * to do so.
+         */
+        protected internal readonly IList<Term> terms = new List<Term>();
+        protected internal readonly bool disableCoord;
+        protected internal readonly float maxTermFrequency;
+        protected internal readonly BooleanClause.Occur lowFreqOccur;
+        protected internal readonly BooleanClause.Occur highFreqOccur;
+        protected internal float lowFreqBoost = 1.0f;
+        protected internal float highFreqBoost = 1.0f;
+       
 
-	  /// <summary>
-	  /// Creates a new <seealso cref="CommonTermsQuery"/>
-	  /// </summary>
-	  /// <param name="highFreqOccur">
-	  ///          <seealso cref="Occur"/> used for high frequency terms </param>
-	  /// <param name="lowFreqOccur">
-	  ///          <seealso cref="Occur"/> used for low frequency terms </param>
-	  /// <param name="maxTermFrequency">
-	  ///          a value in [0..1) (or absolute number >=1) representing the
-	  ///          maximum threshold of a terms document frequency to be considered a
-	  ///          low frequency term. </param>
-	  /// <param name="disableCoord">
-	  ///          disables <seealso cref="Similarity#coord(int,int)"/> in scoring for the low
-	  ///          / high frequency sub-queries </param>
-	  /// <exception cref="IllegalArgumentException">
-	  ///           if <seealso cref="Occur#MUST_NOT"/> is pass as lowFreqOccur or
-	  ///           highFreqOccur </exception>
-	  public CommonTermsQuery(BooleanClause.Occur highFreqOccur, BooleanClause.Occur lowFreqOccur, float maxTermFrequency, bool disableCoord)
-	  {
-		if (highFreqOccur == BooleanClause.Occur.MUST_NOT)
-		{
-		  throw new System.ArgumentException("highFreqOccur should be MUST or SHOULD but was MUST_NOT");
-		}
-		if (lowFreqOccur == BooleanClause.Occur.MUST_NOT)
-		{
-		  throw new System.ArgumentException("lowFreqOccur should be MUST or SHOULD but was MUST_NOT");
-		}
-		this.disableCoord = disableCoord;
-		this.highFreqOccur = highFreqOccur;
-		this.lowFreqOccur = lowFreqOccur;
-		this.maxTermFrequency = maxTermFrequency;
-	  }
+        /// <summary>
+        /// Creates a new <seealso cref="CommonTermsQuery"/>
+        /// </summary>
+        /// <param name="highFreqOccur">
+        ///          <seealso cref="BooleanClause.Occur"/> used for high frequency terms </param>
+        /// <param name="lowFreqOccur">
+        ///          <seealso cref="BooleanClause.Occur"/> used for low frequency terms </param>
+        /// <param name="maxTermFrequency">
+        ///          a value in [0..1) (or absolute number >=1) representing the
+        ///          maximum threshold of a terms document frequency to be considered a
+        ///          low frequency term. </param>
+        /// <exception cref="ArgumentException">
+        ///           if <seealso cref="BooleanClause.Occur#MUST_NOT"/> is pass as lowFreqOccur or
+        ///           highFreqOccur </exception>
+        public CommonTermsQuery(BooleanClause.Occur highFreqOccur, BooleanClause.Occur lowFreqOccur, float maxTermFrequency)
+            : this(highFreqOccur, lowFreqOccur, maxTermFrequency, false)
+        {
+        }
 
-	  /// <summary>
-	  /// Adds a term to the <seealso cref="CommonTermsQuery"/>
-	  /// </summary>
-	  /// <param name="term">
-	  ///          the term to add </param>
-	  public virtual void add(Term term)
-	  {
-		if (term == null)
-		{
-		  throw new System.ArgumentException("Term must not be null");
-		}
-		this.terms.Add(term);
-	  }
+        /// <summary>
+        /// Creates a new <seealso cref="CommonTermsQuery"/>
+        /// </summary>
+        /// <param name="highFreqOccur">
+        ///          <seealso cref="BooleanClause.Occur"/> used for high frequency terms </param>
+        /// <param name="lowFreqOccur">
+        ///          <seealso cref="BooleanClause.Occur"/> used for low frequency terms </param>
+        /// <param name="maxTermFrequency">
+        ///          a value in [0..1) (or absolute number >=1) representing the
+        ///          maximum threshold of a terms document frequency to be considered a
+        ///          low frequency term. </param>
+        /// <param name="disableCoord">
+        ///          disables <seealso cref="Similarity#coord(int,int)"/> in scoring for the low
+        ///          / high frequency sub-queries </param>
+        /// <exception cref="ArgumentException">
+        ///           if <seealso cref="BooleanClause.Occur#MUST_NOT"/> is pass as lowFreqOccur or
+        ///           highFreqOccur </exception>
+        public CommonTermsQuery(BooleanClause.Occur highFreqOccur, BooleanClause.Occur lowFreqOccur,
+            float maxTermFrequency, bool disableCoord)
+        {
+            if (highFreqOccur == BooleanClause.Occur.MUST_NOT)
+            {
+                throw new System.ArgumentException("highFreqOccur should be MUST or SHOULD but was MUST_NOT");
+            }
+            if (lowFreqOccur == BooleanClause.Occur.MUST_NOT)
+            {
+                throw new System.ArgumentException("lowFreqOccur should be MUST or SHOULD but was MUST_NOT");
+            }
+            this.disableCoord = disableCoord;
+            this.highFreqOccur = highFreqOccur;
+            this.lowFreqOccur = lowFreqOccur;
+            this.maxTermFrequency = maxTermFrequency;
+            LowFreqMinimumNumberShouldMatch = 0;
+            HighFreqMinimumNumberShouldMatch = 0;
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.search.Query rewrite(org.apache.lucene.index.IndexReader reader) throws java.io.IOException
-	  public override Query rewrite(IndexReader reader)
-	  {
-		if (this.terms.Count == 0)
-		{
-		  return new BooleanQuery();
-		}
-		else if (this.terms.Count == 1)
-		{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.Query tq = newTermQuery(this.terms.get(0), null);
-		  Query tq = newTermQuery(this.terms[0], null);
-		  tq.Boost = Boost;
-		  return tq;
-		}
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final java.util.List<org.apache.lucene.index.AtomicReaderContext> leaves = reader.leaves();
-		IList<AtomicReaderContext> leaves = reader.leaves();
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int maxDoc = reader.maxDoc();
-		int maxDoc = reader.maxDoc();
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.TermContext[] contextArray = new org.apache.lucene.index.TermContext[terms.size()];
-		TermContext[] contextArray = new TermContext[terms.Count];
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.Term[] queryTerms = this.terms.toArray(new org.apache.lucene.index.Term[0]);
-		Term[] queryTerms = this.terms.ToArray();
-		collectTermContext(reader, leaves, contextArray, queryTerms);
-		return buildQuery(maxDoc, contextArray, queryTerms);
-	  }
+        /// <summary>
+        /// Adds a term to the <seealso cref="CommonTermsQuery"/>
+        /// </summary>
+        /// <param name="term">
+        ///          the term to add </param>
+        public virtual void Add(Term term)
+        {
+            if (term == null)
+            {
+                throw new ArgumentException("Term must not be null");
+            }
+            this.terms.Add(term);
+        }
 
-	  protected internal virtual int calcLowFreqMinimumNumberShouldMatch(int numOptional)
-	  {
-		return minNrShouldMatch(lowFreqMinNrShouldMatch, numOptional);
-	  }
+        public override Query Rewrite(IndexReader reader)
+        {
+            if (this.terms.Count == 0)
+            {
+                return new BooleanQuery();
+            }
+            else if (this.terms.Count == 1)
+            {
+                Query tq = NewTermQuery(this.terms[0], null);
+                tq.Boost = Boost;
+                return tq;
+            }
+            var leaves = reader.Leaves;
+            int maxDoc = reader.MaxDoc;
+            var contextArray = new TermContext[terms.Count];
+            var queryTerms = this.terms.ToArray();
+            CollectTermContext(reader, leaves, contextArray, queryTerms);
+            return BuildQuery(maxDoc, contextArray, queryTerms);
+        }
 
-	  protected internal virtual int calcHighFreqMinimumNumberShouldMatch(int numOptional)
-	  {
-		return minNrShouldMatch(highFreqMinNrShouldMatch, numOptional);
-	  }
+        protected internal virtual int CalcLowFreqMinimumNumberShouldMatch(int numOptional)
+        {
+            return MinNrShouldMatch(LowFreqMinimumNumberShouldMatch, numOptional);
+        }
 
-	  private int minNrShouldMatch(float minNrShouldMatch, int numOptional)
-	  {
-		if (minNrShouldMatch >= 1.0f || minNrShouldMatch == 0.0f)
-		{
-		  return (int) minNrShouldMatch;
-		}
-		return Math.Round(minNrShouldMatch * numOptional);
-	  }
+        protected internal virtual int CalcHighFreqMinimumNumberShouldMatch(int numOptional)
+        {
+            return MinNrShouldMatch(HighFreqMinimumNumberShouldMatch, numOptional);
+        }
 
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-//ORIGINAL LINE: protected org.apache.lucene.search.Query buildQuery(final int maxDoc, final org.apache.lucene.index.TermContext[] contextArray, final org.apache.lucene.index.Term[] queryTerms)
-	  protected internal virtual Query buildQuery(int maxDoc, TermContext[] contextArray, Term[] queryTerms)
-	  {
-		BooleanQuery lowFreq = new BooleanQuery(disableCoord);
-		BooleanQuery highFreq = new BooleanQuery(disableCoord);
-		highFreq.Boost = highFreqBoost;
-		lowFreq.Boost = lowFreqBoost;
-		BooleanQuery query = new BooleanQuery(true);
-		for (int i = 0; i < queryTerms.Length; i++)
-		{
-		  TermContext termContext = contextArray[i];
-		  if (termContext == null)
-		  {
-			lowFreq.add(newTermQuery(queryTerms[i], null), lowFreqOccur);
-		  }
-		  else
-		  {
-			if ((maxTermFrequency >= 1f && termContext.docFreq() > maxTermFrequency) || (termContext.docFreq() > (int) Math.Ceiling(maxTermFrequency * (float) maxDoc)))
-			{
-			  highFreq.add(newTermQuery(queryTerms[i], termContext), highFreqOccur);
-			}
-			else
-			{
-			  lowFreq.add(newTermQuery(queryTerms[i], termContext), lowFreqOccur);
-			}
-		  }
+        private int MinNrShouldMatch(float minNrShouldMatch, int numOptional)
+        {
+            if (minNrShouldMatch >= 1.0f || minNrShouldMatch == 0.0f)
+            {
+                return (int)minNrShouldMatch;
+            }
+            return Math.Round(minNrShouldMatch * numOptional);
+        }
 
-		}
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int numLowFreqClauses = lowFreq.clauses().size();
-		int numLowFreqClauses = lowFreq.clauses().size();
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int numHighFreqClauses = highFreq.clauses().size();
-		int numHighFreqClauses = highFreq.clauses().size();
-		if (lowFreqOccur == BooleanClause.Occur.SHOULD && numLowFreqClauses > 0)
-		{
-		  int minMustMatch = calcLowFreqMinimumNumberShouldMatch(numLowFreqClauses);
-		  lowFreq.MinimumNumberShouldMatch = minMustMatch;
-		}
-		if (highFreqOccur == BooleanClause.Occur.SHOULD && numHighFreqClauses > 0)
-		{
-		  int minMustMatch = calcHighFreqMinimumNumberShouldMatch(numHighFreqClauses);
-		  highFreq.MinimumNumberShouldMatch = minMustMatch;
-		}
-		if (lowFreq.clauses().Empty)
-		{
-		  /*
-		   * if lowFreq is empty we rewrite the high freq terms in a conjunction to
-		   * prevent slow queries.
-		   */
-		  if (highFreq.MinimumNumberShouldMatch == 0 && highFreqOccur != BooleanClause.Occur.MUST)
-		  {
-			foreach (BooleanClause booleanClause in highFreq)
-			{
-				booleanClause.Occur = BooleanClause.Occur.MUST;
-			}
-		  }
-		  highFreq.Boost = Boost;
-		  return highFreq;
-		}
-		else if (highFreq.clauses().Empty)
-		{
-		  // only do low freq terms - we don't have high freq terms
-		  lowFreq.Boost = Boost;
-		  return lowFreq;
-		}
-		else
-		{
-		  query.add(highFreq, BooleanClause.Occur.SHOULD);
-		  query.add(lowFreq, BooleanClause.Occur.MUST);
-		  query.Boost = Boost;
-		  return query;
-		}
-	  }
+         protected internal virtual Query BuildQuery(int maxDoc, TermContext[] contextArray, Term[] queryTerms)
+        {
+            BooleanQuery lowFreq = new BooleanQuery(disableCoord);
+            BooleanQuery highFreq = new BooleanQuery(disableCoord);
+            highFreq.Boost = highFreqBoost;
+            lowFreq.Boost = lowFreqBoost;
+            BooleanQuery query = new BooleanQuery(true);
+            for (int i = 0; i < queryTerms.Length; i++)
+            {
+                TermContext termContext = contextArray[i];
+                if (termContext == null)
+                {
+                    lowFreq.Add(NewTermQuery(queryTerms[i], null), lowFreqOccur);
+                }
+                else
+                {
+                    if ((maxTermFrequency >= 1f && termContext.DocFreq > maxTermFrequency) || (termContext.DocFreq > (int)Math.Ceiling(maxTermFrequency * (float)maxDoc)))
+                    {
+                        highFreq.Add(NewTermQuery(queryTerms[i], termContext), highFreqOccur);
+                    }
+                    else
+                    {
+                        lowFreq.Add(NewTermQuery(queryTerms[i], termContext), lowFreqOccur);
+                    }
+                }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public void collectTermContext(org.apache.lucene.index.IndexReader reader, java.util.List<org.apache.lucene.index.AtomicReaderContext> leaves, org.apache.lucene.index.TermContext[] contextArray, org.apache.lucene.index.Term[] queryTerms) throws java.io.IOException
-	  public virtual void collectTermContext(IndexReader reader, IList<AtomicReaderContext> leaves, TermContext[] contextArray, Term[] queryTerms)
-	  {
-		TermsEnum termsEnum = null;
-		foreach (AtomicReaderContext context in leaves)
-		{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.Fields fields = context.reader().fields();
-		  Fields fields = context.reader().fields();
-		  if (fields == null)
-		  {
-			// reader has no fields
-			continue;
-		  }
-		  for (int i = 0; i < queryTerms.Length; i++)
-		  {
-			Term term = queryTerms[i];
-			TermContext termContext = contextArray[i];
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.Terms terms = fields.terms(term.field());
-			Terms terms = fields.terms(term.field());
-			if (terms == null)
-			{
-			  // field does not exist
-			  continue;
-			}
-			termsEnum = terms.iterator(termsEnum);
-			Debug.Assert(termsEnum != null);
+            }
+            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+            //ORIGINAL LINE: final int numLowFreqClauses = lowFreq.clauses().size();
+            int numLowFreqClauses = lowFreq.Clauses.Length;
+            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+            //ORIGINAL LINE: final int numHighFreqClauses = highFreq.clauses().size();
+            int numHighFreqClauses = highFreq.Clauses.Length;
+            if (lowFreqOccur == BooleanClause.Occur.SHOULD && numLowFreqClauses > 0)
+            {
+                int minMustMatch = CalcLowFreqMinimumNumberShouldMatch(numLowFreqClauses);
+                lowFreq.MinimumNumberShouldMatch = minMustMatch;
+            }
+            if (highFreqOccur == BooleanClause.Occur.SHOULD && numHighFreqClauses > 0)
+            {
+                int minMustMatch = CalcHighFreqMinimumNumberShouldMatch(numHighFreqClauses);
+                highFreq.MinimumNumberShouldMatch = minMustMatch;
+            }
+            if (lowFreq.Clauses.Length == 0)
+            {
+                /*
+                 * if lowFreq is empty we rewrite the high freq terms in a conjunction to
+                 * prevent slow queries.
+                 */
+                if (highFreq.MinimumNumberShouldMatch == 0 && highFreqOccur != BooleanClause.Occur.MUST)
+                {
+                    foreach (BooleanClause booleanClause in highFreq)
+                    {
+                        booleanClause.Occur = BooleanClause.Occur.MUST;
+                    }
+                }
+                highFreq.Boost = Boost;
+                return highFreq;
+            }
+            else if (highFreq.Clauses.Length == 0)
+            {
+                // only do low freq terms - we don't have high freq terms
+                lowFreq.Boost = Boost;
+                return lowFreq;
+            }
+            else
+            {
+                query.Add(highFreq, BooleanClause.Occur.SHOULD);
+                query.Add(lowFreq, BooleanClause.Occur.MUST);
+                query.Boost = Boost;
+                return query;
+            }
+        }
 
-			if (termsEnum == TermsEnum.EMPTY)
-			{
-				continue;
-			}
-			if (termsEnum.seekExact(term.bytes()))
-			{
-			  if (termContext == null)
-			  {
-				contextArray[i] = new TermContext(reader.Context, termsEnum.termState(), context.ord, termsEnum.docFreq(), termsEnum.totalTermFreq());
-			  }
-			  else
-			  {
-				termContext.register(termsEnum.termState(), context.ord, termsEnum.docFreq(), termsEnum.totalTermFreq());
-			  }
+        public virtual void CollectTermContext(IndexReader reader, IList<AtomicReaderContext> leaves, TermContext[] contextArray, Term[] queryTerms)
+        {
+            TermsEnum termsEnum = null;
+            foreach (AtomicReaderContext context in leaves)
+            {
+                Fields fields = context.AtomicReader.Fields;
+                if (fields == null)
+                {
+                    // reader has no fields
+                    continue;
+                }
+                for (int i = 0; i < queryTerms.Length; i++)
+                {
+                    Term term = queryTerms[i];
+                    TermContext termContext = contextArray[i];
+                    //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+                    //ORIGINAL LINE: final org.apache.lucene.index.Terms terms = fields.terms(term.field());
+                    Terms terms = fields.Terms(term.Field());
+                    if (terms == null)
+                    {
+                        // field does not exist
+                        continue;
+                    }
+                    termsEnum = terms.Iterator(termsEnum);
+                    Debug.Assert(termsEnum != null);
 
-			}
+                    if (termsEnum == TermsEnum.EMPTY)
+                    {
+                        continue;
+                    }
+                    if (termsEnum.SeekExact(term.Bytes()))
+                    {
+                        if (termContext == null)
+                        {
+                            contextArray[i] = new TermContext(reader.Context, termsEnum.TermState(), context.Ord, termsEnum.DocFreq(), termsEnum.TotalTermFreq());
+                        }
+                        else
+                        {
+                            termContext.Register(termsEnum.TermState(), context.Ord, termsEnum.DocFreq(), termsEnum.TotalTermFreq());
+                        }
 
-		  }
-		}
-	  }
+                    }
 
-	  /// <summary>
-	  /// Returns true iff <seealso cref="Similarity#coord(int,int)"/> is disabled in scoring
-	  /// for the high and low frequency query instance. The top level query will
-	  /// always disable coords.
-	  /// </summary>
-	  public virtual bool CoordDisabled
-	  {
-		  get
-		  {
-			return disableCoord;
-		  }
-	  }
+                }
+            }
+        }
 
-	  /// <summary>
-	  /// Specifies a minimum number of the low frequent optional BooleanClauses which must be
-	  /// satisfied in order to produce a match on the low frequency terms query
-	  /// part. This method accepts a float value in the range [0..1) as a fraction
-	  /// of the actual query terms in the low frequent clause or a number
-	  /// <tt>&gt;=1</tt> as an absolut number of clauses that need to match.
-	  /// 
-	  /// <para>
-	  /// By default no optional clauses are necessary for a match (unless there are
-	  /// no required clauses). If this method is used, then the specified number of
-	  /// clauses is required.
-	  /// </para>
-	  /// </summary>
-	  /// <param name="min">
-	  ///          the number of optional clauses that must match </param>
-	  public virtual float LowFreqMinimumNumberShouldMatch
-	  {
-		  set
-		  {
-			this.lowFreqMinNrShouldMatch = value;
-		  }
-		  get
-		  {
-			return lowFreqMinNrShouldMatch;
-		  }
-	  }
+        /// <summary>
+        /// Returns true iff <seealso cref="Similarity#coord(int,int)"/> is disabled in scoring
+        /// for the high and low frequency query instance. The top level query will
+        /// always disable coords.
+        /// </summary>
+        public virtual bool CoordDisabled
+        {
+            get
+            {
+                return disableCoord;
+            }
+        }
 
+        /// <summary>
+        /// Specifies a minimum number of the low frequent optional BooleanClauses which must be
+        /// satisfied in order to produce a match on the low frequency terms query
+        /// part. This method accepts a float value in the range [0..1) as a fraction
+        /// of the actual query terms in the low frequent clause or a number
+        /// <tt>&gt;=1</tt> as an absolut number of clauses that need to match.
+        /// 
+        /// <para>
+        /// By default no optional clauses are necessary for a match (unless there are
+        /// no required clauses). If this method is used, then the specified number of
+        /// clauses is required.
+        /// </para>
+        /// </summary>
+        /// <param name="min">
+        ///          the number of optional clauses that must match </param>
+        public float LowFreqMinimumNumberShouldMatch { get; set; }
 
-	  /// <summary>
-	  /// Specifies a minimum number of the high frequent optional BooleanClauses which must be
-	  /// satisfied in order to produce a match on the low frequency terms query
-	  /// part. This method accepts a float value in the range [0..1) as a fraction
-	  /// of the actual query terms in the low frequent clause or a number
-	  /// <tt>&gt;=1</tt> as an absolut number of clauses that need to match.
-	  /// 
-	  /// <para>
-	  /// By default no optional clauses are necessary for a match (unless there are
-	  /// no required clauses). If this method is used, then the specified number of
-	  /// clauses is required.
-	  /// </para>
-	  /// </summary>
-	  /// <param name="min">
-	  ///          the number of optional clauses that must match </param>
-	  public virtual float HighFreqMinimumNumberShouldMatch
-	  {
-		  set
-		  {
-			this.highFreqMinNrShouldMatch = value;
-		  }
-		  get
-		  {
-			return highFreqMinNrShouldMatch;
-		  }
-	  }
 
+        /// <summary>
+        /// Specifies a minimum number of the high frequent optional BooleanClauses which must be
+        /// satisfied in order to produce a match on the low frequency terms query
+        /// part. This method accepts a float value in the range [0..1) as a fraction
+        /// of the actual query terms in the low frequent clause or a number
+        /// <tt>&gt;=1</tt> as an absolut number of clauses that need to match.
+        /// 
+        /// <para>
+        /// By default no optional clauses are necessary for a match (unless there are
+        /// no required clauses). If this method is used, then the specified number of
+        /// clauses is required.
+        /// </para>
+        /// </summary>
+        /// <param name="min">
+        ///          the number of optional clauses that must match </param>
+        public float HighFreqMinimumNumberShouldMatch { get; set; }
 
-	  public override void extractTerms(HashSet<Term> terms)
-	  {
-		terms.addAll(this.terms);
-	  }
 
-	  public override string ToString(string field)
-	  {
-		StringBuilder buffer = new StringBuilder();
-		bool needParens = (Boost != 1.0) || (LowFreqMinimumNumberShouldMatch > 0);
-		if (needParens)
-		{
-		  buffer.Append("(");
-		}
-		for (int i = 0; i < terms.Count; i++)
-		{
-		  Term t = terms[i];
-		  buffer.Append(newTermQuery(t, null).ToString());
+        public override void ExtractTerms(HashSet<Term> terms)
+        {
+            terms.AddAll(this.terms);
+        }
 
-		  if (i != terms.Count - 1)
-		  {
-			  buffer.Append(", ");
-		  }
-		}
-		if (needParens)
-		{
-		  buffer.Append(")");
-		}
-		if (LowFreqMinimumNumberShouldMatch > 0 || HighFreqMinimumNumberShouldMatch > 0)
-		{
-		  buffer.Append('~');
-		  buffer.Append("(");
-		  buffer.Append(LowFreqMinimumNumberShouldMatch);
-		  buffer.Append(HighFreqMinimumNumberShouldMatch);
-		  buffer.Append(")");
-		}
-		if (Boost != 1.0f)
-		{
-		  buffer.Append(ToStringUtils.boost(Boost));
-		}
-		return buffer.ToString();
-	  }
+        public override string ToString(string field)
+        {
+            StringBuilder buffer = new StringBuilder();
+            bool needParens = (Boost != 1.0) || (LowFreqMinimumNumberShouldMatch > 0);
+            if (needParens)
+            {
+                buffer.Append("(");
+            }
+            for (int i = 0; i < terms.Count; i++)
+            {
+                Term t = terms[i];
+                buffer.Append(NewTermQuery(t, null).ToString());
 
-	  public override int GetHashCode()
-	  {
-		const int prime = 31;
-		int result = base.GetHashCode();
-		result = prime * result + (disableCoord ? 1231 : 1237);
-		result = prime * result + float.floatToIntBits(highFreqBoost);
-		result = prime * result + ((highFreqOccur == null) ? 0 : highFreqOccur.GetHashCode());
-		result = prime * result + float.floatToIntBits(lowFreqBoost);
-		result = prime * result + ((lowFreqOccur == null) ? 0 : lowFreqOccur.GetHashCode());
-		result = prime * result + float.floatToIntBits(maxTermFrequency);
-		result = prime * result + float.floatToIntBits(lowFreqMinNrShouldMatch);
-		result = prime * result + float.floatToIntBits(highFreqMinNrShouldMatch);
-		result = prime * result + ((terms == null) ? 0 : terms.GetHashCode());
-		return result;
-	  }
+                if (i != terms.Count - 1)
+                {
+                    buffer.Append(", ");
+                }
+            }
+            if (needParens)
+            {
+                buffer.Append(")");
+            }
+            if (LowFreqMinimumNumberShouldMatch > 0 || HighFreqMinimumNumberShouldMatch > 0)
+            {
+                buffer.Append('~');
+                buffer.Append("(");
+                buffer.Append(LowFreqMinimumNumberShouldMatch);
+                buffer.Append(HighFreqMinimumNumberShouldMatch);
+                buffer.Append(")");
+            }
+            if (Boost != 1.0f)
+            {
+                buffer.Append(ToStringUtils.Boost(Boost));
+            }
+            return buffer.ToString();
+        }
 
-	  public override bool Equals(object obj)
-	  {
-		if (this == obj)
-		{
-			return true;
-		}
-		if (!base.Equals(obj))
-		{
-			return false;
-		}
-		if (this.GetType() != obj.GetType())
-		{
-			return false;
-		}
-		CommonTermsQuery other = (CommonTermsQuery) obj;
-		if (disableCoord != other.disableCoord)
-		{
-			return false;
-		}
-		if (float.floatToIntBits(highFreqBoost) != float.floatToIntBits(other.highFreqBoost))
-		{
-			return false;
-		}
-		if (highFreqOccur != other.highFreqOccur)
-		{
-			return false;
-		}
-		if (float.floatToIntBits(lowFreqBoost) != float.floatToIntBits(other.lowFreqBoost))
-		{
-			return false;
-		}
-		if (lowFreqOccur != other.lowFreqOccur)
-		{
-			return false;
-		}
-		if (float.floatToIntBits(maxTermFrequency) != float.floatToIntBits(other.maxTermFrequency))
-		{
-			return false;
-		}
-		if (lowFreqMinNrShouldMatch != other.lowFreqMinNrShouldMatch)
-		{
-			return false;
-		}
-		if (highFreqMinNrShouldMatch != other.highFreqMinNrShouldMatch)
-		{
-			return false;
-		}
-		if (terms == null)
-		{
-		  if (other.terms != null)
-		  {
-			  return false;
-		  }
-		}
-		else if (!terms.Equals(other.terms))
-		{
-			return false;
-		}
-		return true;
-	  }
+        public override int GetHashCode()
+        {
+            const int prime = 31;
+            int result = base.GetHashCode();
+            result = prime * result + (disableCoord ? 1231 : 1237);
+            result = prime * result + Number.FloatToIntBits(highFreqBoost);
+            result = prime * result + ((highFreqOccur == null) ? 0 : highFreqOccur.GetHashCode());
+            result = prime * result + Number.FloatToIntBits(lowFreqBoost);
+            result = prime * result + ((lowFreqOccur == null) ? 0 : lowFreqOccur.GetHashCode());
+            result = prime * result + Number.FloatToIntBits(maxTermFrequency);
+            result = prime * result + Number.FloatToIntBits(LowFreqMinimumNumberShouldMatch);
+            result = prime * result + Number.FloatToIntBits(HighFreqMinimumNumberShouldMatch);
+            result = prime * result + ((terms == null) ? 0 : terms.GetHashCode());
+            return result;
+        }
 
-	  /// <summary>
-	  /// Builds a new TermQuery instance.
-	  /// <para>This is intended for subclasses that wish to customize the generated queries.</para> </summary>
-	  /// <param name="term"> term </param>
-	  /// <param name="context"> the TermContext to be used to create the low level term query. Can be <code>null</code>. </param>
-	  /// <returns> new TermQuery instance </returns>
-	  protected internal virtual Query newTermQuery(Term term, TermContext context)
-	  {
-		return context == null ? new TermQuery(term) : new TermQuery(term, context);
-	  }
-	}
+        public override bool Equals(object obj)
+        {
+            if (this == obj)
+            {
+                return true;
+            }
+            if (!base.Equals(obj))
+            {
+                return false;
+            }
+            if (this.GetType() != obj.GetType())
+            {
+                return false;
+            }
+            CommonTermsQuery other = (CommonTermsQuery)obj;
+            if (disableCoord != other.disableCoord)
+            {
+                return false;
+            }
+            if (Number.FloatToIntBits(highFreqBoost) != Number.FloatToIntBits(other.highFreqBoost))
+            {
+                return false;
+            }
+            if (highFreqOccur != other.highFreqOccur)
+            {
+                return false;
+            }
+            if (Number.FloatToIntBits(lowFreqBoost) != Number.FloatToIntBits(other.lowFreqBoost))
+            {
+                return false;
+            }
+            if (lowFreqOccur != other.lowFreqOccur)
+            {
+                return false;
+            }
+            if (Number.FloatToIntBits(maxTermFrequency) != Number.FloatToIntBits(other.maxTermFrequency))
+            {
+                return false;
+            }
+            if (LowFreqMinimumNumberShouldMatch != other.LowFreqMinimumNumberShouldMatch)
+            {
+                return false;
+            }
+            if (HighFreqMinimumNumberShouldMatch != other.HighFreqMinimumNumberShouldMatch)
+            {
+                return false;
+            }
+            if (terms == null)
+            {
+                if (other.terms != null)
+                {
+                    return false;
+                }
+            }
+            else if (!terms.Equals(other.terms))
+            {
+                return false;
+            }
+            return true;
+        }
 
+        /// <summary>
+        /// Builds a new TermQuery instance.
+        /// <para>This is intended for subclasses that wish to customize the generated queries.</para> </summary>
+        /// <param name="term"> term </param>
+        /// <param name="context"> the TermContext to be used to create the low level term query. Can be <code>null</code>. </param>
+        /// <returns> new TermQuery instance </returns>
+        protected virtual Query NewTermQuery(Term term, TermContext context)
+        {
+            return context == null ? new TermQuery(term) : new TermQuery(term, context);
+        }
+    }
 }
\ No newline at end of file


[09/21] Moving ValueSource -> ValueSources to avoid name conflicts

Posted by sy...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs
new file mode 100644
index 0000000..a32c2c0
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs
@@ -0,0 +1,141 @@
+using System.Collections;
+using System.Text;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+	/*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+    /// <summary>
+	/// Abstract <seealso cref="ValueSource"/> implementation which wraps multiple ValueSources
+	/// and applies an extendible float function to their values.
+	/// 
+	/// </summary>
+	public abstract class MultiFloatFunction : ValueSource
+	{
+	  protected internal readonly ValueSource[] sources;
+
+	  public MultiFloatFunction(ValueSource[] sources)
+	  {
+		this.sources = sources;
+	  }
+
+	  protected internal abstract string name();
+	  protected internal abstract float func(int doc, FunctionValues[] valsArr);
+
+	  public override string description()
+	  {
+		StringBuilder sb = new StringBuilder();
+		sb.Append(name()).Append('(');
+		bool firstTime = true;
+		foreach (ValueSource source in sources)
+		{
+		  if (firstTime)
+		  {
+			firstTime = false;
+		  }
+		  else
+		  {
+			sb.Append(',');
+		  }
+		  sb.Append((object) source);
+		}
+		sb.Append(')');
+		return sb.ToString();
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues[] valsArr = new org.apache.lucene.queries.function.FunctionValues[sources.length];
+		FunctionValues[] valsArr = new FunctionValues[sources.Length];
+		for (int i = 0; i < sources.Length; i++)
+		{
+		  valsArr[i] = sources[i].getValues(context, readerContext);
+		}
+
+		return new FloatDocValuesAnonymousInnerClassHelper(this, this, valsArr);
+	  }
+
+	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+	  {
+		  private readonly MultiFloatFunction outerInstance;
+
+		  private FunctionValues[] valsArr;
+
+		  public FloatDocValuesAnonymousInnerClassHelper(MultiFloatFunction outerInstance, MultiFloatFunction this, FunctionValues[] valsArr) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.valsArr = valsArr;
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return outerInstance.func(doc, valsArr);
+		  }
+		   public override string ToString(int doc)
+		   {
+			StringBuilder sb = new StringBuilder();
+			sb.Append(outerInstance.name()).Append('(');
+			bool firstTime = true;
+			foreach (FunctionValues vals in valsArr)
+			{
+			  if (firstTime)
+			  {
+				firstTime = false;
+			  }
+			  else
+			  {
+				sb.Append(',');
+			  }
+			  sb.Append(vals.ToString(doc));
+			}
+			sb.Append(')');
+			return sb.ToString();
+		   }
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		foreach (ValueSource source in sources)
+		{
+		  source.createWeight(context, searcher);
+		}
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return Arrays.GetHashCode(sources) + name().GetHashCode();
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this.GetType() != o.GetType())
+		{
+			return false;
+		}
+		MultiFloatFunction other = (MultiFloatFunction)o;
+		return this.name().Equals(other.name()) && Arrays.Equals(this.sources, other.sources);
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs
new file mode 100644
index 0000000..91a13fb
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs
@@ -0,0 +1,156 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+	/*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+    /// <summary>
+	/// Abstract parent class for <seealso cref="ValueSource"/> implementations that wrap multiple
+	/// ValueSources and apply their own logic.
+	/// </summary>
+	public abstract class MultiFunction : ValueSource
+	{
+	  protected internal readonly IList<ValueSource> sources;
+
+	  public MultiFunction(IList<ValueSource> sources)
+	  {
+		this.sources = sources;
+	  }
+
+	  protected internal abstract string name();
+
+	  public override string description()
+	  {
+		return description(name(), sources);
+	  }
+
+	  public static string description(string name, IList<ValueSource> sources)
+	  {
+		StringBuilder sb = new StringBuilder();
+		sb.Append(name).Append('(');
+		bool firstTime = true;
+		foreach (ValueSource source in sources)
+		{
+		  if (firstTime)
+		  {
+			firstTime = false;
+		  }
+		  else
+		  {
+			sb.Append(',');
+		  }
+		  sb.Append((object) source);
+		}
+		sb.Append(')');
+		return sb.ToString();
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public static org.apache.lucene.queries.function.FunctionValues[] valsArr(java.util.List<org.apache.lucene.queries.function.ValueSource> sources, java.util.Map fcontext, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public static FunctionValues[] valsArr(IList<ValueSource> sources, IDictionary fcontext, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues[] valsArr = new org.apache.lucene.queries.function.FunctionValues[sources.size()];
+		FunctionValues[] valsArr = new FunctionValues[sources.Count];
+		int i = 0;
+		foreach (ValueSource source in sources)
+		{
+		  valsArr[i++] = source.getValues(fcontext, readerContext);
+		}
+		return valsArr;
+	  }
+
+	  public class Values : FunctionValues
+	  {
+		  private readonly MultiFunction outerInstance;
+
+		internal readonly FunctionValues[] valsArr;
+
+		public Values(MultiFunction outerInstance, FunctionValues[] valsArr)
+		{
+			this.outerInstance = outerInstance;
+		  this.valsArr = valsArr;
+		}
+
+		public override string ToString(int doc)
+		{
+		  return MultiFunction.ToString(outerInstance.name(), valsArr, doc);
+		}
+
+		public override ValueFiller ValueFiller
+		{
+			get
+			{
+			  // TODO: need ValueSource.type() to determine correct type
+			  return base.ValueFiller;
+			}
+		}
+	  }
+
+
+	  public static string ToString(string name, FunctionValues[] valsArr, int doc)
+	  {
+		StringBuilder sb = new StringBuilder();
+		sb.Append(name).Append('(');
+		bool firstTime = true;
+		foreach (FunctionValues vals in valsArr)
+		{
+		  if (firstTime)
+		  {
+			firstTime = false;
+		  }
+		  else
+		  {
+			sb.Append(',');
+		  }
+		  sb.Append(vals.ToString(doc));
+		}
+		sb.Append(')');
+		return sb.ToString();
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		foreach (ValueSource source in sources)
+		{
+		  source.createWeight(context, searcher);
+		}
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return sources.GetHashCode() + name().GetHashCode();
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this.GetType() != o.GetType())
+		{
+			return false;
+		}
+		MultiFunction other = (MultiFunction)o;
+		return this.sources.Equals(other.sources);
+	  }
+	}
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/MultiValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MultiValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/MultiValueSource.cs
new file mode 100644
index 0000000..215d74e
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MultiValueSource.cs
@@ -0,0 +1,32 @@
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+	/*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+
+
+	/// <summary>
+	/// A <seealso cref="ValueSource"/> that abstractly represents <seealso cref="ValueSource"/>s for
+	/// poly fields, and other things.
+	/// 
+	/// </summary>
+	public abstract class MultiValueSource : ValueSource
+	{
+
+	  public abstract int dimension();
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs
new file mode 100644
index 0000000..babb01f
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Function that returns <seealso cref="TFIDFSimilarity#decodeNormValue(long)"/>
+	/// for every document.
+	/// <para>
+	/// Note that the configured Similarity for the field must be
+	/// a subclass of <seealso cref="TFIDFSimilarity"/>
+	/// @lucene.internal 
+	/// </para>
+	/// </summary>
+	public class NormValueSource : ValueSource
+	{
+	  protected internal readonly string field;
+	  public NormValueSource(string field)
+	  {
+		this.field = field;
+	  }
+
+	  public virtual string name()
+	  {
+		return "norm";
+	  }
+
+	  public override string description()
+	  {
+		return name() + '(' + field + ')';
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		context["searcher"] = searcher;
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		IndexSearcher searcher = (IndexSearcher)context["searcher"];
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.search.similarities.TFIDFSimilarity similarity = IDFValueSource.asTFIDF(searcher.getSimilarity(), field);
+		TFIDFSimilarity similarity = IDFValueSource.asTFIDF(searcher.Similarity, field);
+		if (similarity == null)
+		{
+		  throw new System.NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)");
+		}
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.index.NumericDocValues norms = readerContext.reader().getNormValues(field);
+		NumericDocValues norms = readerContext.reader().getNormValues(field);
+
+		if (norms == null)
+		{
+		  return new ConstDoubleDocValues(0.0, this);
+		}
+
+		return new FloatDocValuesAnonymousInnerClassHelper(this, this, similarity, norms);
+	  }
+
+	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+	  {
+		  private readonly NormValueSource outerInstance;
+
+		  private TFIDFSimilarity similarity;
+		  private NumericDocValues norms;
+
+		  public FloatDocValuesAnonymousInnerClassHelper(NormValueSource outerInstance, NormValueSource this, TFIDFSimilarity similarity, NumericDocValues norms) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.similarity = similarity;
+			  this.norms = norms;
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return similarity.decodeNormValue(norms.get(doc));
+		  }
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this.GetType() != o.GetType())
+		{
+		  return false;
+		}
+		return this.field.Equals(((NormValueSource)o).field);
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return this.GetType().GetHashCode() + field.GetHashCode();
+	  }
+	}
+
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/NumDocsValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/NumDocsValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/NumDocsValueSource.cs
new file mode 100644
index 0000000..3a9014a
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/NumDocsValueSource.cs
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using Lucene.Net.Index;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Returns the value of <seealso cref="IndexReader#numDocs()"/>
+	/// for every document. This is the number of documents
+	/// excluding deletions.
+	/// </summary>
+	public class NumDocsValueSource : ValueSource
+	{
+	  public virtual string name()
+	  {
+		return "numdocs";
+	  }
+
+	  public override string description()
+	  {
+		return name() + "()";
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		// Searcher has no numdocs so we must use the reader instead
+		return new ConstIntDocValues(ReaderUtil.getTopLevelContext(readerContext).reader().numDocs(), this);
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		return this.GetType() == o.GetType();
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return this.GetType().GetHashCode();
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
new file mode 100644
index 0000000..4828d86
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Obtains the ordinal of the field value from the default Lucene <seealso cref="org.apache.lucene.search.FieldCache"/> using getStringIndex().
+	/// <br>
+	/// The native lucene index order is used to assign an ordinal value for each field value.
+	/// <br>Field values (terms) are lexicographically ordered by unicode value, and numbered starting at 1.
+	/// <br>
+	/// Example:<br>
+	///  If there were only three field values: "apple","banana","pear"
+	/// <br>then ord("apple")=1, ord("banana")=2, ord("pear")=3
+	/// <para>
+	/// WARNING: ord() depends on the position in an index and can thus change when other documents are inserted or deleted,
+	///  or if a MultiSearcher is used.
+	/// <br>WARNING: as of Solr 1.4, ord() and rord() can cause excess memory use since they must use a FieldCache entry
+	/// at the top level reader, while sorting and function queries now use entries at the segment level.  Hence sorting
+	/// or using a different function query, in addition to ord()/rord() will double memory use.
+	/// 
+	/// </para>
+	/// </summary>
+
+	public class OrdFieldSource : ValueSource
+	{
+	  protected internal readonly string field;
+
+	  public OrdFieldSource(string field)
+	  {
+		this.field = field;
+	  }
+
+	  public override string description()
+	  {
+		return "ord(" + field + ')';
+	  }
+
+
+	  // TODO: this is trappy? perhaps this query instead should make you pass a slow reader yourself?
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final int off = readerContext.docBase;
+		int off = readerContext.docBase;
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.index.IndexReader topReader = org.apache.lucene.index.ReaderUtil.getTopLevelContext(readerContext).reader();
+		IndexReader topReader = ReaderUtil.getTopLevelContext(readerContext).reader();
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.index.AtomicReader r = org.apache.lucene.index.SlowCompositeReaderWrapper.wrap(topReader);
+		AtomicReader r = SlowCompositeReaderWrapper.wrap(topReader);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.index.SortedDocValues sindex = org.apache.lucene.search.FieldCache.DEFAULT.getTermsIndex(r, field);
+		SortedDocValues sindex = FieldCache.DEFAULT.getTermsIndex(r, field);
+		return new IntDocValuesAnonymousInnerClassHelper(this, this, off, sindex);
+	  }
+
+	  private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
+	  {
+		  private readonly OrdFieldSource outerInstance;
+
+		  private int off;
+		  private SortedDocValues sindex;
+
+		  public IntDocValuesAnonymousInnerClassHelper(OrdFieldSource outerInstance, OrdFieldSource this, int off, SortedDocValues sindex) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.off = off;
+			  this.sindex = sindex;
+		  }
+
+		  protected internal virtual string toTerm(string readableValue)
+		  {
+			return readableValue;
+		  }
+		  public override int intVal(int doc)
+		  {
+			return sindex.getOrd(doc + off);
+		  }
+		  public override int ordVal(int doc)
+		  {
+			return sindex.getOrd(doc + off);
+		  }
+		  public override int numOrd()
+		  {
+			return sindex.ValueCount;
+		  }
+
+		  public override bool exists(int doc)
+		  {
+			return sindex.getOrd(doc + off) != 0;
+		  }
+
+		  public override ValueFiller ValueFiller
+		  {
+			  get
+			  {
+				return new ValueFillerAnonymousInnerClassHelper(this);
+			  }
+		  }
+
+		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
+		  {
+			  private readonly IntDocValuesAnonymousInnerClassHelper outerInstance;
+
+			  public ValueFillerAnonymousInnerClassHelper(IntDocValuesAnonymousInnerClassHelper outerInstance)
+			  {
+				  this.outerInstance = outerInstance;
+				  mval = new MutableValueInt();
+			  }
+
+			  private readonly MutableValueInt mval;
+
+			  public override MutableValue Value
+			  {
+				  get
+				  {
+					return mval;
+				  }
+			  }
+
+			  public override void fillValue(int doc)
+			  {
+				mval.value = outerInstance.sindex.getOrd(doc);
+				mval.exists = mval.value != 0;
+			  }
+		  }
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		return o != null && o.GetType() == typeof(OrdFieldSource) && this.field.Equals(((OrdFieldSource)o).field);
+	  }
+
+	  private static readonly int hcode = typeof(OrdFieldSource).GetHashCode();
+	  public override int GetHashCode()
+	  {
+		return hcode + field.GetHashCode();
+	  }
+
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/PowFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/PowFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/PowFloatFunction.cs
new file mode 100644
index 0000000..ec1be2a
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/PowFloatFunction.cs
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+
+
+	/// <summary>
+	/// Function to raise the base "a" to the power "b"
+	/// </summary>
+	public class PowFloatFunction : DualFloatFunction
+	{
+	 /// <param name="a">  the base. </param>
+	 /// <param name="b">  the exponent. </param>
+	  public PowFloatFunction(ValueSource a, ValueSource b) : base(a,b)
+	  {
+	  }
+
+	  protected internal override string name()
+	  {
+		return "pow";
+	  }
+
+	  protected internal override float func(int doc, FunctionValues aVals, FunctionValues bVals)
+	  {
+		return (float)Math.Pow(aVals.floatVal(doc), bVals.floatVal(doc));
+	  }
+	}
+
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/ProductFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ProductFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/ProductFloatFunction.cs
new file mode 100644
index 0000000..85fb92b
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ProductFloatFunction.cs
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+
+
+	/// <summary>
+	/// <code>ProductFloatFunction</code> returns the product of it's components.
+	/// </summary>
+	public class ProductFloatFunction : MultiFloatFunction
+	{
+	  public ProductFloatFunction(ValueSource[] sources) : base(sources)
+	  {
+	  }
+
+	  protected internal override string name()
+	  {
+		return "product";
+	  }
+
+	  protected internal override float func(int doc, FunctionValues[] valsArr)
+	  {
+		float val = 1.0f;
+		foreach (FunctionValues vals in valsArr)
+		{
+		  val *= vals.floatVal(doc);
+		}
+		return val;
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/QueryValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/QueryValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/QueryValueSource.cs
new file mode 100644
index 0000000..8ff11cb
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/QueryValueSource.cs
@@ -0,0 +1,319 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// <code>QueryValueSource</code> returns the relevance score of the query
+	/// </summary>
+	public class QueryValueSource : ValueSource
+	{
+	  internal readonly Query q;
+	  internal readonly float defVal;
+
+	  public QueryValueSource(Query q, float defVal)
+	  {
+		this.q = q;
+		this.defVal = defVal;
+	  }
+
+	  public virtual Query Query
+	  {
+		  get
+		  {
+			  return q;
+		  }
+	  }
+	  public virtual float DefaultValue
+	  {
+		  get
+		  {
+			  return defVal;
+		  }
+	  }
+
+	  public override string description()
+	  {
+		return "query(" + q + ",def=" + defVal + ")";
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map fcontext, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary fcontext, AtomicReaderContext readerContext)
+	  {
+		return new QueryDocValues(this, readerContext, fcontext);
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return q.GetHashCode() * 29;
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (typeof(QueryValueSource) != o.GetType())
+		{
+			return false;
+		}
+		QueryValueSource other = (QueryValueSource)o;
+		return this.q.Equals(other.q) && this.defVal == other.defVal;
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		Weight w = searcher.createNormalizedWeight(q);
+		context[this] = w;
+	  }
+	}
+
+
+	internal class QueryDocValues : FloatDocValues
+	{
+	  internal readonly AtomicReaderContext readerContext;
+	  internal readonly Bits acceptDocs;
+	  internal readonly Weight weight;
+	  internal readonly float defVal;
+	  internal readonly IDictionary fcontext;
+	  internal readonly Query q;
+
+	  internal Scorer scorer;
+	  internal int scorerDoc; // the document the scorer is on
+	  internal bool noMatches = false;
+
+	  // the last document requested... start off with high value
+	  // to trigger a scorer reset on first access.
+	  internal int lastDocRequested = int.MaxValue;
+
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public QueryDocValues(QueryValueSource vs, org.apache.lucene.index.AtomicReaderContext readerContext, java.util.Map fcontext) throws java.io.IOException
+	  public QueryDocValues(QueryValueSource vs, AtomicReaderContext readerContext, IDictionary fcontext) : base(vs)
+	  {
+
+		this.readerContext = readerContext;
+		this.acceptDocs = readerContext.reader().LiveDocs;
+		this.defVal = vs.defVal;
+		this.q = vs.q;
+		this.fcontext = fcontext;
+
+		Weight w = fcontext == null ? null : (Weight)fcontext[vs];
+		if (w == null)
+		{
+		  IndexSearcher weightSearcher;
+		  if (fcontext == null)
+		  {
+			weightSearcher = new IndexSearcher(ReaderUtil.getTopLevelContext(readerContext));
+		  }
+		  else
+		  {
+			weightSearcher = (IndexSearcher)fcontext["searcher"];
+			if (weightSearcher == null)
+			{
+			  weightSearcher = new IndexSearcher(ReaderUtil.getTopLevelContext(readerContext));
+			}
+		  }
+		  vs.createWeight(fcontext, weightSearcher);
+		  w = (Weight)fcontext[vs];
+		}
+		weight = w;
+	  }
+
+	  public override float floatVal(int doc)
+	  {
+		try
+		{
+		  if (doc < lastDocRequested)
+		  {
+			if (noMatches)
+			{
+				return defVal;
+			}
+			scorer = weight.scorer(readerContext, acceptDocs);
+			if (scorer == null)
+			{
+			  noMatches = true;
+			  return defVal;
+			}
+			scorerDoc = -1;
+		  }
+		  lastDocRequested = doc;
+
+		  if (scorerDoc < doc)
+		  {
+			scorerDoc = scorer.advance(doc);
+		  }
+
+		  if (scorerDoc > doc)
+		  {
+			// query doesn't match this document... either because we hit the
+			// end, or because the next doc is after this doc.
+			return defVal;
+		  }
+
+		  // a match!
+		  return scorer.score();
+		}
+		catch (IOException e)
+		{
+		  throw new Exception("caught exception in QueryDocVals(" + q + ") doc=" + doc, e);
+		}
+	  }
+
+	  public override bool exists(int doc)
+	  {
+		try
+		{
+		  if (doc < lastDocRequested)
+		  {
+			if (noMatches)
+			{
+				return false;
+			}
+			scorer = weight.scorer(readerContext, acceptDocs);
+			scorerDoc = -1;
+			if (scorer == null)
+			{
+			  noMatches = true;
+			  return false;
+			}
+		  }
+		  lastDocRequested = doc;
+
+		  if (scorerDoc < doc)
+		  {
+			scorerDoc = scorer.advance(doc);
+		  }
+
+		  if (scorerDoc > doc)
+		  {
+			// query doesn't match this document... either because we hit the
+			// end, or because the next doc is after this doc.
+			return false;
+		  }
+
+		  // a match!
+		  return true;
+		}
+		catch (IOException e)
+		{
+		  throw new Exception("caught exception in QueryDocVals(" + q + ") doc=" + doc, e);
+		}
+	  }
+
+	   public override object objectVal(int doc)
+	   {
+		 try
+		 {
+		   return exists(doc) ? scorer.score() : null;
+		 }
+		 catch (IOException e)
+		 {
+		   throw new Exception("caught exception in QueryDocVals(" + q + ") doc=" + doc, e);
+		 }
+	   }
+
+	  public override ValueFiller ValueFiller
+	  {
+		  get
+		  {
+			//
+			// TODO: if we want to support more than one value-filler or a value-filler in conjunction with
+			// the FunctionValues, then members like "scorer" should be per ValueFiller instance.
+			// Or we can say that the user should just instantiate multiple FunctionValues.
+			//
+			return new ValueFillerAnonymousInnerClassHelper(this);
+		  }
+	  }
+
+	  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
+	  {
+		  private readonly QueryDocValues outerInstance;
+
+		  public ValueFillerAnonymousInnerClassHelper(QueryDocValues outerInstance)
+		  {
+			  this.outerInstance = outerInstance;
+			  mval = new MutableValueFloat();
+		  }
+
+		  private readonly MutableValueFloat mval;
+
+		  public override MutableValue Value
+		  {
+			  get
+			  {
+				return mval;
+			  }
+		  }
+
+		  public override void fillValue(int doc)
+		  {
+			try
+			{
+			  if (outerInstance.noMatches)
+			  {
+				mval.value = outerInstance.defVal;
+				mval.exists = false;
+				return;
+			  }
+			  outerInstance.scorer = outerInstance.weight.scorer(outerInstance.readerContext, outerInstance.acceptDocs);
+			  outerInstance.scorerDoc = -1;
+			  if (outerInstance.scorer == null)
+			  {
+				outerInstance.noMatches = true;
+				mval.value = outerInstance.defVal;
+				mval.exists = false;
+				return;
+			  }
+			  outerInstance.lastDocRequested = doc;
+
+			  if (outerInstance.scorerDoc < doc)
+			  {
+				outerInstance.scorerDoc = outerInstance.scorer.advance(doc);
+			  }
+
+			  if (outerInstance.scorerDoc > doc)
+			  {
+				// query doesn't match this document... either because we hit the
+				// end, or because the next doc is after this doc.
+				mval.value = outerInstance.defVal;
+				mval.exists = false;
+				return;
+			  }
+
+			  // a match!
+			  mval.value = outerInstance.scorer.score();
+			  mval.exists = true;
+			}
+			catch (IOException e)
+			{
+			  throw new Exception("caught exception in QueryDocVals(" + outerInstance.q + ") doc=" + doc, e);
+			}
+		  }
+	  }
+
+	  public override string ToString(int doc)
+	  {
+		return "query(" + q + ",def=" + defVal + ")=" + floatVal(doc);
+	  }
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs
new file mode 100644
index 0000000..b5993a7
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// <code>RangeMapFloatFunction</code> implements a map function over
+	/// another <seealso cref="ValueSource"/> whose values fall within min and max inclusive to target.
+	/// <br>
+	/// Normally Used as an argument to a <seealso cref="FunctionQuery"/>
+	/// 
+	/// 
+	/// </summary>
+	public class RangeMapFloatFunction : ValueSource
+	{
+	  protected internal readonly ValueSource source;
+	  protected internal readonly float min;
+	  protected internal readonly float max;
+	  protected internal readonly ValueSource target;
+	  protected internal readonly ValueSource defaultVal;
+
+	  public RangeMapFloatFunction(ValueSource source, float min, float max, float target, float? def) : this(source, min, max, (ValueSource) new ConstValueSource(target), (ValueSource) (def == null ? null : new ConstValueSource(def.Value)))
+	  {
+	  }
+
+	  public RangeMapFloatFunction(ValueSource source, float min, float max, ValueSource target, ValueSource def)
+	  {
+		this.source = source;
+		this.min = min;
+		this.max = max;
+		this.target = target;
+		this.defaultVal = def;
+	  }
+
+	  public override string description()
+	  {
+		return "map(" + source.description() + "," + min + "," + max + "," + target.description() + ")";
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
+		FunctionValues vals = source.getValues(context, readerContext);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues targets = target.getValues(context, readerContext);
+		FunctionValues targets = target.getValues(context, readerContext);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues defaults = (this.defaultVal == null) ? null : defaultVal.getValues(context, readerContext);
+		FunctionValues defaults = (this.defaultVal == null) ? null : defaultVal.getValues(context, readerContext);
+		return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals, targets, defaults);
+	  }
+
+	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+	  {
+		  private readonly RangeMapFloatFunction outerInstance;
+
+		  private FunctionValues vals;
+		  private FunctionValues targets;
+		  private FunctionValues defaults;
+
+		  public FloatDocValuesAnonymousInnerClassHelper(RangeMapFloatFunction outerInstance, RangeMapFloatFunction this, FunctionValues vals, FunctionValues targets, FunctionValues defaults) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.vals = vals;
+			  this.targets = targets;
+			  this.defaults = defaults;
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			float val = vals.floatVal(doc);
+			return (val >= outerInstance.min && val <= outerInstance.max) ? targets.floatVal(doc) : (outerInstance.defaultVal == null ? val : defaults.floatVal(doc));
+		  }
+		  public override string ToString(int doc)
+		  {
+			return "map(" + vals.ToString(doc) + ",min=" + outerInstance.min + ",max=" + outerInstance.max + ",target=" + targets.ToString(doc) + ")";
+		  }
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		source.createWeight(context, searcher);
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int h = source.GetHashCode();
+		h ^= (h << 10) | ((int)((uint)h >> 23));
+		h += float.floatToIntBits(min);
+		h ^= (h << 14) | ((int)((uint)h >> 19));
+		h += float.floatToIntBits(max);
+		h += target.GetHashCode();
+		if (defaultVal != null)
+		{
+		  h += defaultVal.GetHashCode();
+		}
+		return h;
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (typeof(RangeMapFloatFunction) != o.GetType())
+		{
+			return false;
+		}
+		RangeMapFloatFunction other = (RangeMapFloatFunction)o;
+		return this.min == other.min && this.max == other.max && this.target.Equals(other.target) && this.source.Equals(other.source) && (this.defaultVal == other.defaultVal || (this.defaultVal != null && this.defaultVal.Equals(other.defaultVal)));
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs
new file mode 100644
index 0000000..bcd0ebf
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// <code>ReciprocalFloatFunction</code> implements a reciprocal function f(x) = a/(mx+b), based on
+	/// the float value of a field or function as exported by <seealso cref="ValueSource"/>.
+	/// <br>
+	/// 
+	/// When a and b are equal, and x>=0, this function has a maximum value of 1 that drops as x increases.
+	/// Increasing the value of a and b together results in a movement of the entire function to a flatter part of the curve.
+	/// <para>These properties make this an idea function for boosting more recent documents.
+	/// </para>
+	/// <para>Example:<code>  recip(ms(NOW,mydatefield),3.16e-11,1,1)</code>
+	/// </para>
+	/// <para>A multiplier of 3.16e-11 changes the units from milliseconds to years (since there are about 3.16e10 milliseconds
+	/// per year).  Thus, a very recent date will yield a value close to 1/(0+1) or 1,
+	/// a date a year in the past will get a multiplier of about 1/(1+1) or 1/2,
+	/// and date two years old will yield 1/(2+1) or 1/3.
+	/// 
+	/// </para>
+	/// </summary>
+	/// <seealso cref= org.apache.lucene.queries.function.FunctionQuery
+	/// 
+	///  </seealso>
+	public class ReciprocalFloatFunction : ValueSource
+	{
+	  protected internal readonly ValueSource source;
+	  protected internal readonly float m;
+	  protected internal readonly float a;
+	  protected internal readonly float b;
+
+	  /// <summary>
+	  ///  f(source) = a/(m*float(source)+b)
+	  /// </summary>
+	  public ReciprocalFloatFunction(ValueSource source, float m, float a, float b)
+	  {
+		this.source = source;
+		this.m = m;
+		this.a = a;
+		this.b = b;
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
+		FunctionValues vals = source.getValues(context, readerContext);
+		return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals);
+	  }
+
+	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+	  {
+		  private readonly ReciprocalFloatFunction outerInstance;
+
+		  private FunctionValues vals;
+
+		  public FloatDocValuesAnonymousInnerClassHelper(ReciprocalFloatFunction outerInstance, ReciprocalFloatFunction this, FunctionValues vals) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.vals = vals;
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return outerInstance.a / (outerInstance.m * vals.floatVal(doc) + outerInstance.b);
+		  }
+		  public override string ToString(int doc)
+		  {
+			return Convert.ToString(outerInstance.a) + "/(" + outerInstance.m + "*float(" + vals.ToString(doc) + ')' + '+' + outerInstance.b + ')';
+		  }
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		source.createWeight(context, searcher);
+	  }
+
+	  public override string description()
+	  {
+		return Convert.ToString(a) + "/(" + m + "*float(" + source.description() + ")" + "+" + b + ')';
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int h = float.floatToIntBits(a) + float.floatToIntBits(m);
+		h ^= (h << 13) | ((int)((uint)h >> 20));
+		return h + (float.floatToIntBits(b)) + source.GetHashCode();
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (typeof(ReciprocalFloatFunction) != o.GetType())
+		{
+			return false;
+		}
+		ReciprocalFloatFunction other = (ReciprocalFloatFunction)o;
+		return this.m == other.m && this.a == other.a && this.b == other.b && this.source.Equals(other.source);
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs
new file mode 100644
index 0000000..6628ea0
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Obtains the ordinal of the field value from the default Lucene <seealso cref="org.apache.lucene.search.FieldCache"/> using getTermsIndex()
+	/// and reverses the order.
+	/// <br>
+	/// The native lucene index order is used to assign an ordinal value for each field value.
+	/// <br>Field values (terms) are lexicographically ordered by unicode value, and numbered starting at 1.
+	/// <br>
+	/// Example of reverse ordinal (rord):<br>
+	///  If there were only three field values: "apple","banana","pear"
+	/// <br>then rord("apple")=3, rord("banana")=2, ord("pear")=1
+	/// <para>
+	///  WARNING: ord() depends on the position in an index and can thus change when other documents are inserted or deleted,
+	///  or if a MultiSearcher is used.
+	/// <br>
+	///  WARNING: as of Solr 1.4, ord() and rord() can cause excess memory use since they must use a FieldCache entry
+	/// at the top level reader, while sorting and function queries now use entries at the segment level.  Hence sorting
+	/// or using a different function query, in addition to ord()/rord() will double memory use.
+	/// 
+	/// 
+	/// </para>
+	/// </summary>
+
+	public class ReverseOrdFieldSource : ValueSource
+	{
+	  public readonly string field;
+
+	  public ReverseOrdFieldSource(string field)
+	  {
+		this.field = field;
+	  }
+
+	  public override string description()
+	  {
+		return "rord(" + field + ')';
+	  }
+
+	  // TODO: this is trappy? perhaps this query instead should make you pass a slow reader yourself?
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.index.IndexReader topReader = org.apache.lucene.index.ReaderUtil.getTopLevelContext(readerContext).reader();
+		IndexReader topReader = ReaderUtil.getTopLevelContext(readerContext).reader();
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.index.AtomicReader r = org.apache.lucene.index.SlowCompositeReaderWrapper.wrap(topReader);
+		AtomicReader r = SlowCompositeReaderWrapper.wrap(topReader);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final int off = readerContext.docBase;
+		int off = readerContext.docBase;
+
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.index.SortedDocValues sindex = org.apache.lucene.search.FieldCache.DEFAULT.getTermsIndex(r, field);
+		SortedDocValues sindex = FieldCache.DEFAULT.getTermsIndex(r, field);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final int end = sindex.getValueCount();
+		int end = sindex.ValueCount;
+
+		return new IntDocValuesAnonymousInnerClassHelper(this, this, off, sindex, end);
+	  }
+
+	  private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
+	  {
+		  private readonly ReverseOrdFieldSource outerInstance;
+
+		  private int off;
+		  private SortedDocValues sindex;
+		  private int end;
+
+		  public IntDocValuesAnonymousInnerClassHelper(ReverseOrdFieldSource outerInstance, ReverseOrdFieldSource this, int off, SortedDocValues sindex, int end) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.off = off;
+			  this.sindex = sindex;
+			  this.end = end;
+		  }
+
+		  public override int intVal(int doc)
+		  {
+			 return (end - sindex.getOrd(doc + off) - 1);
+		  }
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (o == null || (o.GetType() != typeof(ReverseOrdFieldSource)))
+		{
+			return false;
+		}
+		ReverseOrdFieldSource other = (ReverseOrdFieldSource)o;
+		return this.field.Equals(other.field);
+	  }
+
+	  private static readonly int hcode = typeof(ReverseOrdFieldSource).GetHashCode();
+	  public override int GetHashCode()
+	  {
+		return hcode + field.GetHashCode();
+	  }
+
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs
new file mode 100644
index 0000000..2b2f15c
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using System.Collections.Generic;
+using Lucene.Net.Support;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Scales values to be between min and max.
+	/// <para>This implementation currently traverses all of the source values to obtain
+	/// their min and max.
+	/// </para>
+	/// <para>This implementation currently cannot distinguish when documents have been
+	/// deleted or documents that have no value, and 0.0 values will be used for
+	/// these cases.  This means that if values are normally all greater than 0.0, one can
+	/// still end up with 0.0 as the min value to map from.  In these cases, an
+	/// appropriate map() function could be used as a workaround to change 0.0
+	/// to a value in the real range.
+	/// </para>
+	/// </summary>
+	public class ScaleFloatFunction : ValueSource
+	{
+	  protected internal readonly ValueSource source;
+	  protected internal readonly float min;
+	  protected internal readonly float max;
+
+	  public ScaleFloatFunction(ValueSource source, float min, float max)
+	  {
+		this.source = source;
+		this.min = min;
+		this.max = max;
+	  }
+
+	  public override string description()
+	  {
+		return "scale(" + source.description() + "," + min + "," + max + ")";
+	  }
+
+	  private class ScaleInfo
+	  {
+		internal float minVal;
+		internal float maxVal;
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: private ScaleInfo createScaleInfo(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  private ScaleInfo createScaleInfo(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final java.util.List<org.apache.lucene.index.AtomicReaderContext> leaves = org.apache.lucene.index.ReaderUtil.getTopLevelContext(readerContext).leaves();
+		IList<AtomicReaderContext> leaves = ReaderUtil.getTopLevelContext(readerContext).leaves();
+
+		float minVal = float.PositiveInfinity;
+		float maxVal = float.NegativeInfinity;
+
+		foreach (AtomicReaderContext leaf in leaves)
+		{
+		  int maxDoc = leaf.reader().maxDoc();
+		  FunctionValues vals = source.getValues(context, leaf);
+		  for (int i = 0; i < maxDoc; i++)
+		  {
+
+		  float val = vals.floatVal(i);
+		  if ((float.floatToRawIntBits(val) & (0xff << 23)) == 0xff << 23)
+		  {
+			// if the exponent in the float is all ones, then this is +Inf, -Inf or NaN
+			// which don't make sense to factor into the scale function
+			continue;
+		  }
+		  if (val < minVal)
+		  {
+			minVal = val;
+		  }
+		  if (val > maxVal)
+		  {
+			maxVal = val;
+		  }
+		  }
+		}
+
+		if (minVal == float.PositiveInfinity)
+		{
+		// must have been an empty index
+		  minVal = maxVal = 0;
+		}
+
+		ScaleInfo scaleInfo = new ScaleInfo();
+		scaleInfo.minVal = minVal;
+		scaleInfo.maxVal = maxVal;
+		context[ScaleFloatFunction.this] = scaleInfo;
+		return scaleInfo;
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+
+		ScaleInfo scaleInfo = (ScaleInfo)context[ScaleFloatFunction.this];
+		if (scaleInfo == null)
+		{
+		  scaleInfo = createScaleInfo(context, readerContext);
+		}
+
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final float scale = (scaleInfo.maxVal-scaleInfo.minVal==0) ? 0 : (max-min)/(scaleInfo.maxVal-scaleInfo.minVal);
+		float scale = (scaleInfo.maxVal - scaleInfo.minVal == 0) ? 0 : (max - min) / (scaleInfo.maxVal - scaleInfo.minVal);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final float minSource = scaleInfo.minVal;
+		float minSource = scaleInfo.minVal;
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final float maxSource = scaleInfo.maxVal;
+		float maxSource = scaleInfo.maxVal;
+
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
+		FunctionValues vals = source.getValues(context, readerContext);
+
+		return new FloatDocValuesAnonymousInnerClassHelper(this, this, scale, minSource, maxSource, vals);
+	  }
+
+	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+	  {
+		  private readonly ScaleFloatFunction outerInstance;
+
+		  private float scale;
+		  private float minSource;
+		  private float maxSource;
+		  private FunctionValues vals;
+
+		  public FloatDocValuesAnonymousInnerClassHelper(ScaleFloatFunction outerInstance, ScaleFloatFunction this, float scale, float minSource, float maxSource, FunctionValues vals) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.scale = scale;
+			  this.minSource = minSource;
+			  this.maxSource = maxSource;
+			  this.vals = vals;
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return (vals.floatVal(doc) - minSource) * scale + outerInstance.min;
+		  }
+		  public override string ToString(int doc)
+		  {
+			return "scale(" + vals.ToString(doc) + ",toMin=" + outerInstance.min + ",toMax=" + outerInstance.max + ",fromMin=" + minSource + ",fromMax=" + maxSource + ")";
+		  }
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		source.createWeight(context, searcher);
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int h = Number.FloatToIntBits(min);
+		h = h * 29;
+		h += Number.FloatToIntBits(max);
+		h = h * 29;
+		h += source.GetHashCode();
+		return h;
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (typeof(ScaleFloatFunction) != o.GetType())
+		{
+			return false;
+		}
+		ScaleFloatFunction other = (ScaleFloatFunction)o;
+		return this.min == other.min && this.max == other.max && this.source.Equals(other.source);
+	  }
+	}
+
+}s
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs
new file mode 100644
index 0000000..cbb6215
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs
@@ -0,0 +1,132 @@
+using System;
+using System.Collections;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+	/*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+    /// <summary>
+	/// Obtains short field values from the <seealso cref="org.apache.lucene.search.FieldCache"/>
+	/// using <code>getShorts()</code>
+	/// and makes those values available as other numeric types, casting as needed.
+	/// 
+	/// </summary>
+	[Obsolete]
+	public class ShortFieldSource : FieldCacheSource
+	{
+
+	  internal readonly FieldCache.ShortParser parser;
+
+	  public ShortFieldSource(string field) : this(field, null)
+	  {
+	  }
+
+	  public ShortFieldSource(string field, FieldCache.ShortParser parser) : base(field)
+	  {
+		this.parser = parser;
+	  }
+
+	  public override string description()
+	  {
+		return "short(" + field + ')';
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Shorts arr = cache.getShorts(readerContext.reader(), field, parser, false);
+		FieldCache.Shorts arr = cache.getShorts(readerContext.reader(), field, parser, false);
+
+		return new FunctionValuesAnonymousInnerClassHelper(this, arr);
+	  }
+
+	  private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
+	  {
+		  private readonly ShortFieldSource outerInstance;
+
+		  private FieldCache.Shorts arr;
+
+		  public FunctionValuesAnonymousInnerClassHelper(ShortFieldSource outerInstance, FieldCache.Shorts arr)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.arr = arr;
+		  }
+
+		  public override sbyte byteVal(int doc)
+		  {
+			return (sbyte) arr.get(doc);
+		  }
+
+		  public override short shortVal(int doc)
+		  {
+			return arr.get(doc);
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return (float) arr.get(doc);
+		  }
+
+		  public override int intVal(int doc)
+		  {
+			return (int) arr.get(doc);
+		  }
+
+		  public override long longVal(int doc)
+		  {
+			return (long) arr.get(doc);
+		  }
+
+		  public override double doubleVal(int doc)
+		  {
+			return (double) arr.get(doc);
+		  }
+
+		  public override string strVal(int doc)
+		  {
+			return Convert.ToString(arr.get(doc));
+		  }
+
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.description() + '=' + shortVal(doc);
+		  }
+
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (o.GetType() != typeof(ShortFieldSource))
+		{
+			return false;
+		}
+		ShortFieldSource other = (ShortFieldSource) o;
+		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int h = parser == null ? typeof(short?).GetHashCode() : parser.GetType().GetHashCode();
+		h += base.GetHashCode();
+		return h;
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs
new file mode 100644
index 0000000..e80fd80
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// <seealso cref="BoolFunction"/> implementation which applies an extendible boolean
+	/// function to the values of a single wrapped <seealso cref="ValueSource"/>.
+	/// 
+	/// Functions this can be used for include whether a field has a value or not,
+	/// or inverting the boolean value of the wrapped ValueSource.
+	/// </summary>
+	public abstract class SimpleBoolFunction : BoolFunction
+	{
+	  protected internal readonly ValueSource source;
+
+	  public SimpleBoolFunction(ValueSource source)
+	  {
+		this.source = source;
+	  }
+
+	  protected internal abstract string name();
+
+	  protected internal abstract bool func(int doc, FunctionValues vals);
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.docvalues.BoolDocValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override BoolDocValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
+		FunctionValues vals = source.getValues(context, readerContext);
+		return new BoolDocValuesAnonymousInnerClassHelper(this, this, vals);
+	  }
+
+	  private class BoolDocValuesAnonymousInnerClassHelper : BoolDocValues
+	  {
+		  private readonly SimpleBoolFunction outerInstance;
+
+		  private FunctionValues vals;
+
+		  public BoolDocValuesAnonymousInnerClassHelper(SimpleBoolFunction outerInstance, SimpleBoolFunction this, FunctionValues vals) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.vals = vals;
+		  }
+
+		  public override bool boolVal(int doc)
+		  {
+			return outerInstance.func(doc, vals);
+		  }
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.name() + '(' + vals.ToString(doc) + ')';
+		  }
+	  }
+
+	  public override string description()
+	  {
+		return name() + '(' + source.description() + ')';
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return source.GetHashCode() + name().GetHashCode();
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this.GetType() != o.GetType())
+		{
+			return false;
+		}
+		SimpleBoolFunction other = (SimpleBoolFunction)o;
+		return this.source.Equals(other.source);
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		source.createWeight(context, searcher);
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/SimpleFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SimpleFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/SimpleFloatFunction.cs
new file mode 100644
index 0000000..73739df
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SimpleFloatFunction.cs
@@ -0,0 +1,64 @@
+using System.Collections;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using Lucene.Net.Index;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// A simple float function with a single argument
+	/// </summary>
+	 public abstract class SimpleFloatFunction : SingleFunction
+	 {
+	  public SimpleFloatFunction(org.apache.lucene.queries.function.ValueSource source) : base(source)
+	  {
+	  }
+
+	  protected internal abstract float func(int doc, FunctionValues vals);
+
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		FunctionValues vals = source.getValues(context, readerContext);
+		return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals);
+	  }
+
+	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+	  {
+		  private readonly SimpleFloatFunction outerInstance;
+
+		  private FunctionValues vals;
+
+		  public FloatDocValuesAnonymousInnerClassHelper(SimpleFloatFunction outerInstance, SimpleFloatFunction this, FunctionValues vals) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.vals = vals;
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return outerInstance.func(doc, vals);
+		  }
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.name() + '(' + vals.ToString(doc) + ')';
+		  }
+	  }
+	 }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs
new file mode 100644
index 0000000..b4102fd
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// A function with a single argument
+	/// </summary>
+	 public abstract class SingleFunction : ValueSource
+	 {
+	  protected internal readonly ValueSource source;
+
+	  public SingleFunction(ValueSource source)
+	  {
+		this.source = source;
+	  }
+
+	  protected internal abstract string name();
+
+	  public override string description()
+	  {
+		return name() + '(' + source.description() + ')';
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return source.GetHashCode() + name().GetHashCode();
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this.GetType() != o.GetType())
+		{
+			return false;
+		}
+		SingleFunction other = (SingleFunction)o;
+		return this.name().Equals(other.name()) && this.source.Equals(other.source);
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		source.createWeight(context, searcher);
+	  }
+	 }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/SumFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SumFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/SumFloatFunction.cs
new file mode 100644
index 0000000..bcfd8a8
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SumFloatFunction.cs
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+
+
+	/// <summary>
+	/// <code>SumFloatFunction</code> returns the sum of it's components.
+	/// </summary>
+	public class SumFloatFunction : MultiFloatFunction
+	{
+	  public SumFloatFunction(ValueSource[] sources) : base(sources)
+	  {
+	  }
+
+	  protected internal override string name()
+	  {
+		return "sum";
+	  }
+
+	  protected internal override float func(int doc, FunctionValues[] valsArr)
+	  {
+		float val = 0.0f;
+		foreach (FunctionValues vals in valsArr)
+		{
+		  val += vals.floatVal(doc);
+		}
+		return val;
+	  }
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs
new file mode 100644
index 0000000..1fc9aec
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// <code>SumTotalTermFreqValueSource</code> returns the number of tokens.
+	/// (sum of term freqs across all documents, across all terms).
+	/// Returns -1 if frequencies were omitted for the field, or if 
+	/// the codec doesn't support this statistic.
+	/// @lucene.internal
+	/// </summary>
+	public class SumTotalTermFreqValueSource : ValueSource
+	{
+	  protected internal readonly string indexedField;
+
+	  public SumTotalTermFreqValueSource(string indexedField)
+	  {
+		this.indexedField = indexedField;
+	  }
+
+	  public virtual string name()
+	  {
+		return "sumtotaltermfreq";
+	  }
+
+	  public override string description()
+	  {
+		return name() + '(' + indexedField + ')';
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		return (FunctionValues)context[this];
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		long sumTotalTermFreq = 0;
+		foreach (AtomicReaderContext readerContext in searcher.TopReaderContext.leaves())
+		{
+		  Fields fields = readerContext.reader().fields();
+		  if (fields == null)
+		  {
+			  continue;
+		  }
+		  Terms terms = fields.terms(indexedField);
+		  if (terms == null)
+		  {
+			  continue;
+		  }
+		  long v = terms.SumTotalTermFreq;
+		  if (v == -1)
+		  {
+			sumTotalTermFreq = -1;
+			break;
+		  }
+		  else
+		  {
+			sumTotalTermFreq += v;
+		  }
+		}
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final long ttf = sumTotalTermFreq;
+		long ttf = sumTotalTermFreq;
+		context[this] = new LongDocValuesAnonymousInnerClassHelper(this, this, ttf);
+	  }
+
+	  private class LongDocValuesAnonymousInnerClassHelper : LongDocValues
+	  {
+		  private readonly SumTotalTermFreqValueSource outerInstance;
+
+		  private long ttf;
+
+		  public LongDocValuesAnonymousInnerClassHelper(SumTotalTermFreqValueSource outerInstance, SumTotalTermFreqValueSource this, long ttf) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.ttf = ttf;
+		  }
+
+		  public override long longVal(int doc)
+		  {
+			return ttf;
+		  }
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return this.GetType().GetHashCode() + indexedField.GetHashCode();
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this.GetType() != o.GetType())
+		{
+			return false;
+		}
+		SumTotalTermFreqValueSource other = (SumTotalTermFreqValueSource)o;
+		return this.indexedField.Equals(other.indexedField);
+	  }
+	}
+
+}
\ No newline at end of file


[07/21] git commit: Minor

Posted by sy...@apache.org.
Minor


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/7b2da406
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/7b2da406
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/7b2da406

Branch: refs/heads/master
Commit: 7b2da40676ee48abf10c46debf859ace8347128d
Parents: 4c2aa1c
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Fri Sep 19 10:43:26 2014 +0300
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Fri Sep 19 10:43:26 2014 +0300

----------------------------------------------------------------------
 src/Lucene.Net.Core/Search/Explanation.cs | 28 +++++++++++++-------------
 1 file changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7b2da406/src/Lucene.Net.Core/Search/Explanation.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Explanation.cs b/src/Lucene.Net.Core/Search/Explanation.cs
index 792bdc1..9160ad5 100644
--- a/src/Lucene.Net.Core/Search/Explanation.cs
+++ b/src/Lucene.Net.Core/Search/Explanation.cs
@@ -24,9 +24,9 @@ namespace Lucene.Net.Search
     /// Expert: Describes the score computation for document and query. </summary>
     public class Explanation
     {
-        private float Value_Renamed; // the value of this node
-        private string Description_Renamed; // what it represents
-        private List<Explanation> Details_Renamed; // sub-explanations
+        private float val; // the value of this node
+        private string description; // what it represents
+        private List<Explanation> details; // sub-explanations
 
         public Explanation()
         {
@@ -34,8 +34,8 @@ namespace Lucene.Net.Search
 
         public Explanation(float value, string description)
         {
-            this.Value_Renamed = value;
-            this.Description_Renamed = description;
+            this.val = value;
+            this.description = description;
         }
 
         /// <summary>
@@ -59,11 +59,11 @@ namespace Lucene.Net.Search
         {
             get
             {
-                return Value_Renamed;
+                return val;
             }
             set
             {
-                this.Value_Renamed = value;
+                this.val = value;
             }
         }
 
@@ -73,11 +73,11 @@ namespace Lucene.Net.Search
         {
             get
             {
-                return Description_Renamed;
+                return description;
             }
             set
             {
-                this.Description_Renamed = value;
+                this.description = value;
             }
         }
 
@@ -99,11 +99,11 @@ namespace Lucene.Net.Search
         {
             get
             {
-                if (Details_Renamed == null)
+                if (details == null)
                 {
                     return null;
                 }
-                return Details_Renamed.ToArray();
+                return details.ToArray();
             }
         }
 
@@ -111,11 +111,11 @@ namespace Lucene.Net.Search
         /// Adds a sub-node to this explanation node. </summary>
         public virtual void AddDetail(Explanation detail)
         {
-            if (Details_Renamed == null)
+            if (details == null)
             {
-                Details_Renamed = new List<Explanation>();
+                details = new List<Explanation>();
             }
-            Details_Renamed.Add(detail);
+            details.Add(detail);
         }
 
         /// <summary>


[05/21] git commit: Fixed BaseDocIdSetTestCase.TestAgainstBitSet

Posted by sy...@apache.org.
Fixed BaseDocIdSetTestCase.TestAgainstBitSet

Arrays.Fill's exception logic changed to be exactly like Java's
Arrays.fill. Basically, the new logic allows fromIndex to be equal to
toIndex. This change prevents a harmless, but test-breaking exception
from failing this test.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/99262d73
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/99262d73
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/99262d73

Branch: refs/heads/master
Commit: 99262d730a5f89022f1e7a722232a7cb393cdd77
Parents: 021236d
Author: Prad Nelluru <pr...@microsoft.com>
Authored: Tue Sep 16 15:43:23 2014 -0700
Committer: Prad Nelluru <pr...@microsoft.com>
Committed: Tue Sep 16 15:43:23 2014 -0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Support/Arrays.cs | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/99262d73/src/Lucene.Net.Core/Support/Arrays.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Arrays.cs b/src/Lucene.Net.Core/Support/Arrays.cs
index 97510ef..578e1f7 100644
--- a/src/Lucene.Net.Core/Support/Arrays.cs
+++ b/src/Lucene.Net.Core/Support/Arrays.cs
@@ -33,12 +33,10 @@ namespace Lucene.Net.Support
 
         public static void Fill<T>(T[] a, int fromIndex, int toIndex, T val)
         {
-            if (fromIndex < 0 || fromIndex >= a.Length)
+            //Java Arrays.fill exception logic
+            if(fromIndex > toIndex || fromIndex < 0 || toIndex > a.Length)
                 throw new ArgumentOutOfRangeException("fromIndex");
 
-            if (toIndex < 0 || toIndex > a.Length || toIndex < fromIndex)
-                throw new ArgumentOutOfRangeException("toIndex");
-
             for (int i = fromIndex; i < toIndex; i++)
             {
                 a[i] = val;


[19/21] More work on Lucene.Net.Queries

Posted by sy...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/CustomScoreProvider.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/CustomScoreProvider.cs b/src/Lucene.Net.Queries/CustomScoreProvider.cs
index 5491c86..d365695 100644
--- a/src/Lucene.Net.Queries/CustomScoreProvider.cs
+++ b/src/Lucene.Net.Queries/CustomScoreProvider.cs
@@ -1,192 +1,177 @@
-namespace org.apache.lucene.queries
-{
-
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
+using System.Linq;
+using Lucene.Net.Index;
+using Lucene.Net.Queries.Function;
+using Lucene.Net.Search;
+using org.apache.lucene.queries;
 
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexReader = org.apache.lucene.index.IndexReader; // for javadocs
-	using FunctionQuery = org.apache.lucene.queries.function.FunctionQuery;
-	using Explanation = org.apache.lucene.search.Explanation;
-	using FieldCache = org.apache.lucene.search.FieldCache; // for javadocs
-
-	/// <summary>
-	/// An instance of this subclass should be returned by
-	/// <seealso cref="CustomScoreQuery#getCustomScoreProvider"/>, if you want
-	/// to modify the custom score calculation of a <seealso cref="CustomScoreQuery"/>.
-	/// <para>Since Lucene 2.9, queries operate on each segment of an index separately,
-	/// so the protected <seealso cref="#context"/> field can be used to resolve doc IDs,
-	/// as the supplied <code>doc</code> ID is per-segment and without knowledge
-	/// of the IndexReader you cannot access the document or <seealso cref="FieldCache"/>.
-	/// 
-	/// @lucene.experimental
-	/// @since 2.9.2
-	/// </para>
-	/// </summary>
-	public class CustomScoreProvider
-	{
+namespace Lucene.Net.Queries
+{
 
-	  protected internal readonly AtomicReaderContext context;
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
 
-	  /// <summary>
-	  /// Creates a new instance of the provider class for the given <seealso cref="IndexReader"/>.
-	  /// </summary>
-	  public CustomScoreProvider(AtomicReaderContext context)
-	  {
-		this.context = context;
-	  }
+    /// <summary>
+    /// An instance of this subclass should be returned by
+    /// <seealso cref="CustomScoreQuery#getCustomScoreProvider"/>, if you want
+    /// to modify the custom score calculation of a <seealso cref="CustomScoreQuery"/>.
+    /// <para>Since Lucene 2.9, queries operate on each segment of an index separately,
+    /// so the protected <seealso cref="#context"/> field can be used to resolve doc IDs,
+    /// as the supplied <code>doc</code> ID is per-segment and without knowledge
+    /// of the IndexReader you cannot access the document or <seealso cref="FieldCache"/>.
+    /// 
+    /// @lucene.experimental
+    /// @since 2.9.2
+    /// </para>
+    /// </summary>
+    public class CustomScoreProvider
+    {
 
-	  /// <summary>
-	  /// Compute a custom score by the subQuery score and a number of 
-	  /// <seealso cref="org.apache.lucene.queries.function.FunctionQuery"/> scores.
-	  /// <para> 
-	  /// Subclasses can override this method to modify the custom score.  
-	  /// </para>
-	  /// <para>
-	  /// If your custom scoring is different than the default herein you 
-	  /// should override at least one of the two customScore() methods.
-	  /// If the number of <seealso cref="FunctionQuery function queries"/> is always &lt; 2 it is 
-	  /// sufficient to override the other 
-	  /// <seealso cref="#customScore(int, float, float) customScore()"/> 
-	  /// method, which is simpler. 
-	  /// </para>
-	  /// <para>
-	  /// The default computation herein is a multiplication of given scores:
-	  /// <pre>
-	  ///     ModifiedScore = valSrcScore * valSrcScores[0] * valSrcScores[1] * ...
-	  /// </pre>
-	  /// 
-	  /// </para>
-	  /// </summary>
-	  /// <param name="doc"> id of scored doc. </param>
-	  /// <param name="subQueryScore"> score of that doc by the subQuery. </param>
-	  /// <param name="valSrcScores"> scores of that doc by the <seealso cref="FunctionQuery"/>. </param>
-	  /// <returns> custom score. </returns>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public float customScore(int doc, float subQueryScore, float valSrcScores[]) throws java.io.IOException
-	  public virtual float customScore(int doc, float subQueryScore, float[] valSrcScores)
-	  {
-		if (valSrcScores.Length == 1)
-		{
-		  return customScore(doc, subQueryScore, valSrcScores[0]);
-		}
-		if (valSrcScores.Length == 0)
-		{
-		  return customScore(doc, subQueryScore, 1);
-		}
-		float score = subQueryScore;
-		foreach (float valSrcScore in valSrcScores)
-		{
-		  score *= valSrcScore;
-		}
-		return score;
-	  }
+        protected internal readonly AtomicReaderContext context;
 
-	  /// <summary>
-	  /// Compute a custom score by the subQuery score and the <seealso cref="FunctionQuery"/> score.
-	  /// <para> 
-	  /// Subclasses can override this method to modify the custom score.
-	  /// </para>
-	  /// <para>
-	  /// If your custom scoring is different than the default herein you 
-	  /// should override at least one of the two customScore() methods.
-	  /// If the number of <seealso cref="FunctionQuery function queries"/> is always &lt; 2 it is 
-	  /// sufficient to override this customScore() method, which is simpler. 
-	  /// </para>
-	  /// <para>
-	  /// The default computation herein is a multiplication of the two scores:
-	  /// <pre>
-	  ///     ModifiedScore = subQueryScore * valSrcScore
-	  /// </pre>
-	  /// 
-	  /// </para>
-	  /// </summary>
-	  /// <param name="doc"> id of scored doc. </param>
-	  /// <param name="subQueryScore"> score of that doc by the subQuery. </param>
-	  /// <param name="valSrcScore"> score of that doc by the <seealso cref="FunctionQuery"/>. </param>
-	  /// <returns> custom score. </returns>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public float customScore(int doc, float subQueryScore, float valSrcScore) throws java.io.IOException
-	  public virtual float customScore(int doc, float subQueryScore, float valSrcScore)
-	  {
-		return subQueryScore * valSrcScore;
-	  }
+        /// <summary>
+        /// Creates a new instance of the provider class for the given <seealso cref="IndexReader"/>.
+        /// </summary>
+        public CustomScoreProvider(AtomicReaderContext context)
+        {
+            this.context = context;
+        }
 
-	  /// <summary>
-	  /// Explain the custom score.
-	  /// Whenever overriding <seealso cref="#customScore(int, float, float[])"/>, 
-	  /// this method should also be overridden to provide the correct explanation
-	  /// for the part of the custom scoring.
-	  /// </summary>
-	  /// <param name="doc"> doc being explained. </param>
-	  /// <param name="subQueryExpl"> explanation for the sub-query part. </param>
-	  /// <param name="valSrcExpls"> explanation for the value source part. </param>
-	  /// <returns> an explanation for the custom score </returns>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public org.apache.lucene.search.Explanation customExplain(int doc, org.apache.lucene.search.Explanation subQueryExpl, org.apache.lucene.search.Explanation valSrcExpls[]) throws java.io.IOException
-	  public virtual Explanation customExplain(int doc, Explanation subQueryExpl, Explanation[] valSrcExpls)
-	  {
-		if (valSrcExpls.Length == 1)
-		{
-		  return customExplain(doc, subQueryExpl, valSrcExpls[0]);
-		}
-		if (valSrcExpls.Length == 0)
-		{
-		  return subQueryExpl;
-		}
-		float valSrcScore = 1;
-		foreach (Explanation valSrcExpl in valSrcExpls)
-		{
-		  valSrcScore *= valSrcExpl.Value;
-		}
-		Explanation exp = new Explanation(valSrcScore * subQueryExpl.Value, "custom score: product of:");
-		exp.addDetail(subQueryExpl);
-		foreach (Explanation valSrcExpl in valSrcExpls)
-		{
-		  exp.addDetail(valSrcExpl);
-		}
-		return exp;
-	  }
+        /// <summary>
+        /// Compute a custom score by the subQuery score and a number of 
+        /// <seealso cref="FunctionQuery"/> scores.
+        /// <para> 
+        /// Subclasses can override this method to modify the custom score.  
+        /// </para>
+        /// <para>
+        /// If your custom scoring is different than the default herein you 
+        /// should override at least one of the two customScore() methods.
+        /// If the number of <seealso cref="FunctionQuery function queries"/> is always &lt; 2 it is 
+        /// sufficient to override the other 
+        /// <seealso cref="#customScore(int, float, float) customScore()"/> 
+        /// method, which is simpler. 
+        /// </para>
+        /// <para>
+        /// The default computation herein is a multiplication of given scores:
+        /// <pre>
+        ///     ModifiedScore = valSrcScore * valSrcScores[0] * valSrcScores[1] * ...
+        /// </pre>
+        /// 
+        /// </para>
+        /// </summary>
+        /// <param name="doc"> id of scored doc. </param>
+        /// <param name="subQueryScore"> score of that doc by the subQuery. </param>
+        /// <param name="valSrcScores"> scores of that doc by the <seealso cref="FunctionQuery"/>. </param>
+        /// <returns> custom score. </returns>
+        public virtual float CustomScore(int doc, float subQueryScore, float[] valSrcScores)
+        {
+            if (valSrcScores.Length == 1)
+            {
+                return CustomScore(doc, subQueryScore, valSrcScores[0]);
+            }
+            if (valSrcScores.Length == 0)
+            {
+                return CustomScore(doc, subQueryScore, 1);
+            }
+            return valSrcScores.Aggregate(subQueryScore, (current, valSrcScore) => current*valSrcScore);
+        }
 
-	  /// <summary>
-	  /// Explain the custom score.
-	  /// Whenever overriding <seealso cref="#customScore(int, float, float)"/>, 
-	  /// this method should also be overridden to provide the correct explanation
-	  /// for the part of the custom scoring.
-	  /// </summary>
-	  /// <param name="doc"> doc being explained. </param>
-	  /// <param name="subQueryExpl"> explanation for the sub-query part. </param>
-	  /// <param name="valSrcExpl"> explanation for the value source part. </param>
-	  /// <returns> an explanation for the custom score </returns>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public org.apache.lucene.search.Explanation customExplain(int doc, org.apache.lucene.search.Explanation subQueryExpl, org.apache.lucene.search.Explanation valSrcExpl) throws java.io.IOException
-	  public virtual Explanation customExplain(int doc, Explanation subQueryExpl, Explanation valSrcExpl)
-	  {
-		float valSrcScore = 1;
-		if (valSrcExpl != null)
-		{
-		  valSrcScore *= valSrcExpl.Value;
-		}
-		Explanation exp = new Explanation(valSrcScore * subQueryExpl.Value, "custom score: product of:");
-		exp.addDetail(subQueryExpl);
-		exp.addDetail(valSrcExpl);
-		return exp;
-	  }
+        /// <summary>
+        /// Compute a custom score by the subQuery score and the <seealso cref="FunctionQuery"/> score.
+        /// <para> 
+        /// Subclasses can override this method to modify the custom score.
+        /// </para>
+        /// <para>
+        /// If your custom scoring is different than the default herein you 
+        /// should override at least one of the two customScore() methods.
+        /// If the number of <seealso cref="FunctionQuery function queries"/> is always &lt; 2 it is 
+        /// sufficient to override this customScore() method, which is simpler. 
+        /// </para>
+        /// <para>
+        /// The default computation herein is a multiplication of the two scores:
+        /// <pre>
+        ///     ModifiedScore = subQueryScore * valSrcScore
+        /// </pre>
+        /// 
+        /// </para>
+        /// </summary>
+        /// <param name="doc"> id of scored doc. </param>
+        /// <param name="subQueryScore"> score of that doc by the subQuery. </param>
+        /// <param name="valSrcScore"> score of that doc by the <seealso cref="FunctionQuery"/>. </param>
+        /// <returns> custom score. </returns>
+        public virtual float CustomScore(int doc, float subQueryScore, float valSrcScore)
+        {
+            return subQueryScore * valSrcScore;
+        }
 
-	}
+        /// <summary>
+        /// Explain the custom score.
+        /// Whenever overriding <seealso cref="#customScore(int, float, float[])"/>, 
+        /// this method should also be overridden to provide the correct explanation
+        /// for the part of the custom scoring.
+        /// </summary>
+        /// <param name="doc"> doc being explained. </param>
+        /// <param name="subQueryExpl"> explanation for the sub-query part. </param>
+        /// <param name="valSrcExpls"> explanation for the value source part. </param>
+        /// <returns> an explanation for the custom score </returns>
+        public virtual Explanation CustomExplain(int doc, Explanation subQueryExpl, Explanation[] valSrcExpls)
+        {
+            if (valSrcExpls.Length == 1)
+            {
+                return CustomExplain(doc, subQueryExpl, valSrcExpls[0]);
+            }
+            if (valSrcExpls.Length == 0)
+            {
+                return subQueryExpl;
+            }
+            float valSrcScore = 1;
+            foreach (Explanation valSrcExpl in valSrcExpls)
+            {
+                valSrcScore *= valSrcExpl.Value;
+            }
+            Explanation exp = new Explanation(valSrcScore * subQueryExpl.Value, "custom score: product of:");
+            exp.AddDetail(subQueryExpl);
+            foreach (Explanation valSrcExpl in valSrcExpls)
+            {
+                exp.AddDetail(valSrcExpl);
+            }
+            return exp;
+        }
 
+        /// <summary>
+        /// Explain the custom score.
+        /// Whenever overriding <seealso cref="#customScore(int, float, float)"/>, 
+        /// this method should also be overridden to provide the correct explanation
+        /// for the part of the custom scoring.
+        /// </summary>
+        /// <param name="doc"> doc being explained. </param>
+        /// <param name="subQueryExpl"> explanation for the sub-query part. </param>
+        /// <param name="valSrcExpl"> explanation for the value source part. </param>
+        /// <returns> an explanation for the custom score </returns>
+        public virtual Explanation CustomExplain(int doc, Explanation subQueryExpl, Explanation valSrcExpl)
+        {
+            float valSrcScore = 1;
+            if (valSrcExpl != null)
+            {
+                valSrcScore *= valSrcExpl.Value;
+            }
+            Explanation exp = new Explanation(valSrcScore * subQueryExpl.Value, "custom score: product of:");
+            exp.AddDetail(subQueryExpl);
+            exp.AddDetail(valSrcExpl);
+            return exp;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/CustomScoreQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/CustomScoreQuery.cs b/src/Lucene.Net.Queries/CustomScoreQuery.cs
index 91c2597..016b87c 100644
--- a/src/Lucene.Net.Queries/CustomScoreQuery.cs
+++ b/src/Lucene.Net.Queries/CustomScoreQuery.cs
@@ -1,7 +1,12 @@
 using System.Collections.Generic;
 using System.Text;
+using Lucene.Net.Index;
+using Lucene.Net.Queries.Function;
+using Lucene.Net.Search;
+using Lucene.Net.Support;
+using Lucene.Net.Util;
 
-namespace org.apache.lucene.queries
+namespace Lucene.Net.Queries
 {
 
 	/*
@@ -20,23 +25,7 @@ namespace org.apache.lucene.queries
 	 * See the License for the specific language governing permissions and
 	 * limitations under the License.
 	 */
-
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using Term = org.apache.lucene.index.Term;
-	using FunctionQuery = org.apache.lucene.queries.function.FunctionQuery;
-	using ValueSource = org.apache.lucene.queries.function.ValueSource;
-	using ComplexExplanation = org.apache.lucene.search.ComplexExplanation;
-	using Explanation = org.apache.lucene.search.Explanation;
-	using Query = org.apache.lucene.search.Query;
-	using Weight = org.apache.lucene.search.Weight;
-	using Scorer = org.apache.lucene.search.Scorer;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-	using Bits = org.apache.lucene.util.Bits;
-	using ToStringUtils = org.apache.lucene.util.ToStringUtils;
-
-	/// <summary>
+    /// <summary>
 	/// Query that sets document score as a programmatic function of several (sub) scores:
 	/// <ol>
 	///    <li>the score of its subQuery (any query)</li>
@@ -61,16 +50,16 @@ namespace org.apache.lucene.queries
 	  }
 
 	  /// <summary>
-	  /// Create a CustomScoreQuery over input subQuery and a <seealso cref="org.apache.lucene.queries.function.FunctionQuery"/>. </summary>
+	  /// Create a CustomScoreQuery over input subQuery and a <seealso cref="FunctionQuery"/>. </summary>
 	  /// <param name="subQuery"> the sub query whose score is being customized. Must not be null. </param>
 	  /// <param name="scoringQuery"> a value source query whose scores are used in the custom score
 	  /// computation.  This parameter is optional - it can be null. </param>
-	  public CustomScoreQuery(Query subQuery, FunctionQuery scoringQuery) : this(subQuery, scoringQuery != null ? new FunctionQuery[] {scoringQuery} : new FunctionQuery[0]); / / don't want an array that contains a single null..
+	  public CustomScoreQuery(Query subQuery, FunctionQuery scoringQuery) : this(subQuery, scoringQuery != null ? new FunctionQuery[] {scoringQuery} : new FunctionQuery[0]) // don't want an array that contains a single null..
 	  {
 	  }
 
 	  /// <summary>
-	  /// Create a CustomScoreQuery over input subQuery and a <seealso cref="org.apache.lucene.queries.function.FunctionQuery"/>. </summary>
+	  /// Create a CustomScoreQuery over input subQuery and a <seealso cref="FunctionQuery"/>. </summary>
 	  /// <param name="subQuery"> the sub query whose score is being customized. Must not be null. </param>
 	  /// <param name="scoringQueries"> value source queries whose scores are used in the custom score
 	  /// computation.  This parameter is optional - it can be null or even an empty array. </param>
@@ -85,58 +74,52 @@ namespace org.apache.lucene.queries
 	  }
 
 	  /*(non-Javadoc) @see org.apache.lucene.search.Query#rewrite(org.apache.lucene.index.IndexReader) */
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.search.Query rewrite(org.apache.lucene.index.IndexReader reader) throws java.io.IOException
-	  public override Query rewrite(IndexReader reader)
+	  public override Query Rewrite(IndexReader reader)
 	  {
 		CustomScoreQuery clone = null;
 
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.Query sq = subQuery.rewrite(reader);
-		Query sq = subQuery.rewrite(reader);
+		Query sq = subQuery.Rewrite(reader);
 		if (sq != subQuery)
 		{
-		  clone = clone();
+		  clone = Clone();
 		  clone.subQuery = sq;
 		}
 
 		for (int i = 0; i < scoringQueries.Length; i++)
 		{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.Query v = scoringQueries[i].rewrite(reader);
-		  Query v = scoringQueries[i].rewrite(reader);
+		  Query v = scoringQueries[i].Rewrite(reader);
 		  if (v != scoringQueries[i])
 		  {
 			if (clone == null)
 			{
-				clone = clone();
+				clone = Clone();
 			}
 			clone.scoringQueries[i] = v;
 		  }
 		}
 
-		return (clone == null) ? this : clone;
+		return clone ?? this;
 	  }
 
 	  /*(non-Javadoc) @see org.apache.lucene.search.Query#extractTerms(java.util.Set) */
-	  public override void extractTerms(HashSet<Term> terms)
+	  public override void ExtractTerms(HashSet<Term> terms)
 	  {
-		subQuery.extractTerms(terms);
+		subQuery.ExtractTerms(terms);
 		foreach (Query scoringQuery in scoringQueries)
 		{
-		  scoringQuery.extractTerms(terms);
+		  scoringQuery.ExtractTerms(terms);
 		}
 	  }
 
 	  /*(non-Javadoc) @see org.apache.lucene.search.Query#clone() */
-	  public override CustomScoreQuery clone()
+	  public override CustomScoreQuery Clone()
 	  {
-		CustomScoreQuery clone = (CustomScoreQuery)base.clone();
-		clone.subQuery = subQuery.clone();
+		CustomScoreQuery clone = (CustomScoreQuery)base.Clone();
+		clone.subQuery = subQuery.Clone();
 		clone.scoringQueries = new Query[scoringQueries.Length];
 		for (int i = 0; i < scoringQueries.Length; i++)
 		{
-		  clone.scoringQueries[i] = scoringQueries[i].clone();
+		  clone.scoringQueries[i] = scoringQueries[i].Clone();
 		}
 		return clone;
 	  }
@@ -152,7 +135,7 @@ namespace org.apache.lucene.queries
 		}
 		sb.Append(")");
 		sb.Append(strict?" STRICT" : "");
-		return sb.ToString() + ToStringUtils.boost(Boost);
+		return sb.ToString() + ToStringUtils.Boost(Boost);
 	  }
 
 	  /// <summary>
@@ -183,7 +166,7 @@ namespace org.apache.lucene.queries
 	  /// Returns a hash code value for this object. </summary>
 	  public override int GetHashCode()
 	  {
-		return (this.GetType().GetHashCode() + subQuery.GetHashCode() + Arrays.GetHashCode(scoringQueries)) ^ float.floatToIntBits(Boost) ^ (strict ? 1234 : 4321);
+		return (this.GetType().GetHashCode() + subQuery.GetHashCode() + Arrays.GetHashCode(scoringQueries)) ^ Number.FloatToIntBits(Boost) ^ (strict ? 1234 : 4321);
 	  }
 
 	  /// <summary>
@@ -192,9 +175,7 @@ namespace org.apache.lucene.queries
 	  /// implementation as specified in the docs of <seealso cref="CustomScoreProvider"/>.
 	  /// @since 2.9.2
 	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: protected CustomScoreProvider getCustomScoreProvider(org.apache.lucene.index.AtomicReaderContext context) throws java.io.IOException
-	  protected internal virtual CustomScoreProvider getCustomScoreProvider(AtomicReaderContext context)
+	  protected internal virtual CustomScoreProvider GetCustomScoreProvider(AtomicReaderContext context)
 	  {
 		return new CustomScoreProvider(context);
 	  }
@@ -210,16 +191,14 @@ namespace org.apache.lucene.queries
 		internal bool qStrict;
 		internal float queryWeight;
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public CustomWeight(org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
 		public CustomWeight(CustomScoreQuery outerInstance, IndexSearcher searcher)
 		{
 			this.outerInstance = outerInstance;
-		  this.subQueryWeight = outerInstance.subQuery.createWeight(searcher);
+		  this.subQueryWeight = outerInstance.subQuery.CreateWeight(searcher);
 		  this.valSrcWeights = new Weight[outerInstance.scoringQueries.Length];
 		  for (int i = 0; i < outerInstance.scoringQueries.Length; i++)
 		  {
-			this.valSrcWeights[i] = outerInstance.scoringQueries[i].createWeight(searcher);
+			this.valSrcWeights[i] = outerInstance.scoringQueries[i].CreateWeight(searcher);
 		  }
 		  this.qStrict = outerInstance.strict;
 		}
@@ -233,8 +212,6 @@ namespace org.apache.lucene.queries
 			}
 		}
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public float getValueForNormalization() throws java.io.IOException
 		public override float ValueForNormalization
 		{
 			get
@@ -256,33 +233,31 @@ namespace org.apache.lucene.queries
 		}
 
 		/*(non-Javadoc) @see org.apache.lucene.search.Weight#normalize(float) */
-		public override void normalize(float norm, float topLevelBoost)
+		public override void Normalize(float norm, float topLevelBoost)
 		{
 		  // note we DONT incorporate our boost, nor pass down any topLevelBoost 
 		  // (e.g. from outer BQ), as there is no guarantee that the CustomScoreProvider's 
 		  // function obeys the distributive law... it might call sqrt() on the subQuery score
 		  // or some other arbitrary function other than multiplication.
 		  // so, instead boosts are applied directly in score()
-		  subQueryWeight.normalize(norm, 1f);
+		  subQueryWeight.Normalize(norm, 1f);
 		  foreach (Weight valSrcWeight in valSrcWeights)
 		  {
 			if (qStrict)
 			{
-			  valSrcWeight.normalize(1, 1); // do not normalize the ValueSource part
+			  valSrcWeight.Normalize(1, 1); // do not normalize the ValueSource part
 			}
 			else
 			{
-			  valSrcWeight.normalize(norm, 1f);
+			  valSrcWeight.Normalize(norm, 1f);
 			}
 		  }
 		  queryWeight = topLevelBoost * Boost;
 		}
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.search.Scorer scorer(org.apache.lucene.index.AtomicReaderContext context, org.apache.lucene.util.Bits acceptDocs) throws java.io.IOException
-		public override Scorer scorer(AtomicReaderContext context, Bits acceptDocs)
+		public override Scorer Scorer(AtomicReaderContext context, Bits acceptDocs)
 		{
-		  Scorer subQueryScorer = subQueryWeight.scorer(context, acceptDocs);
+		  Scorer subQueryScorer = subQueryWeight.Scorer(context, acceptDocs);
 		  if (subQueryScorer == null)
 		  {
 			return null;
@@ -290,24 +265,20 @@ namespace org.apache.lucene.queries
 		  Scorer[] valSrcScorers = new Scorer[valSrcWeights.Length];
 		  for (int i = 0; i < valSrcScorers.Length; i++)
 		  {
-			 valSrcScorers[i] = valSrcWeights[i].scorer(context, acceptDocs);
+			 valSrcScorers[i] = valSrcWeights[i].Scorer(context, acceptDocs);
 		  }
-		  return new CustomScorer(outerInstance, outerInstance.getCustomScoreProvider(context), this, queryWeight, subQueryScorer, valSrcScorers);
+		  return new CustomScorer(outerInstance, outerInstance.GetCustomScoreProvider(context), this, queryWeight, subQueryScorer, valSrcScorers);
 		}
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.search.Explanation explain(org.apache.lucene.index.AtomicReaderContext context, int doc) throws java.io.IOException
-		public override Explanation explain(AtomicReaderContext context, int doc)
-		{
-		  Explanation explain = doExplain(context, doc);
-		  return explain == null ? new Explanation(0.0f, "no matching docs") : explain;
-		}
+	      public override Explanation Explain(AtomicReaderContext context, int doc)
+	      {
+	          Explanation explain = DoExplain(context, doc);
+	          return explain ?? new Explanation(0.0f, "no matching docs");
+	      }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private org.apache.lucene.search.Explanation doExplain(org.apache.lucene.index.AtomicReaderContext info, int doc) throws java.io.IOException
-		internal virtual Explanation doExplain(AtomicReaderContext info, int doc)
+		internal virtual Explanation DoExplain(AtomicReaderContext info, int doc)
 		{
-		  Explanation subQueryExpl = subQueryWeight.explain(info, doc);
+		  Explanation subQueryExpl = subQueryWeight.Explain(info, doc);
 		  if (!subQueryExpl.Match)
 		  {
 			return subQueryExpl;
@@ -316,22 +287,21 @@ namespace org.apache.lucene.queries
 		  Explanation[] valSrcExpls = new Explanation[valSrcWeights.Length];
 		  for (int i = 0; i < valSrcWeights.Length; i++)
 		  {
-			valSrcExpls[i] = valSrcWeights[i].explain(info, doc);
+			valSrcExpls[i] = valSrcWeights[i].Explain(info, doc);
 		  }
-		  Explanation customExp = outerInstance.getCustomScoreProvider(info).customExplain(doc,subQueryExpl,valSrcExpls);
+		  Explanation customExp = outerInstance.GetCustomScoreProvider(info).CustomExplain(doc,subQueryExpl,valSrcExpls);
 		  float sc = Boost * customExp.Value;
 		  Explanation res = new ComplexExplanation(true, sc, outerInstance.ToString() + ", product of:");
-		  res.addDetail(customExp);
-		  res.addDetail(new Explanation(Boost, "queryBoost")); // actually using the q boost as q weight (== weight value)
+		  res.AddDetail(customExp);
+		  res.AddDetail(new Explanation(Boost, "queryBoost")); // actually using the q boost as q weight (== weight value)
 		  return res;
 		}
 
-		public override bool scoresDocsOutOfOrder()
+		public override bool ScoresDocsOutOfOrder()
 		{
 		  return false;
 		}
-
-	  }
+	  
 
 
 	  //=========================== S C O R E R ============================
@@ -360,77 +330,67 @@ namespace org.apache.lucene.queries
 		  this.provider = provider;
 		}
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public int nextDoc() throws java.io.IOException
-		public override int nextDoc()
+		public override int NextDoc()
 		{
-		  int doc = subQueryScorer.nextDoc();
+		  int doc = subQueryScorer.NextDoc();
 		  if (doc != NO_MORE_DOCS)
 		  {
 			foreach (Scorer valSrcScorer in valSrcScorers)
 			{
-			  valSrcScorer.advance(doc);
+			  valSrcScorer.Advance(doc);
 			}
 		  }
 		  return doc;
 		}
 
-		public override int docID()
+		public override int DocID()
 		{
-		  return subQueryScorer.docID();
+		  return subQueryScorer.DocID();
 		}
 
 		/*(non-Javadoc) @see org.apache.lucene.search.Scorer#score() */
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public float score() throws java.io.IOException
-		public override float score()
+		public override float Score()
 		{
 		  for (int i = 0; i < valSrcScorers.Length; i++)
 		  {
-			vScores[i] = valSrcScorers[i].score();
+			vScores[i] = valSrcScorers[i].Score();
 		  }
 		  return qWeight * provider.customScore(subQueryScorer.docID(), subQueryScorer.score(), vScores);
 		}
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public int freq() throws java.io.IOException
-		public override int freq()
+		public override int Freq()
 		{
-		  return subQueryScorer.freq();
+		  return subQueryScorer.Freq();
 		}
 
 		public override ICollection<ChildScorer> Children
 		{
 			get
 			{
-			  return Collections.singleton(new ChildScorer(subQueryScorer, "CUSTOM"));
+			  return Collections.Singleton(new ChildScorer(subQueryScorer, "CUSTOM"));
 			}
 		}
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public int advance(int target) throws java.io.IOException
-		public override int advance(int target)
+		public override int Advance(int target)
 		{
-		  int doc = subQueryScorer.advance(target);
+		  int doc = subQueryScorer.Advance(target);
 		  if (doc != NO_MORE_DOCS)
 		  {
 			foreach (Scorer valSrcScorer in valSrcScorers)
 			{
-			  valSrcScorer.advance(doc);
+			  valSrcScorer.Advance(doc);
 			}
 		  }
 		  return doc;
 		}
 
-		public override long cost()
+		public override long Cost()
 		{
-		  return subQueryScorer.cost();
+		  return subQueryScorer.Cost();
 		}
 	  }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override Weight createWeight(IndexSearcher searcher)
+	  public override Weight CreateWeight(IndexSearcher searcher)
 	  {
 		return new CustomWeight(this, searcher);
 	  }
@@ -444,17 +404,7 @@ namespace org.apache.lucene.queries
 	  /// <P>
 	  /// Note: only has effect when the <seealso cref="ValueSource"/> part is not null.
 	  /// </summary>
-	  public virtual bool Strict
-	  {
-		  get
-		  {
-			return strict;
-		  }
-		  set
-		  {
-			this.strict = value;
-		  }
-	  }
+	  public virtual bool Strict { get; set; }
 
 
 	  /// <summary>
@@ -477,14 +427,13 @@ namespace org.apache.lucene.queries
 		  }
 	  }
 
-	  /// <summary>
-	  /// A short name of this query, used in <seealso cref="#toString(String)"/>.
-	  /// </summary>
-	  public virtual string name()
-	  {
-		return "custom";
+	      /// <summary>
+	      /// A short name of this query, used in <seealso cref="#toString(String)"/>.
+	      /// </summary>
+	      public virtual string Name
+	      {
+	          get { return "custom"; }
+	      }
 	  }
 
-	}
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/FilterClause.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/FilterClause.cs b/src/Lucene.Net.Queries/FilterClause.cs
index cbfe284..3794102 100644
--- a/src/Lucene.Net.Queries/FilterClause.cs
+++ b/src/Lucene.Net.Queries/FilterClause.cs
@@ -1,97 +1,91 @@
-namespace org.apache.lucene.queries
-{
-
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using Occur = org.apache.lucene.search.BooleanClause.Occur;
-	using Filter = org.apache.lucene.search.Filter;
+using Lucene.Net.Search;
 
-	/// <summary>
-	/// A Filter that wrapped with an indication of how that filter
-	/// is used when composed with another filter.
-	/// (Follows the boolean logic in BooleanClause for composition 
-	/// of queries.)
-	/// </summary>
-	public sealed class FilterClause
-	{
-
-	  private readonly Occur occur;
-	  private readonly Filter filter;
+namespace Lucene.Net.Queries
+{
 
-	  /// <summary>
-	  /// Create a new FilterClause </summary>
-	  /// <param name="filter"> A Filter object containing a BitSet </param>
-	  /// <param name="occur"> A parameter implementation indicating SHOULD, MUST or MUST NOT </param>
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// A Filter that wrapped with an indication of how that filter
+    /// is used when composed with another filter.
+    /// (Follows the boolean logic in BooleanClause for composition 
+    /// of queries.)
+    /// </summary>
+    public sealed class FilterClause
+    {
 
-	  public FilterClause(Filter filter, Occur occur)
-	  {
-		this.occur = occur;
-		this.filter = filter;
-	  }
+        private readonly BooleanClause.Occur occur;
+        private readonly Filter filter;
 
-	  /// <summary>
-	  /// Returns this FilterClause's filter </summary>
-	  /// <returns> A Filter object </returns>
-	  public Filter Filter
-	  {
-		  get
-		  {
-			return filter;
-		  }
-	  }
+        /// <summary>
+        /// Create a new FilterClause </summary>
+        /// <param name="filter"> A Filter object containing a BitSet </param>
+        /// <param name="occur"> A parameter implementation indicating SHOULD, MUST or MUST NOT </param>
+        public FilterClause(Filter filter, BooleanClause.Occur occur)
+        {
+            this.occur = occur;
+            this.filter = filter;
+        }
 
-	  /// <summary>
-	  /// Returns this FilterClause's occur parameter </summary>
-	  /// <returns> An Occur object </returns>
-	  public Occur Occur
-	  {
-		  get
-		  {
-			return occur;
-		  }
-	  }
+        /// <summary>
+        /// Returns this FilterClause's filter </summary>
+        /// <returns> A Filter object </returns>
+        public Filter Filter
+        {
+            get
+            {
+                return filter;
+            }
+        }
 
-	  public override bool Equals(object o)
-	  {
-		if (o == this)
-		{
-		  return true;
-		}
-		if (o == null || !(o is FilterClause))
-		{
-		  return false;
-		}
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final FilterClause other = (FilterClause)o;
-		FilterClause other = (FilterClause)o;
-		return this.filter.Equals(other.filter) && this.occur == other.occur;
-	  }
+        /// <summary>
+        /// Returns this FilterClause's occur parameter </summary>
+        /// <returns> An Occur object </returns>
+        public BooleanClause.Occur Occur
+        {
+            get
+            {
+                return occur;
+            }
+        }
 
-	  public override int GetHashCode()
-	  {
-		return filter.GetHashCode() ^ occur.GetHashCode();
-	  }
+        public override bool Equals(object o)
+        {
+            if (o == this)
+            {
+                return true;
+            }
 
-	  public override string ToString()
-	  {
-		return occur.ToString() + filter.ToString();
-	  }
+            var other = o as FilterClause;
+            if (other == null)
+            {
+                return false;
+            }
+            return this.filter.Equals(other.filter) && this.occur == other.occur;
+        }
 
-	}
+        public override int GetHashCode()
+        {
+            return filter.GetHashCode() ^ occur.GetHashCode();
+        }
 
+        public override string ToString()
+        {
+            return occur.ToString() + filter.ToString();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/BoostedQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/BoostedQuery.cs b/src/Lucene.Net.Queries/Function/BoostedQuery.cs
index 928db91..369617c 100644
--- a/src/Lucene.Net.Queries/Function/BoostedQuery.cs
+++ b/src/Lucene.Net.Queries/Function/BoostedQuery.cs
@@ -1,287 +1,272 @@
 using System.Collections;
 using System.Collections.Generic;
 using System.Text;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Support;
+using Lucene.Net.Util;
+using org.apache.lucene.queries.function;
 
-namespace org.apache.lucene.queries.function
+namespace Lucene.Net.Queries.Function
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using org.apache.lucene.search;
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using Term = org.apache.lucene.index.Term;
-	using Bits = org.apache.lucene.util.Bits;
-	using ToStringUtils = org.apache.lucene.util.ToStringUtils;
-
-
-	/// <summary>
-	/// Query that is boosted by a ValueSource
-	/// </summary>
-	// TODO: BoostedQuery and BoostingQuery in the same module? 
-	// something has to give
-	public class BoostedQuery : Query
-	{
-	  private Query q;
-	  private readonly ValueSource boostVal; // optional, can be null
-
-	  public BoostedQuery(Query subQuery, ValueSource boostVal)
-	  {
-		this.q = subQuery;
-		this.boostVal = boostVal;
-	  }
-
-	  public virtual Query Query
-	  {
-		  get
-		  {
-			  return q;
-		  }
-	  }
-	  public virtual ValueSource ValueSource
-	  {
-		  get
-		  {
-			  return boostVal;
-		  }
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public Query rewrite(org.apache.lucene.index.IndexReader reader) throws java.io.IOException
-	  public override Query rewrite(IndexReader reader)
-	  {
-		Query newQ = q.rewrite(reader);
-		if (newQ == q)
-		{
-			return this;
-		}
-		BoostedQuery bq = (BoostedQuery)this.MemberwiseClone();
-		bq.q = newQ;
-		return bq;
-	  }
-
-	  public override void extractTerms(HashSet<Term> terms)
-	  {
-		q.extractTerms(terms);
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public Weight createWeight(IndexSearcher searcher) throws java.io.IOException
-	  public override Weight createWeight(IndexSearcher searcher)
-	  {
-		return new BoostedQuery.BoostedWeight(this, searcher);
-	  }
-
-	  private class BoostedWeight : Weight
-	  {
-		  private readonly BoostedQuery outerInstance;
-
-		internal readonly IndexSearcher searcher;
-		internal Weight qWeight;
-		internal IDictionary fcontext;
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public BoostedWeight(IndexSearcher searcher) throws java.io.IOException
-		public BoostedWeight(BoostedQuery outerInstance, IndexSearcher searcher)
-		{
-			this.outerInstance = outerInstance;
-		  this.searcher = searcher;
-		  this.qWeight = outerInstance.q.createWeight(searcher);
-		  this.fcontext = ValueSource.newContext(searcher);
-		  outerInstance.boostVal.createWeight(fcontext,searcher);
-		}
-
-		public override Query Query
-		{
-			get
-			{
-			  return outerInstance;
-			}
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public float getValueForNormalization() throws java.io.IOException
-		public override float ValueForNormalization
-		{
-			get
-			{
-			  float sum = qWeight.ValueForNormalization;
-			  sum *= Boost * Boost;
-			  return sum;
-			}
-		}
-
-		public override void normalize(float norm, float topLevelBoost)
-		{
-		  topLevelBoost *= Boost;
-		  qWeight.normalize(norm, topLevelBoost);
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public Scorer scorer(org.apache.lucene.index.AtomicReaderContext context, org.apache.lucene.util.Bits acceptDocs) throws java.io.IOException
-		public override Scorer scorer(AtomicReaderContext context, Bits acceptDocs)
-		{
-		  Scorer subQueryScorer = qWeight.scorer(context, acceptDocs);
-		  if (subQueryScorer == null)
-		  {
-			return null;
-		  }
-		  return new BoostedQuery.CustomScorer(outerInstance, context, this, Boost, subQueryScorer, outerInstance.boostVal);
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public Explanation explain(org.apache.lucene.index.AtomicReaderContext readerContext, int doc) throws java.io.IOException
-		public override Explanation explain(AtomicReaderContext readerContext, int doc)
-		{
-		  Explanation subQueryExpl = qWeight.explain(readerContext,doc);
-		  if (!subQueryExpl.Match)
-		  {
-			return subQueryExpl;
-		  }
-		  FunctionValues vals = outerInstance.boostVal.getValues(fcontext, readerContext);
-		  float sc = subQueryExpl.Value * vals.floatVal(doc);
-		  Explanation res = new ComplexExplanation(true, sc, outerInstance.ToString() + ", product of:");
-		  res.addDetail(subQueryExpl);
-		  res.addDetail(vals.explain(doc));
-		  return res;
-		}
-	  }
-
-
-	  private class CustomScorer : Scorer
-	  {
-		  private readonly BoostedQuery outerInstance;
-
-		internal readonly BoostedQuery.BoostedWeight weight;
-		internal readonly float qWeight;
-		internal readonly Scorer scorer;
-		internal readonly FunctionValues vals;
-		internal readonly AtomicReaderContext readerContext;
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private CustomScorer(org.apache.lucene.index.AtomicReaderContext readerContext, BoostedQuery.BoostedWeight w, float qWeight, Scorer scorer, ValueSource vs) throws java.io.IOException
-		internal CustomScorer(BoostedQuery outerInstance, AtomicReaderContext readerContext, BoostedQuery.BoostedWeight w, float qWeight, Scorer scorer, ValueSource vs) : base(w)
-		{
-			this.outerInstance = outerInstance;
-		  this.weight = w;
-		  this.qWeight = qWeight;
-		  this.scorer = scorer;
-		  this.readerContext = readerContext;
-		  this.vals = vs.getValues(weight.fcontext, readerContext);
-		}
-
-		public override int docID()
-		{
-		  return scorer.docID();
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public int advance(int target) throws java.io.IOException
-		public override int advance(int target)
-		{
-		  return scorer.advance(target);
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public int nextDoc() throws java.io.IOException
-		public override int nextDoc()
-		{
-		  return scorer.nextDoc();
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public float score() throws java.io.IOException
-		public override float score()
-		{
-		  float score = qWeight * scorer.score() * vals.floatVal(scorer.docID());
-
-		  // Current Lucene priority queues can't handle NaN and -Infinity, so
-		  // map to -Float.MAX_VALUE. This conditional handles both -infinity
-		  // and NaN since comparisons with NaN are always false.
-		  return score > float.NegativeInfinity ? score : -float.MaxValue;
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public int freq() throws java.io.IOException
-		public override int freq()
-		{
-		  return scorer.freq();
-		}
-
-		public override ICollection<ChildScorer> Children
-		{
-			get
-			{
-			  return Collections.singleton(new ChildScorer(scorer, "CUSTOM"));
-			}
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public Explanation explain(int doc) throws java.io.IOException
-		public virtual Explanation explain(int doc)
-		{
-		  Explanation subQueryExpl = weight.qWeight.explain(readerContext,doc);
-		  if (!subQueryExpl.Match)
-		  {
-			return subQueryExpl;
-		  }
-		  float sc = subQueryExpl.Value * vals.floatVal(doc);
-		  Explanation res = new ComplexExplanation(true, sc, outerInstance.ToString() + ", product of:");
-		  res.addDetail(subQueryExpl);
-		  res.addDetail(vals.explain(doc));
-		  return res;
-		}
-
-		public override long cost()
-		{
-		  return scorer.cost();
-		}
-	  }
-
-
-	  public override string ToString(string field)
-	  {
-		StringBuilder sb = new StringBuilder();
-		sb.Append("boost(").Append(q.ToString(field)).Append(',').Append(boostVal).Append(')');
-		sb.Append(ToStringUtils.boost(Boost));
-		return sb.ToString();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-	  if (!base.Equals(o))
-	  {
-		  return false;
-	  }
-		BoostedQuery other = (BoostedQuery)o;
-		return this.q.Equals(other.q) && this.boostVal.Equals(other.boostVal);
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = q.GetHashCode();
-		h ^= (h << 17) | ((int)((uint)h >> 16));
-		h += boostVal.GetHashCode();
-		h ^= (h << 8) | ((int)((uint)h >> 25));
-		h += float.floatToIntBits(Boost);
-		return h;
-	  }
-
-	}
-
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// Query that is boosted by a ValueSource
+    /// </summary>
+    // TODO: BoostedQuery and BoostingQuery in the same module? 
+    // something has to give
+    public class BoostedQuery : Query
+    {
+        private Query q;
+        private readonly ValueSource boostVal; // optional, can be null
+
+        public BoostedQuery(Query subQuery, ValueSource boostVal)
+        {
+            this.q = subQuery;
+            this.boostVal = boostVal;
+        }
+
+        public virtual Query Query
+        {
+            get
+            {
+                return q;
+            }
+        }
+        public virtual ValueSource ValueSource
+        {
+            get
+            {
+                return boostVal;
+            }
+        }
+    
+        public override Query Rewrite(IndexReader reader)
+        {
+            Query newQ = q.Rewrite(reader);
+            if (newQ == q)
+            {
+                return this;
+            }
+            BoostedQuery bq = (BoostedQuery)this.MemberwiseClone();
+            bq.q = newQ;
+            return bq;
+        }
+
+        public override void ExtractTerms(HashSet<Term> terms)
+        {
+            q.ExtractTerms(terms);
+        }
+
+        public override Weight CreateWeight(IndexSearcher searcher)
+        {
+            return new BoostedQuery.BoostedWeight(this, searcher);
+        }
+
+        private class BoostedWeight : Weight
+        {
+            private readonly BoostedQuery outerInstance;
+
+            internal readonly IndexSearcher searcher;
+            internal Weight qWeight;
+            internal IDictionary fcontext;
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: public BoostedWeight(IndexSearcher searcher) throws java.io.IOException
+            public BoostedWeight(BoostedQuery outerInstance, IndexSearcher searcher)
+            {
+                this.outerInstance = outerInstance;
+                this.searcher = searcher;
+                this.qWeight = outerInstance.q.CreateWeight(searcher);
+                this.fcontext = ValueSource.newContext(searcher);
+                outerInstance.boostVal.CreateWeight(fcontext, searcher);
+            }
+
+            public override Query Query
+            {
+                get
+                {
+                    return outerInstance;
+                }
+            }
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: @Override public float getValueForNormalization() throws java.io.IOException
+            public override float ValueForNormalization
+            {
+                get
+                {
+                    float sum = qWeight.ValueForNormalization;
+                    sum *= Boost * Boost;
+                    return sum;
+                }
+            }
+
+            public override void normalize(float norm, float topLevelBoost)
+            {
+                topLevelBoost *= Boost;
+                qWeight.Normalize(norm, topLevelBoost);
+            }
+
+            public override Scorer Scorer(AtomicReaderContext context, Bits acceptDocs)
+            {
+                Scorer subQueryScorer = qWeight.Scorer(context, acceptDocs);
+                if (subQueryScorer == null)
+                {
+                    return null;
+                }
+                return new BoostedQuery.CustomScorer(outerInstance, context, this, Boost, subQueryScorer, outerInstance.boostVal);
+            }
+
+            public override Explanation Explain(AtomicReaderContext readerContext, int doc)
+            {
+                Explanation subQueryExpl = qWeight.Explain(readerContext, doc);
+                if (!subQueryExpl.Match)
+                {
+                    return subQueryExpl;
+                }
+                FunctionValues vals = outerInstance.boostVal.GetValues(fcontext, readerContext);
+                float sc = subQueryExpl.Value * vals.FloatVal(doc);
+                Explanation res = new ComplexExplanation(true, sc, outerInstance.ToString() + ", product of:");
+                res.AddDetail(subQueryExpl);
+                res.AddDetail(vals.explain(doc));
+                return res;
+            }
+        }
+
+
+        private class CustomScorer : Scorer
+        {
+            private readonly BoostedQuery outerInstance;
+
+            internal readonly BoostedQuery.BoostedWeight weight;
+            internal readonly float qWeight;
+            internal readonly Scorer scorer;
+            internal readonly FunctionValues vals;
+            internal readonly AtomicReaderContext readerContext;
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: private CustomScorer(org.apache.lucene.index.AtomicReaderContext readerContext, BoostedQuery.BoostedWeight w, float qWeight, Scorer scorer, ValueSource vs) throws java.io.IOException
+            internal CustomScorer(BoostedQuery outerInstance, AtomicReaderContext readerContext, BoostedQuery.BoostedWeight w, float qWeight, Scorer scorer, ValueSource vs)
+                : base(w)
+            {
+                this.outerInstance = outerInstance;
+                this.weight = w;
+                this.qWeight = qWeight;
+                this.scorer = scorer;
+                this.readerContext = readerContext;
+                this.vals = vs.GetValues(weight.fcontext, readerContext);
+            }
+
+            public override int DocID()
+            {
+                return scorer.DocID();
+            }
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: @Override public int advance(int target) throws java.io.IOException
+            public override int Advance(int target)
+            {
+                return scorer.Advance(target);
+            }
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: @Override public int nextDoc() throws java.io.IOException
+            public override int NextDoc()
+            {
+                return scorer.NextDoc();
+            }
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: @Override public float score() throws java.io.IOException
+            public override float Score()
+            {
+                float score = qWeight * scorer.Score() * vals.FloatVal(scorer.DocID());
+
+                // Current Lucene priority queues can't handle NaN and -Infinity, so
+                // map to -Float.MAX_VALUE. This conditional handles both -infinity
+                // and NaN since comparisons with NaN are always false.
+                return score > float.NegativeInfinity ? score : -float.MaxValue;
+            }
+
+            public override int Freq()
+            {
+                return scorer.Freq();
+            }
+
+            public override ICollection<ChildScorer> Children
+            {
+                get
+                {
+                    return Collections.Singleton(new ChildScorer(scorer, "CUSTOM"));
+                }
+            }
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: public Explanation explain(int doc) throws java.io.IOException
+            public virtual Explanation explain(int doc)
+            {
+                Explanation subQueryExpl = weight.qWeight.Explain(readerContext, doc);
+                if (!subQueryExpl.Match)
+                {
+                    return subQueryExpl;
+                }
+                float sc = subQueryExpl.Value * vals.FloatVal(doc);
+                Explanation res = new ComplexExplanation(true, sc, outerInstance.ToString() + ", product of:");
+                res.AddDetail(subQueryExpl);
+                res.AddDetail(vals.explain(doc));
+                return res;
+            }
+
+            public override long Cost()
+            {
+                return scorer.Cost();
+            }
+        }
+
+
+        public override string ToString(string field)
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append("boost(").Append(q.ToString(field)).Append(',').Append(boostVal).Append(')');
+            sb.Append(ToStringUtils.Boost(Boost));
+            return sb.ToString();
+        }
+
+        public override bool Equals(object o)
+        {
+            if (!base.Equals(o))
+            {
+                return false;
+            }
+            BoostedQuery other = (BoostedQuery)o;
+            return this.q.Equals(other.q) && this.boostVal.Equals(other.boostVal);
+        }
+
+        public override int GetHashCode()
+        {
+            int h = q.GetHashCode();
+            h ^= (h << 17) | ((int)((uint)h >> 16));
+            h += boostVal.GetHashCode();
+            h ^= (h << 8) | ((int)((uint)h >> 25));
+            h += Number.FloatToIntBits(Boost);
+            return h;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/DocValues/BoolDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/DocValues/BoolDocValues.cs b/src/Lucene.Net.Queries/Function/DocValues/BoolDocValues.cs
index 1ad0517..c27ef4b 100644
--- a/src/Lucene.Net.Queries/Function/DocValues/BoolDocValues.cs
+++ b/src/Lucene.Net.Queries/Function/DocValues/BoolDocValues.cs
@@ -1,122 +1,118 @@
 using System;
+using Lucene.Net.Util.Mutable;
 
-namespace org.apache.lucene.queries.function.docvalues
+namespace Lucene.Net.Queries.Function.DocValues
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueBool = org.apache.lucene.util.mutable.MutableValueBool;
-
-	/// <summary>
-	/// Abstract <seealso cref="FunctionValues"/> implementation which supports retrieving boolean values.
-	/// Implementations can control how the boolean values are loaded through <seealso cref="#boolVal(int)"/>}
-	/// </summary>
-	public abstract class BoolDocValues : FunctionValues
-	{
-	  protected internal readonly ValueSource vs;
-
-	  public BoolDocValues(ValueSource vs)
-	  {
-		this.vs = vs;
-	  }
-
-	  public override abstract bool boolVal(int doc);
-
-	  public override sbyte byteVal(int doc)
-	  {
-		return boolVal(doc) ? (sbyte)1 : (sbyte)0;
-	  }
-
-	  public override short shortVal(int doc)
-	  {
-		return boolVal(doc) ? (short)1 : (short)0;
-	  }
-
-	  public override float floatVal(int doc)
-	  {
-		return boolVal(doc) ? (float)1 : (float)0;
-	  }
-
-	  public override int intVal(int doc)
-	  {
-		return boolVal(doc) ? 1 : 0;
-	  }
-
-	  public override long longVal(int doc)
-	  {
-		return boolVal(doc) ? (long)1 : (long)0;
-	  }
-
-	  public override double doubleVal(int doc)
-	  {
-		return boolVal(doc) ? (double)1 : (double)0;
-	  }
-
-	  public override string strVal(int doc)
-	  {
-		return Convert.ToString(boolVal(doc));
-	  }
-
-	  public override object objectVal(int doc)
-	  {
-		return exists(doc) ? boolVal(doc) : null;
-	  }
-
-	  public override string ToString(int doc)
-	  {
-		return vs.description() + '=' + strVal(doc);
-	  }
-
-	  public override ValueFiller ValueFiller
-	  {
-		  get
-		  {
-			return new ValueFillerAnonymousInnerClassHelper(this);
-		  }
-	  }
-
-	  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-	  {
-		  private readonly BoolDocValues outerInstance;
-
-		  public ValueFillerAnonymousInnerClassHelper(BoolDocValues outerInstance)
-		  {
-			  this.outerInstance = outerInstance;
-			  mval = new MutableValueBool();
-		  }
-
-		  private readonly MutableValueBool mval;
-
-		  public override MutableValue Value
-		  {
-			  get
-			  {
-				return mval;
-			  }
-		  }
-
-		  public override void fillValue(int doc)
-		  {
-			mval.value = outerInstance.boolVal(doc);
-			mval.exists = outerInstance.exists(doc);
-		  }
-	  }
-	}
-
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// Abstract <seealso cref="FunctionValues"/> implementation which supports retrieving boolean values.
+    /// Implementations can control how the boolean values are loaded through <seealso cref="#BoolVal(int)"/>}
+    /// </summary>
+    public abstract class BoolDocValues : FunctionValues
+    {
+        protected internal readonly ValueSource vs;
+
+        protected BoolDocValues(ValueSource vs)
+        {
+            this.vs = vs;
+        }
+
+        public override abstract bool BoolVal(int doc);
+
+        public override sbyte ByteVal(int doc)
+        {
+            return BoolVal(doc) ? (sbyte)1 : (sbyte)0;
+        }
+
+        public override short ShortVal(int doc)
+        {
+            return BoolVal(doc) ? (short)1 : (short)0;
+        }
+
+        public override float FloatVal(int doc)
+        {
+            return BoolVal(doc) ? 1f : 0f;
+        }
+
+        public override int IntVal(int doc)
+        {
+            return BoolVal(doc) ? 1 : 0;
+        }
+
+        public override long LongVal(int doc)
+        {
+            return BoolVal(doc) ? 1 : 0;
+        }
+
+        public override double DoubleVal(int doc)
+        {
+            return BoolVal(doc) ? 1d : 0d;
+        }
+
+        public override string StrVal(int doc)
+        {
+            return Convert.ToString(BoolVal(doc));
+        }
+
+        public override object ObjectVal(int doc)
+        {
+            return Exists(doc) ? BoolVal(doc) : (bool?)null;
+        }
+
+        public override string ToString(int doc)
+        {
+            return vs.Description + '=' + StrVal(doc);
+        }
+
+        public override AbstractValueFiller ValueFiller
+        {
+            get
+            {
+                return new ValueFillerAnonymousInnerClassHelper(this);
+            }
+        }
+
+        private class ValueFillerAnonymousInnerClassHelper : AbstractValueFiller
+        {
+            private readonly BoolDocValues outerInstance;
+
+            public ValueFillerAnonymousInnerClassHelper(BoolDocValues outerInstance)
+            {
+                this.outerInstance = outerInstance;
+                mval = new MutableValueBool();
+            }
+
+            private readonly MutableValueBool mval;
+
+            public override MutableValue Value
+            {
+                get
+                {
+                    return mval;
+                }
+            }
+
+            public override void FillValue(int doc)
+            {
+                mval.Value = outerInstance.BoolVal(doc);
+                mval.Exists = outerInstance.Exists(doc);
+            }
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/DocValues/DocTermsIndexDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/DocValues/DocTermsIndexDocValues.cs b/src/Lucene.Net.Queries/Function/DocValues/DocTermsIndexDocValues.cs
index 79f490c..832e921 100644
--- a/src/Lucene.Net.Queries/Function/DocValues/DocTermsIndexDocValues.cs
+++ b/src/Lucene.Net.Queries/Function/DocValues/DocTermsIndexDocValues.cs
@@ -1,6 +1,4 @@
-using System;
-
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -16,219 +14,202 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+using System;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
+using Lucene.Net.Util.Mutable;
 
-namespace org.apache.lucene.queries.function.docvalues
+namespace Lucene.Net.Queries.Function.DocValues
 {
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using SortedDocValues = org.apache.lucene.index.SortedDocValues;
-	using FieldCache = org.apache.lucene.search.FieldCache;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-	using CharsRef = org.apache.lucene.util.CharsRef;
-	using UnicodeUtil = org.apache.lucene.util.UnicodeUtil;
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueStr = org.apache.lucene.util.mutable.MutableValueStr;
-
-	/// <summary>
-	/// Serves as base class for FunctionValues based on DocTermsIndex.
-	/// @lucene.internal
-	/// </summary>
-	public abstract class DocTermsIndexDocValues : FunctionValues
-	{
-	  protected internal readonly SortedDocValues termsIndex;
-	  protected internal readonly ValueSource vs;
-	  protected internal readonly MutableValueStr val = new MutableValueStr();
-	  protected internal readonly BytesRef spare = new BytesRef();
-	  protected internal readonly CharsRef spareChars = new CharsRef();
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public DocTermsIndexDocValues(org.apache.lucene.queries.function.ValueSource vs, org.apache.lucene.index.AtomicReaderContext context, String field) throws java.io.IOException
-	  public DocTermsIndexDocValues(ValueSource vs, AtomicReaderContext context, string field)
-	  {
-		try
-		{
-		  termsIndex = FieldCache.DEFAULT.getTermsIndex(context.reader(), field);
-		}
-		catch (Exception e)
-		{
-		  throw new DocTermsIndexException(field, e);
-		}
-		this.vs = vs;
-	  }
-
-	  protected internal abstract string toTerm(string readableValue);
-
-	  public override bool exists(int doc)
-	  {
-		return ordVal(doc) >= 0;
-	  }
-
-	  public override int ordVal(int doc)
-	  {
-		return termsIndex.getOrd(doc);
-	  }
-
-	  public override int numOrd()
-	  {
-		return termsIndex.ValueCount;
-	  }
-
-	  public override bool bytesVal(int doc, BytesRef target)
-	  {
-		termsIndex.get(doc, target);
-		return target.length > 0;
-	  }
-
-	  public override string strVal(int doc)
-	  {
-		termsIndex.get(doc, spare);
-		if (spare.length == 0)
-		{
-		  return null;
-		}
-		UnicodeUtil.UTF8toUTF16(spare, spareChars);
-		return spareChars.ToString();
-	  }
-
-	  public override bool boolVal(int doc)
-	  {
-		return exists(doc);
-	  }
-
-	  public override abstract object objectVal(int doc); // force subclasses to override
-
-	  public override ValueSourceScorer getRangeScorer(IndexReader reader, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
-	  {
-		// TODO: are lowerVal and upperVal in indexed form or not?
-		lowerVal = lowerVal == null ? null : toTerm(lowerVal);
-		upperVal = upperVal == null ? null : toTerm(upperVal);
-
-		int lower = int.MinValue;
-		if (lowerVal != null)
-		{
-		  lower = termsIndex.lookupTerm(new BytesRef(lowerVal));
-		  if (lower < 0)
-		  {
-			lower = -lower - 1;
-		  }
-		  else if (!includeLower)
-		  {
-			lower++;
-		  }
-		}
-
-		int upper = int.MaxValue;
-		if (upperVal != null)
-		{
-		  upper = termsIndex.lookupTerm(new BytesRef(upperVal));
-		  if (upper < 0)
-		  {
-			upper = -upper - 2;
-		  }
-		  else if (!includeUpper)
-		  {
-			upper--;
-		  }
-		}
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int ll = lower;
-		int ll = lower;
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int uu = upper;
-		int uu = upper;
-
-		return new ValueSourceScorerAnonymousInnerClassHelper(this, reader, this, ll, uu);
-	  }
-
-	  private class ValueSourceScorerAnonymousInnerClassHelper : ValueSourceScorer
-	  {
-		  private readonly DocTermsIndexDocValues outerInstance;
-
-		  private int ll;
-		  private int uu;
-
-		  public ValueSourceScorerAnonymousInnerClassHelper(DocTermsIndexDocValues outerInstance, IndexReader reader, org.apache.lucene.queries.function.docvalues.DocTermsIndexDocValues this, int ll, int uu) : base(reader, this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.ll = ll;
-			  this.uu = uu;
-		  }
-
-		  public override bool matchesValue(int doc)
-		  {
-			int ord = outerInstance.termsIndex.getOrd(doc);
-			return ord >= ll && ord <= uu;
-		  }
-	  }
-
-	  public override string ToString(int doc)
-	  {
-		return vs.description() + '=' + strVal(doc);
-	  }
-
-	  public override ValueFiller ValueFiller
-	  {
-		  get
-		  {
-			return new ValueFillerAnonymousInnerClassHelper(this);
-		  }
-	  }
-
-	  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-	  {
-		  private readonly DocTermsIndexDocValues outerInstance;
-
-		  public ValueFillerAnonymousInnerClassHelper(DocTermsIndexDocValues outerInstance)
-		  {
-			  this.outerInstance = outerInstance;
-			  mval = new MutableValueStr();
-		  }
-
-		  private readonly MutableValueStr mval;
-
-		  public override MutableValue Value
-		  {
-			  get
-			  {
-				return mval;
-			  }
-		  }
-
-		  public override void fillValue(int doc)
-		  {
-			int ord = outerInstance.termsIndex.getOrd(doc);
-			if (ord == -1)
-			{
-			  mval.value.bytes = BytesRef.EMPTY_BYTES;
-			  mval.value.offset = 0;
-			  mval.value.length = 0;
-			  mval.exists = false;
-			}
-			else
-			{
-			  outerInstance.termsIndex.lookupOrd(ord, mval.value);
-			  mval.exists = true;
-			}
-		  }
-	  }
-
-	  /// <summary>
-	  /// Custom Exception to be thrown when the DocTermsIndex for a field cannot be generated
-	  /// </summary>
-	  public sealed class DocTermsIndexException : Exception
-	  {
-
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-//ORIGINAL LINE: public DocTermsIndexException(final String fieldName, final RuntimeException cause)
-		public DocTermsIndexException(string fieldName, Exception cause) : base("Can't initialize DocTermsIndex to generate (function) FunctionValues for field: " + fieldName, cause)
-		{
-		}
-
-	  }
-
-
-	}
-
+    /// <summary>
+    /// Serves as base class for FunctionValues based on DocTermsIndex.
+    /// @lucene.internal
+    /// </summary>
+    public abstract class DocTermsIndexDocValues : FunctionValues
+    {
+        protected internal readonly SortedDocValues termsIndex;
+        protected internal readonly ValueSource vs;
+        protected internal readonly MutableValueStr val = new MutableValueStr();
+        protected internal readonly BytesRef spare = new BytesRef();
+        protected internal readonly CharsRef spareChars = new CharsRef();
+
+        protected DocTermsIndexDocValues(ValueSource vs, AtomicReaderContext context, string field)
+        {
+            try
+            {
+                termsIndex = FieldCache_Fields.DEFAULT.GetTermsIndex(context.AtomicReader, field);
+            }
+            catch (Exception e)
+            {
+                throw new DocTermsIndexException(field, e);
+            }
+            this.vs = vs;
+        }
+
+        protected internal abstract string toTerm(string readableValue);
+
+        public override bool Exists(int doc)
+        {
+            return OrdVal(doc) >= 0;
+        }
+
+        public override int OrdVal(int doc)
+        {
+            return termsIndex.GetOrd(doc);
+        }
+
+        public override int NumOrd()
+        {
+            return termsIndex.ValueCount;
+        }
+
+        public override bool BytesVal(int doc, BytesRef target)
+        {
+            termsIndex.Get(doc, target);
+            return target.Length > 0;
+        }
+
+        public override string StrVal(int doc)
+        {
+            termsIndex.Get(doc, spare);
+            if (spare.Length == 0)
+            {
+                return null;
+            }
+            UnicodeUtil.UTF8toUTF16(spare, spareChars);
+            return spareChars.ToString();
+        }
+
+        public override bool BoolVal(int doc)
+        {
+            return Exists(doc);
+        }
+
+        public override abstract object ObjectVal(int doc); // force subclasses to override
+
+        public override ValueSourceScorer GetRangeScorer(IndexReader reader, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
+        {
+            // TODO: are lowerVal and upperVal in indexed form or not?
+            lowerVal = lowerVal == null ? null : toTerm(lowerVal);
+            upperVal = upperVal == null ? null : toTerm(upperVal);
+
+            int lower = int.MinValue;
+            if (lowerVal != null)
+            {
+                lower = termsIndex.LookupTerm(new BytesRef(lowerVal));
+                if (lower < 0)
+                {
+                    lower = -lower - 1;
+                }
+                else if (!includeLower)
+                {
+                    lower++;
+                }
+            }
+
+            int upper = int.MaxValue;
+            if (upperVal != null)
+            {
+                upper = termsIndex.LookupTerm(new BytesRef(upperVal));
+                if (upper < 0)
+                {
+                    upper = -upper - 2;
+                }
+                else if (!includeUpper)
+                {
+                    upper--;
+                }
+            }
+            int ll = lower;
+            int uu = upper;
+
+            return new ValueSourceScorerAnonymousInnerClassHelper(this, reader, this, ll, uu);
+        }
+
+        private class ValueSourceScorerAnonymousInnerClassHelper : ValueSourceScorer
+        {
+            private readonly DocTermsIndexDocValues outerInstance;
+
+            private int ll;
+            private int uu;
+
+            public ValueSourceScorerAnonymousInnerClassHelper(DocTermsIndexDocValues outerInstance, IndexReader reader,
+                DocTermsIndexDocValues @this, int ll, int uu)
+                : base(reader, @this)
+            {
+                this.outerInstance = outerInstance;
+                this.ll = ll;
+                this.uu = uu;
+            }
+
+            public override bool MatchesValue(int doc)
+            {
+                int ord = outerInstance.termsIndex.GetOrd(doc);
+                return ord >= ll && ord <= uu;
+            }
+        }
+
+        public override string ToString(int doc)
+        {
+            return vs.Description + '=' + StrVal(doc);
+        }
+
+        public override AbstractValueFiller ValueFiller
+        {
+            get
+            {
+                return new ValueFillerAnonymousInnerClassHelper(this);
+            }
+        }
+
+        private class ValueFillerAnonymousInnerClassHelper : AbstractValueFiller
+        {
+            private readonly DocTermsIndexDocValues outerInstance;
+
+            public ValueFillerAnonymousInnerClassHelper(DocTermsIndexDocValues outerInstance)
+            {
+                this.outerInstance = outerInstance;
+                mval = new MutableValueStr();
+            }
+
+            private readonly MutableValueStr mval;
+
+            public override MutableValue Value
+            {
+                get
+                {
+                    return mval;
+                }
+            }
+
+            public override void FillValue(int doc)
+            {
+                int ord = outerInstance.termsIndex.GetOrd(doc);
+                if (ord == -1)
+                {
+                    mval.Value.Bytes = BytesRef.EMPTY_BYTES;
+                    mval.Value.Offset = 0;
+                    mval.Value.Length = 0;
+                    mval.Exists = false;
+                }
+                else
+                {
+                    outerInstance.termsIndex.LookupOrd(ord, mval.Value);
+                    mval.Exists = true;
+                }
+            }
+        }
+
+        /// <summary>
+        /// Custom Exception to be thrown when the DocTermsIndex for a field cannot be generated
+        /// </summary>
+        public sealed class DocTermsIndexException : Exception
+        {
+            public DocTermsIndexException(string fieldName, Exception cause)
+                : base("Can't initialize DocTermsIndex to generate (function) FunctionValues for field: " + fieldName, cause)
+            {
+            }
+        }
+    }
 }
\ No newline at end of file


[11/21] Moving ValueSource -> ValueSources to avoid name conflicts

Posted by sy...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/ReverseOrdFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/ReverseOrdFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/ReverseOrdFieldSource.cs
deleted file mode 100644
index b509dde..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/ReverseOrdFieldSource.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	using AtomicReader = org.apache.lucene.index.AtomicReader;
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using CompositeReader = org.apache.lucene.index.CompositeReader;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using ReaderUtil = org.apache.lucene.index.ReaderUtil;
-	using SlowCompositeReaderWrapper = org.apache.lucene.index.SlowCompositeReaderWrapper;
-	using SortedDocValues = org.apache.lucene.index.SortedDocValues;
-	using IntDocValues = org.apache.lucene.queries.function.docvalues.IntDocValues;
-	using FieldCache = org.apache.lucene.search.FieldCache;
-
-	/// <summary>
-	/// Obtains the ordinal of the field value from the default Lucene <seealso cref="org.apache.lucene.search.FieldCache"/> using getTermsIndex()
-	/// and reverses the order.
-	/// <br>
-	/// The native lucene index order is used to assign an ordinal value for each field value.
-	/// <br>Field values (terms) are lexicographically ordered by unicode value, and numbered starting at 1.
-	/// <br>
-	/// Example of reverse ordinal (rord):<br>
-	///  If there were only three field values: "apple","banana","pear"
-	/// <br>then rord("apple")=3, rord("banana")=2, ord("pear")=1
-	/// <para>
-	///  WARNING: ord() depends on the position in an index and can thus change when other documents are inserted or deleted,
-	///  or if a MultiSearcher is used.
-	/// <br>
-	///  WARNING: as of Solr 1.4, ord() and rord() can cause excess memory use since they must use a FieldCache entry
-	/// at the top level reader, while sorting and function queries now use entries at the segment level.  Hence sorting
-	/// or using a different function query, in addition to ord()/rord() will double memory use.
-	/// 
-	/// 
-	/// </para>
-	/// </summary>
-
-	public class ReverseOrdFieldSource : ValueSource
-	{
-	  public readonly string field;
-
-	  public ReverseOrdFieldSource(string field)
-	  {
-		this.field = field;
-	  }
-
-	  public override string description()
-	  {
-		return "rord(" + field + ')';
-	  }
-
-	  // TODO: this is trappy? perhaps this query instead should make you pass a slow reader yourself?
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.IndexReader topReader = org.apache.lucene.index.ReaderUtil.getTopLevelContext(readerContext).reader();
-		IndexReader topReader = ReaderUtil.getTopLevelContext(readerContext).reader();
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.AtomicReader r = org.apache.lucene.index.SlowCompositeReaderWrapper.wrap(topReader);
-		AtomicReader r = SlowCompositeReaderWrapper.wrap(topReader);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int off = readerContext.docBase;
-		int off = readerContext.docBase;
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.SortedDocValues sindex = org.apache.lucene.search.FieldCache.DEFAULT.getTermsIndex(r, field);
-		SortedDocValues sindex = FieldCache.DEFAULT.getTermsIndex(r, field);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int end = sindex.getValueCount();
-		int end = sindex.ValueCount;
-
-		return new IntDocValuesAnonymousInnerClassHelper(this, this, off, sindex, end);
-	  }
-
-	  private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
-	  {
-		  private readonly ReverseOrdFieldSource outerInstance;
-
-		  private int off;
-		  private SortedDocValues sindex;
-		  private int end;
-
-		  public IntDocValuesAnonymousInnerClassHelper(ReverseOrdFieldSource outerInstance, org.apache.lucene.queries.function.valuesource.ReverseOrdFieldSource this, int off, SortedDocValues sindex, int end) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.off = off;
-			  this.sindex = sindex;
-			  this.end = end;
-		  }
-
-		  public override int intVal(int doc)
-		  {
-			 return (end - sindex.getOrd(doc + off) - 1);
-		  }
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (o == null || (o.GetType() != typeof(ReverseOrdFieldSource)))
-		{
-			return false;
-		}
-		ReverseOrdFieldSource other = (ReverseOrdFieldSource)o;
-		return this.field.Equals(other.field);
-	  }
-
-	  private static readonly int hcode = typeof(ReverseOrdFieldSource).GetHashCode();
-	  public override int GetHashCode()
-	  {
-		return hcode + field.GetHashCode();
-	  }
-
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/ScaleFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/ScaleFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/ScaleFloatFunction.cs
deleted file mode 100644
index 4d27585..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/ScaleFloatFunction.cs
+++ /dev/null
@@ -1,200 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using ReaderUtil = org.apache.lucene.index.ReaderUtil;
-	using FloatDocValues = org.apache.lucene.queries.function.docvalues.FloatDocValues;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-
-
-	/// <summary>
-	/// Scales values to be between min and max.
-	/// <para>This implementation currently traverses all of the source values to obtain
-	/// their min and max.
-	/// </para>
-	/// <para>This implementation currently cannot distinguish when documents have been
-	/// deleted or documents that have no value, and 0.0 values will be used for
-	/// these cases.  This means that if values are normally all greater than 0.0, one can
-	/// still end up with 0.0 as the min value to map from.  In these cases, an
-	/// appropriate map() function could be used as a workaround to change 0.0
-	/// to a value in the real range.
-	/// </para>
-	/// </summary>
-	public class ScaleFloatFunction : ValueSource
-	{
-	  protected internal readonly ValueSource source;
-	  protected internal readonly float min;
-	  protected internal readonly float max;
-
-	  public ScaleFloatFunction(ValueSource source, float min, float max)
-	  {
-		this.source = source;
-		this.min = min;
-		this.max = max;
-	  }
-
-	  public override string description()
-	  {
-		return "scale(" + source.description() + "," + min + "," + max + ")";
-	  }
-
-	  private class ScaleInfo
-	  {
-		internal float minVal;
-		internal float maxVal;
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private ScaleInfo createScaleInfo(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  private ScaleInfo createScaleInfo(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final java.util.List<org.apache.lucene.index.AtomicReaderContext> leaves = org.apache.lucene.index.ReaderUtil.getTopLevelContext(readerContext).leaves();
-		IList<AtomicReaderContext> leaves = ReaderUtil.getTopLevelContext(readerContext).leaves();
-
-		float minVal = float.PositiveInfinity;
-		float maxVal = float.NegativeInfinity;
-
-		foreach (AtomicReaderContext leaf in leaves)
-		{
-		  int maxDoc = leaf.reader().maxDoc();
-		  FunctionValues vals = source.getValues(context, leaf);
-		  for (int i = 0; i < maxDoc; i++)
-		  {
-
-		  float val = vals.floatVal(i);
-		  if ((float.floatToRawIntBits(val) & (0xff << 23)) == 0xff << 23)
-		  {
-			// if the exponent in the float is all ones, then this is +Inf, -Inf or NaN
-			// which don't make sense to factor into the scale function
-			continue;
-		  }
-		  if (val < minVal)
-		  {
-			minVal = val;
-		  }
-		  if (val > maxVal)
-		  {
-			maxVal = val;
-		  }
-		  }
-		}
-
-		if (minVal == float.PositiveInfinity)
-		{
-		// must have been an empty index
-		  minVal = maxVal = 0;
-		}
-
-		ScaleInfo scaleInfo = new ScaleInfo();
-		scaleInfo.minVal = minVal;
-		scaleInfo.maxVal = maxVal;
-		context[ScaleFloatFunction.this] = scaleInfo;
-		return scaleInfo;
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-
-		ScaleInfo scaleInfo = (ScaleInfo)context[ScaleFloatFunction.this];
-		if (scaleInfo == null)
-		{
-		  scaleInfo = createScaleInfo(context, readerContext);
-		}
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final float scale = (scaleInfo.maxVal-scaleInfo.minVal==0) ? 0 : (max-min)/(scaleInfo.maxVal-scaleInfo.minVal);
-		float scale = (scaleInfo.maxVal - scaleInfo.minVal == 0) ? 0 : (max - min) / (scaleInfo.maxVal - scaleInfo.minVal);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final float minSource = scaleInfo.minVal;
-		float minSource = scaleInfo.minVal;
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final float maxSource = scaleInfo.maxVal;
-		float maxSource = scaleInfo.maxVal;
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
-		FunctionValues vals = source.getValues(context, readerContext);
-
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, scale, minSource, maxSource, vals);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly ScaleFloatFunction outerInstance;
-
-		  private float scale;
-		  private float minSource;
-		  private float maxSource;
-		  private FunctionValues vals;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(ScaleFloatFunction outerInstance, org.apache.lucene.queries.function.valuesource.ScaleFloatFunction this, float scale, float minSource, float maxSource, FunctionValues vals) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.scale = scale;
-			  this.minSource = minSource;
-			  this.maxSource = maxSource;
-			  this.vals = vals;
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return (vals.floatVal(doc) - minSource) * scale + outerInstance.min;
-		  }
-		  public override string ToString(int doc)
-		  {
-			return "scale(" + vals.ToString(doc) + ",toMin=" + outerInstance.min + ",toMax=" + outerInstance.max + ",fromMin=" + minSource + ",fromMax=" + maxSource + ")";
-		  }
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		source.createWeight(context, searcher);
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = float.floatToIntBits(min);
-		h = h * 29;
-		h += float.floatToIntBits(max);
-		h = h * 29;
-		h += source.GetHashCode();
-		return h;
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (typeof(ScaleFloatFunction) != o.GetType())
-		{
-			return false;
-		}
-		ScaleFloatFunction other = (ScaleFloatFunction)o;
-		return this.min == other.min && this.max == other.max && this.source.Equals(other.source);
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/ShortFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/ShortFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/ShortFieldSource.cs
deleted file mode 100644
index 6240253..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/ShortFieldSource.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-using System;
-using System.Collections;
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using FieldCache = org.apache.lucene.search.FieldCache;
-
-
-	/// <summary>
-	/// Obtains short field values from the <seealso cref="org.apache.lucene.search.FieldCache"/>
-	/// using <code>getShorts()</code>
-	/// and makes those values available as other numeric types, casting as needed.
-	/// 
-	/// </summary>
-	[Obsolete]
-	public class ShortFieldSource : FieldCacheSource
-	{
-
-	  internal readonly FieldCache.ShortParser parser;
-
-	  public ShortFieldSource(string field) : this(field, null)
-	  {
-	  }
-
-	  public ShortFieldSource(string field, FieldCache.ShortParser parser) : base(field)
-	  {
-		this.parser = parser;
-	  }
-
-	  public override string description()
-	  {
-		return "short(" + field + ')';
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Shorts arr = cache.getShorts(readerContext.reader(), field, parser, false);
-		FieldCache.Shorts arr = cache.getShorts(readerContext.reader(), field, parser, false);
-
-		return new FunctionValuesAnonymousInnerClassHelper(this, arr);
-	  }
-
-	  private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
-	  {
-		  private readonly ShortFieldSource outerInstance;
-
-		  private FieldCache.Shorts arr;
-
-		  public FunctionValuesAnonymousInnerClassHelper(ShortFieldSource outerInstance, FieldCache.Shorts arr)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.arr = arr;
-		  }
-
-		  public override sbyte byteVal(int doc)
-		  {
-			return (sbyte) arr.get(doc);
-		  }
-
-		  public override short shortVal(int doc)
-		  {
-			return arr.get(doc);
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return (float) arr.get(doc);
-		  }
-
-		  public override int intVal(int doc)
-		  {
-			return (int) arr.get(doc);
-		  }
-
-		  public override long longVal(int doc)
-		  {
-			return (long) arr.get(doc);
-		  }
-
-		  public override double doubleVal(int doc)
-		  {
-			return (double) arr.get(doc);
-		  }
-
-		  public override string strVal(int doc)
-		  {
-			return Convert.ToString(arr.get(doc));
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.description() + '=' + shortVal(doc);
-		  }
-
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (o.GetType() != typeof(ShortFieldSource))
-		{
-			return false;
-		}
-		ShortFieldSource other = (ShortFieldSource) o;
-		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = parser == null ? typeof(short?).GetHashCode() : parser.GetType().GetHashCode();
-		h += base.GetHashCode();
-		return h;
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/SimpleBoolFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/SimpleBoolFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/SimpleBoolFunction.cs
deleted file mode 100644
index 01349f6..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/SimpleBoolFunction.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using BoolDocValues = org.apache.lucene.queries.function.docvalues.BoolDocValues;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-
-
-	/// <summary>
-	/// <seealso cref="BoolFunction"/> implementation which applies an extendible boolean
-	/// function to the values of a single wrapped <seealso cref="ValueSource"/>.
-	/// 
-	/// Functions this can be used for include whether a field has a value or not,
-	/// or inverting the boolean value of the wrapped ValueSource.
-	/// </summary>
-	public abstract class SimpleBoolFunction : BoolFunction
-	{
-	  protected internal readonly ValueSource source;
-
-	  public SimpleBoolFunction(ValueSource source)
-	  {
-		this.source = source;
-	  }
-
-	  protected internal abstract string name();
-
-	  protected internal abstract bool func(int doc, FunctionValues vals);
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.docvalues.BoolDocValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override BoolDocValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
-		FunctionValues vals = source.getValues(context, readerContext);
-		return new BoolDocValuesAnonymousInnerClassHelper(this, this, vals);
-	  }
-
-	  private class BoolDocValuesAnonymousInnerClassHelper : BoolDocValues
-	  {
-		  private readonly SimpleBoolFunction outerInstance;
-
-		  private FunctionValues vals;
-
-		  public BoolDocValuesAnonymousInnerClassHelper(SimpleBoolFunction outerInstance, org.apache.lucene.queries.function.valuesource.SimpleBoolFunction this, FunctionValues vals) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.vals = vals;
-		  }
-
-		  public override bool boolVal(int doc)
-		  {
-			return outerInstance.func(doc, vals);
-		  }
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.name() + '(' + vals.ToString(doc) + ')';
-		  }
-	  }
-
-	  public override string description()
-	  {
-		return name() + '(' + source.description() + ')';
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return source.GetHashCode() + name().GetHashCode();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		SimpleBoolFunction other = (SimpleBoolFunction)o;
-		return this.source.Equals(other.source);
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		source.createWeight(context, searcher);
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/SimpleFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/SimpleFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/SimpleFloatFunction.cs
deleted file mode 100644
index 4cc6f29..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/SimpleFloatFunction.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using FloatDocValues = org.apache.lucene.queries.function.docvalues.FloatDocValues;
-
-
-	/// <summary>
-	/// A simple float function with a single argument
-	/// </summary>
-	 public abstract class SimpleFloatFunction : SingleFunction
-	 {
-	  public SimpleFloatFunction(ValueSource source) : base(source)
-	  {
-	  }
-
-	  protected internal abstract float func(int doc, FunctionValues vals);
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
-		FunctionValues vals = source.getValues(context, readerContext);
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly SimpleFloatFunction outerInstance;
-
-		  private FunctionValues vals;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(SimpleFloatFunction outerInstance, org.apache.lucene.queries.function.valuesource.SimpleFloatFunction this, FunctionValues vals) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.vals = vals;
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return outerInstance.func(doc, vals);
-		  }
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.name() + '(' + vals.ToString(doc) + ')';
-		  }
-	  }
-	 }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/SingleFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/SingleFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/SingleFunction.cs
deleted file mode 100644
index 15084be..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/SingleFunction.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-
-
-	/// <summary>
-	/// A function with a single argument
-	/// </summary>
-	 public abstract class SingleFunction : ValueSource
-	 {
-	  protected internal readonly ValueSource source;
-
-	  public SingleFunction(ValueSource source)
-	  {
-		this.source = source;
-	  }
-
-	  protected internal abstract string name();
-
-	  public override string description()
-	  {
-		return name() + '(' + source.description() + ')';
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return source.GetHashCode() + name().GetHashCode();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		SingleFunction other = (SingleFunction)o;
-		return this.name().Equals(other.name()) && this.source.Equals(other.source);
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		source.createWeight(context, searcher);
-	  }
-	 }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/SumFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/SumFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/SumFloatFunction.cs
deleted file mode 100644
index fcd3e41..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/SumFloatFunction.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	/// <summary>
-	/// <code>SumFloatFunction</code> returns the sum of it's components.
-	/// </summary>
-	public class SumFloatFunction : MultiFloatFunction
-	{
-	  public SumFloatFunction(ValueSource[] sources) : base(sources)
-	  {
-	  }
-
-	  protected internal override string name()
-	  {
-		return "sum";
-	  }
-
-	  protected internal override float func(int doc, FunctionValues[] valsArr)
-	  {
-		float val = 0.0f;
-		foreach (FunctionValues vals in valsArr)
-		{
-		  val += vals.floatVal(doc);
-		}
-		return val;
-	  }
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/SumTotalTermFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/SumTotalTermFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/SumTotalTermFreqValueSource.cs
deleted file mode 100644
index 48a9600..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/SumTotalTermFreqValueSource.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using Fields = org.apache.lucene.index.Fields;
-	using Terms = org.apache.lucene.index.Terms;
-	using LongDocValues = org.apache.lucene.queries.function.docvalues.LongDocValues;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-
-
-	/// <summary>
-	/// <code>SumTotalTermFreqValueSource</code> returns the number of tokens.
-	/// (sum of term freqs across all documents, across all terms).
-	/// Returns -1 if frequencies were omitted for the field, or if 
-	/// the codec doesn't support this statistic.
-	/// @lucene.internal
-	/// </summary>
-	public class SumTotalTermFreqValueSource : ValueSource
-	{
-	  protected internal readonly string indexedField;
-
-	  public SumTotalTermFreqValueSource(string indexedField)
-	  {
-		this.indexedField = indexedField;
-	  }
-
-	  public virtual string name()
-	  {
-		return "sumtotaltermfreq";
-	  }
-
-	  public override string description()
-	  {
-		return name() + '(' + indexedField + ')';
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		return (FunctionValues)context[this];
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		long sumTotalTermFreq = 0;
-		foreach (AtomicReaderContext readerContext in searcher.TopReaderContext.leaves())
-		{
-		  Fields fields = readerContext.reader().fields();
-		  if (fields == null)
-		  {
-			  continue;
-		  }
-		  Terms terms = fields.terms(indexedField);
-		  if (terms == null)
-		  {
-			  continue;
-		  }
-		  long v = terms.SumTotalTermFreq;
-		  if (v == -1)
-		  {
-			sumTotalTermFreq = -1;
-			break;
-		  }
-		  else
-		  {
-			sumTotalTermFreq += v;
-		  }
-		}
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final long ttf = sumTotalTermFreq;
-		long ttf = sumTotalTermFreq;
-		context[this] = new LongDocValuesAnonymousInnerClassHelper(this, this, ttf);
-	  }
-
-	  private class LongDocValuesAnonymousInnerClassHelper : LongDocValues
-	  {
-		  private readonly SumTotalTermFreqValueSource outerInstance;
-
-		  private long ttf;
-
-		  public LongDocValuesAnonymousInnerClassHelper(SumTotalTermFreqValueSource outerInstance, org.apache.lucene.queries.function.valuesource.SumTotalTermFreqValueSource this, long ttf) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.ttf = ttf;
-		  }
-
-		  public override long longVal(int doc)
-		  {
-			return ttf;
-		  }
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return this.GetType().GetHashCode() + indexedField.GetHashCode();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		SumTotalTermFreqValueSource other = (SumTotalTermFreqValueSource)o;
-		return this.indexedField.Equals(other.indexedField);
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/TFValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/TFValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/TFValueSource.cs
deleted file mode 100644
index e957cc8..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/TFValueSource.cs
+++ /dev/null
@@ -1,197 +0,0 @@
-using System;
-using System.Collections;
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using org.apache.lucene.index;
-	using FloatDocValues = org.apache.lucene.queries.function.docvalues.FloatDocValues;
-	using DocIdSetIterator = org.apache.lucene.search.DocIdSetIterator;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-	using TFIDFSimilarity = org.apache.lucene.search.similarities.TFIDFSimilarity;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-
-
-	/// <summary>
-	/// Function that returns <seealso cref="TFIDFSimilarity#tf(float)"/>
-	/// for every document.
-	/// <para>
-	/// Note that the configured Similarity for the field must be
-	/// a subclass of <seealso cref="TFIDFSimilarity"/>
-	/// @lucene.internal 
-	/// </para>
-	/// </summary>
-	public class TFValueSource : TermFreqValueSource
-	{
-	  public TFValueSource(string field, string val, string indexedField, BytesRef indexedBytes) : base(field, val, indexedField, indexedBytes)
-	  {
-	  }
-
-	  public override string name()
-	  {
-		return "tf";
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		Fields fields = readerContext.reader().fields();
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final Terms terms = fields.terms(indexedField);
-		Terms terms = fields.terms(indexedField);
-		IndexSearcher searcher = (IndexSearcher)context["searcher"];
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.similarities.TFIDFSimilarity similarity = IDFValueSource.asTFIDF(searcher.getSimilarity(), indexedField);
-		TFIDFSimilarity similarity = IDFValueSource.asTFIDF(searcher.Similarity, indexedField);
-		if (similarity == null)
-		{
-		  throw new System.NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)");
-		}
-
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, terms, similarity);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly TFValueSource outerInstance;
-
-		  private Terms terms;
-		  private TFIDFSimilarity similarity;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(TFValueSource outerInstance, org.apache.lucene.queries.function.valuesource.TFValueSource this, Terms terms, TFIDFSimilarity similarity) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.terms = terms;
-			  this.similarity = similarity;
-			  lastDocRequested = -1;
-		  }
-
-		  internal DocsEnum docs;
-		  internal int atDoc;
-		  internal int lastDocRequested;
-
-//JAVA TO C# CONVERTER TODO TASK: Initialization blocks declared within anonymous inner classes are not converted:
-	//	  {
-	//		  reset();
-	//	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public void reset() throws java.io.IOException
-		  public virtual void reset()
-		  {
-			// no one should call us for deleted docs?
-
-			if (terms != null)
-			{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final TermsEnum termsEnum = terms.iterator(null);
-			  TermsEnum termsEnum = terms.iterator(null);
-			  if (termsEnum.seekExact(outerInstance.indexedBytes))
-			  {
-				docs = termsEnum.docs(null, null);
-			  }
-			  else
-			  {
-				docs = null;
-			  }
-			}
-			else
-			{
-			  docs = null;
-			}
-
-			if (docs == null)
-			{
-			  docs = new DocsEnumAnonymousInnerClassHelper(this);
-			}
-			atDoc = -1;
-		  }
-
-		  private class DocsEnumAnonymousInnerClassHelper : DocsEnum
-		  {
-			  private readonly FloatDocValuesAnonymousInnerClassHelper outerInstance;
-
-			  public DocsEnumAnonymousInnerClassHelper(FloatDocValuesAnonymousInnerClassHelper outerInstance)
-			  {
-				  this.outerInstance = outerInstance;
-			  }
-
-			  public override int freq()
-			  {
-				return 0;
-			  }
-
-			  public override int docID()
-			  {
-				return DocIdSetIterator.NO_MORE_DOCS;
-			  }
-
-			  public override int nextDoc()
-			  {
-				return DocIdSetIterator.NO_MORE_DOCS;
-			  }
-
-			  public override int advance(int target)
-			  {
-				return DocIdSetIterator.NO_MORE_DOCS;
-			  }
-
-			  public override long cost()
-			  {
-				return 0;
-			  }
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			try
-			{
-			  if (doc < lastDocRequested)
-			  {
-				// out-of-order access.... reset
-				reset();
-			  }
-			  lastDocRequested = doc;
-
-			  if (atDoc < doc)
-			  {
-				atDoc = docs.advance(doc);
-			  }
-
-			  if (atDoc > doc)
-			  {
-				// term doesn't match this document... either because we hit the
-				// end, or because the next doc is after this doc.
-				return similarity.tf(0);
-			  }
-
-			  // a match!
-			  return similarity.tf(docs.freq());
-			}
-			catch (IOException e)
-			{
-			  throw new Exception("caught exception in function " + outerInstance.description() + " : doc=" + doc, e);
-			}
-		  }
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/TermFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/TermFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/TermFreqValueSource.cs
deleted file mode 100644
index 7e03f2b..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/TermFreqValueSource.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-using System;
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using org.apache.lucene.index;
-	using IntDocValues = org.apache.lucene.queries.function.docvalues.IntDocValues;
-	using DocIdSetIterator = org.apache.lucene.search.DocIdSetIterator;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-
-
-	/// <summary>
-	/// Function that returns <seealso cref="DocsEnum#freq()"/> for the
-	/// supplied term in every document.
-	/// <para>
-	/// If the term does not exist in the document, returns 0.
-	/// If frequencies are omitted, returns 1.
-	/// </para>
-	/// </summary>
-	public class TermFreqValueSource : DocFreqValueSource
-	{
-	  public TermFreqValueSource(string field, string val, string indexedField, BytesRef indexedBytes) : base(field, val, indexedField, indexedBytes)
-	  {
-	  }
-
-	  public override string name()
-	  {
-		return "termfreq";
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		Fields fields = readerContext.reader().fields();
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final Terms terms = fields.terms(indexedField);
-		Terms terms = fields.terms(indexedField);
-
-		return new IntDocValuesAnonymousInnerClassHelper(this, this, terms);
-	  }
-
-	  private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
-	  {
-		  private readonly TermFreqValueSource outerInstance;
-
-		  private Terms terms;
-
-		  public IntDocValuesAnonymousInnerClassHelper(TermFreqValueSource outerInstance, org.apache.lucene.queries.function.valuesource.TermFreqValueSource this, Terms terms) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.terms = terms;
-			  lastDocRequested = -1;
-		  }
-
-		  internal DocsEnum docs;
-		  internal int atDoc;
-		  internal int lastDocRequested;
-
-//JAVA TO C# CONVERTER TODO TASK: Initialization blocks declared within anonymous inner classes are not converted:
-	//	  {
-	//		  reset();
-	//	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public void reset() throws java.io.IOException
-		  public virtual void reset()
-		  {
-			// no one should call us for deleted docs?
-
-			if (terms != null)
-			{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final TermsEnum termsEnum = terms.iterator(null);
-			  TermsEnum termsEnum = terms.iterator(null);
-			  if (termsEnum.seekExact(outerInstance.indexedBytes))
-			  {
-				docs = termsEnum.docs(null, null);
-			  }
-			  else
-			  {
-				docs = null;
-			  }
-			}
-			else
-			{
-			  docs = null;
-			}
-
-			if (docs == null)
-			{
-			  docs = new DocsEnumAnonymousInnerClassHelper(this);
-			}
-			atDoc = -1;
-		  }
-
-		  private class DocsEnumAnonymousInnerClassHelper : DocsEnum
-		  {
-			  private readonly IntDocValuesAnonymousInnerClassHelper outerInstance;
-
-			  public DocsEnumAnonymousInnerClassHelper(IntDocValuesAnonymousInnerClassHelper outerInstance)
-			  {
-				  this.outerInstance = outerInstance;
-			  }
-
-			  public override int freq()
-			  {
-				return 0;
-			  }
-
-			  public override int docID()
-			  {
-				return DocIdSetIterator.NO_MORE_DOCS;
-			  }
-
-			  public override int nextDoc()
-			  {
-				return DocIdSetIterator.NO_MORE_DOCS;
-			  }
-
-			  public override int advance(int target)
-			  {
-				return DocIdSetIterator.NO_MORE_DOCS;
-			  }
-
-			  public override long cost()
-			  {
-				return 0;
-			  }
-		  }
-
-		  public override int intVal(int doc)
-		  {
-			try
-			{
-			  if (doc < lastDocRequested)
-			  {
-				// out-of-order access.... reset
-				reset();
-			  }
-			  lastDocRequested = doc;
-
-			  if (atDoc < doc)
-			  {
-				atDoc = docs.advance(doc);
-			  }
-
-			  if (atDoc > doc)
-			  {
-				// term doesn't match this document... either because we hit the
-				// end, or because the next doc is after this doc.
-				return 0;
-			  }
-
-			  // a match!
-			  return docs.freq();
-			}
-			catch (IOException e)
-			{
-			  throw new Exception("caught exception in function " + outerInstance.description() + " : doc=" + doc, e);
-			}
-		  }
-	  }
-	}
-
-
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/TotalTermFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/TotalTermFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/TotalTermFreqValueSource.cs
deleted file mode 100644
index 629d6c6..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/TotalTermFreqValueSource.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using Term = org.apache.lucene.index.Term;
-	using LongDocValues = org.apache.lucene.queries.function.docvalues.LongDocValues;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-
-
-	/// <summary>
-	/// <code>TotalTermFreqValueSource</code> returns the total term freq 
-	/// (sum of term freqs across all documents).
-	/// Returns -1 if frequencies were omitted for the field, or if 
-	/// the codec doesn't support this statistic.
-	/// @lucene.internal
-	/// </summary>
-	public class TotalTermFreqValueSource : ValueSource
-	{
-	  protected internal readonly string field;
-	  protected internal readonly string indexedField;
-	  protected internal readonly string val;
-	  protected internal readonly BytesRef indexedBytes;
-
-	  public TotalTermFreqValueSource(string field, string val, string indexedField, BytesRef indexedBytes)
-	  {
-		this.field = field;
-		this.val = val;
-		this.indexedField = indexedField;
-		this.indexedBytes = indexedBytes;
-	  }
-
-	  public virtual string name()
-	  {
-		return "totaltermfreq";
-	  }
-
-	  public override string description()
-	  {
-		return name() + '(' + field + ',' + val + ')';
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		return (FunctionValues)context[this];
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		long totalTermFreq = 0;
-		foreach (AtomicReaderContext readerContext in searcher.TopReaderContext.leaves())
-		{
-		  long val = readerContext.reader().totalTermFreq(new Term(indexedField, indexedBytes));
-		  if (val == -1)
-		  {
-			totalTermFreq = -1;
-			break;
-		  }
-		  else
-		  {
-			totalTermFreq += val;
-		  }
-		}
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final long ttf = totalTermFreq;
-		long ttf = totalTermFreq;
-		context[this] = new LongDocValuesAnonymousInnerClassHelper(this, this, ttf);
-	  }
-
-	  private class LongDocValuesAnonymousInnerClassHelper : LongDocValues
-	  {
-		  private readonly TotalTermFreqValueSource outerInstance;
-
-		  private long ttf;
-
-		  public LongDocValuesAnonymousInnerClassHelper(TotalTermFreqValueSource outerInstance, org.apache.lucene.queries.function.valuesource.TotalTermFreqValueSource this, long ttf) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.ttf = ttf;
-		  }
-
-		  public override long longVal(int doc)
-		  {
-			return ttf;
-		  }
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return this.GetType().GetHashCode() + indexedField.GetHashCode() * 29 + indexedBytes.GetHashCode();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		TotalTermFreqValueSource other = (TotalTermFreqValueSource)o;
-		return this.indexedField.Equals(other.indexedField) && this.indexedBytes.Equals(other.indexedBytes);
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/VectorValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/VectorValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/VectorValueSource.cs
deleted file mode 100644
index 2668ac2..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/VectorValueSource.cs
+++ /dev/null
@@ -1,293 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using System.Text;
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-
-
-
-	/// <summary>
-	/// Converts individual ValueSource instances to leverage the FunctionValues *Val functions that work with multiple values,
-	/// i.e. <seealso cref="org.apache.lucene.queries.function.FunctionValues#doubleVal(int, double[])"/>
-	/// </summary>
-	//Not crazy about the name, but...
-	public class VectorValueSource : MultiValueSource
-	{
-	  protected internal readonly IList<ValueSource> sources;
-
-
-	  public VectorValueSource(IList<ValueSource> sources)
-	  {
-		this.sources = sources;
-	  }
-
-	  public virtual IList<ValueSource> Sources
-	  {
-		  get
-		  {
-			return sources;
-		  }
-	  }
-
-	  public override int dimension()
-	  {
-		return sources.Count;
-	  }
-
-	  public virtual string name()
-	  {
-		return "vector";
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		int size = sources.Count;
-
-		// special-case x,y and lat,lon since it's so common
-		if (size == 2)
-		{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues x = sources.get(0).getValues(context, readerContext);
-		  FunctionValues x = sources[0].getValues(context, readerContext);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues y = sources.get(1).getValues(context, readerContext);
-		  FunctionValues y = sources[1].getValues(context, readerContext);
-		  return new FunctionValuesAnonymousInnerClassHelper(this, x, y);
-		}
-
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues[] valsArr = new org.apache.lucene.queries.function.FunctionValues[size];
-		FunctionValues[] valsArr = new FunctionValues[size];
-		for (int i = 0; i < size; i++)
-		{
-		  valsArr[i] = sources[i].getValues(context, readerContext);
-		}
-
-		return new FunctionValuesAnonymousInnerClassHelper2(this, valsArr);
-	  }
-
-	  private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
-	  {
-		  private readonly VectorValueSource outerInstance;
-
-		  private FunctionValues x;
-		  private FunctionValues y;
-
-		  public FunctionValuesAnonymousInnerClassHelper(VectorValueSource outerInstance, FunctionValues x, FunctionValues y)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.x = x;
-			  this.y = y;
-		  }
-
-		  public override void byteVal(int doc, sbyte[] vals)
-		  {
-			vals[0] = x.byteVal(doc);
-			vals[1] = y.byteVal(doc);
-		  }
-
-		  public override void shortVal(int doc, short[] vals)
-		  {
-			vals[0] = x.shortVal(doc);
-			vals[1] = y.shortVal(doc);
-		  }
-		  public override void intVal(int doc, int[] vals)
-		  {
-			vals[0] = x.intVal(doc);
-			vals[1] = y.intVal(doc);
-		  }
-		  public override void longVal(int doc, long[] vals)
-		  {
-			vals[0] = x.longVal(doc);
-			vals[1] = y.longVal(doc);
-		  }
-		  public override void floatVal(int doc, float[] vals)
-		  {
-			vals[0] = x.floatVal(doc);
-			vals[1] = y.floatVal(doc);
-		  }
-		  public override void doubleVal(int doc, double[] vals)
-		  {
-			vals[0] = x.doubleVal(doc);
-			vals[1] = y.doubleVal(doc);
-		  }
-		  public override void strVal(int doc, string[] vals)
-		  {
-			vals[0] = x.strVal(doc);
-			vals[1] = y.strVal(doc);
-		  }
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.name() + "(" + x.ToString(doc) + "," + y.ToString(doc) + ")";
-		  }
-	  }
-
-	  private class FunctionValuesAnonymousInnerClassHelper2 : FunctionValues
-	  {
-		  private readonly VectorValueSource outerInstance;
-
-		  private FunctionValues[] valsArr;
-
-		  public FunctionValuesAnonymousInnerClassHelper2(VectorValueSource outerInstance, FunctionValues[] valsArr)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.valsArr = valsArr;
-		  }
-
-		  public override void byteVal(int doc, sbyte[] vals)
-		  {
-			for (int i = 0; i < valsArr.Length; i++)
-			{
-			  vals[i] = valsArr[i].byteVal(doc);
-			}
-		  }
-
-		  public override void shortVal(int doc, short[] vals)
-		  {
-			for (int i = 0; i < valsArr.Length; i++)
-			{
-			  vals[i] = valsArr[i].shortVal(doc);
-			}
-		  }
-
-		  public override void floatVal(int doc, float[] vals)
-		  {
-			for (int i = 0; i < valsArr.Length; i++)
-			{
-			  vals[i] = valsArr[i].floatVal(doc);
-			}
-		  }
-
-		  public override void intVal(int doc, int[] vals)
-		  {
-			for (int i = 0; i < valsArr.Length; i++)
-			{
-			  vals[i] = valsArr[i].intVal(doc);
-			}
-		  }
-
-		  public override void longVal(int doc, long[] vals)
-		  {
-			for (int i = 0; i < valsArr.Length; i++)
-			{
-			  vals[i] = valsArr[i].longVal(doc);
-			}
-		  }
-
-		  public override void doubleVal(int doc, double[] vals)
-		  {
-			for (int i = 0; i < valsArr.Length; i++)
-			{
-			  vals[i] = valsArr[i].doubleVal(doc);
-			}
-		  }
-
-		  public override void strVal(int doc, string[] vals)
-		  {
-			for (int i = 0; i < valsArr.Length; i++)
-			{
-			  vals[i] = valsArr[i].strVal(doc);
-			}
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			StringBuilder sb = new StringBuilder();
-			sb.Append(outerInstance.name()).Append('(');
-			bool firstTime = true;
-			foreach (FunctionValues vals in valsArr)
-			{
-			  if (firstTime)
-			  {
-				firstTime = false;
-			  }
-			  else
-			  {
-				sb.Append(',');
-			  }
-			  sb.Append(vals.ToString(doc));
-			}
-			sb.Append(')');
-			return sb.ToString();
-		  }
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		foreach (ValueSource source in sources)
-		{
-		  source.createWeight(context, searcher);
-		}
-	  }
-
-
-	  public override string description()
-	  {
-		StringBuilder sb = new StringBuilder();
-		sb.Append(name()).Append('(');
-		bool firstTime = true;
-		foreach (ValueSource source in sources)
-		{
-		  if (firstTime)
-		  {
-			firstTime = false;
-		  }
-		  else
-		  {
-			sb.Append(',');
-		  }
-		  sb.Append(source);
-		}
-		sb.Append(")");
-		return sb.ToString();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this == o)
-		{
-			return true;
-		}
-		if (!(o is VectorValueSource))
-		{
-			return false;
-		}
-
-		VectorValueSource that = (VectorValueSource) o;
-
-		return sources.Equals(that.sources);
-
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return sources.GetHashCode();
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/BoolFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/BoolFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/BoolFunction.cs
new file mode 100644
index 0000000..9a2fab7
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/BoolFunction.cs
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+
+	/// <summary>
+	/// Abstract parent class for those <seealso cref="ValueSource"/> implementations which
+	/// apply boolean logic to their values
+	/// </summary>
+	public abstract class BoolFunction : ValueSource
+	{
+	  // TODO: placeholder to return type, among other common future functionality
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs
new file mode 100644
index 0000000..b0ad08a
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs
@@ -0,0 +1,138 @@
+using System;
+using System.Collections;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+	/*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+    /// <summary>
+	/// Obtains int field values from the <seealso cref="org.apache.lucene.search.FieldCache"/>
+	/// using <code>getInts()</code>
+	/// and makes those values available as other numeric types, casting as needed. *
+	/// 
+	/// 
+	/// </summary>
+	[Obsolete]
+	public class ByteFieldSource : FieldCacheSource
+	{
+
+	  private readonly FieldCache.ByteParser parser;
+
+	  public ByteFieldSource(string field) : this(field, null)
+	  {
+	  }
+
+	  public ByteFieldSource(string field, FieldCache.ByteParser parser) : base(field)
+	  {
+		this.parser = parser;
+	  }
+
+	  public override string description()
+	  {
+		return "byte(" + field + ')';
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Bytes arr = cache.getBytes(readerContext.reader(), field, parser, false);
+		FieldCache.Bytes arr = cache.getBytes(readerContext.reader(), field, parser, false);
+
+		return new FunctionValuesAnonymousInnerClassHelper(this, arr);
+	  }
+
+	  private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
+	  {
+		  private readonly ByteFieldSource outerInstance;
+
+		  private FieldCache.Bytes arr;
+
+		  public FunctionValuesAnonymousInnerClassHelper(ByteFieldSource outerInstance, FieldCache.Bytes arr)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.arr = arr;
+		  }
+
+		  public override sbyte byteVal(int doc)
+		  {
+			return arr.get(doc);
+		  }
+
+		  public override short shortVal(int doc)
+		  {
+			return (short) arr.get(doc);
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return (float) arr.get(doc);
+		  }
+
+		  public override int intVal(int doc)
+		  {
+			return (int) arr.get(doc);
+		  }
+
+		  public override long longVal(int doc)
+		  {
+			return (long) arr.get(doc);
+		  }
+
+		  public override double doubleVal(int doc)
+		  {
+			return (double) arr.get(doc);
+		  }
+
+		  public override string strVal(int doc)
+		  {
+			return Convert.ToString(arr.get(doc));
+		  }
+
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.description() + '=' + byteVal(doc);
+		  }
+
+		  public override object objectVal(int doc)
+		  {
+			return arr.get(doc); // TODO: valid?
+		  }
+
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (o.GetType() != typeof(ByteFieldSource))
+		{
+			return false;
+		}
+		ByteFieldSource other = (ByteFieldSource) o;
+		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int h = parser == null ? typeof(sbyte?).GetHashCode() : parser.GetType().GetHashCode();
+		h += base.GetHashCode();
+		return h;
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/BytesRefFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/BytesRefFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/BytesRefFieldSource.cs
new file mode 100644
index 0000000..625ac5b
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/BytesRefFieldSource.cs
@@ -0,0 +1,131 @@
+using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+
+	/*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+    /// <summary>
+	/// An implementation for retrieving <seealso cref="FunctionValues"/> instances for string based fields.
+	/// </summary>
+	public class BytesRefFieldSource : FieldCacheSource
+	{
+
+	  public BytesRefFieldSource(string field) : base(field)
+	  {
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.index.FieldInfo fieldInfo = readerContext.reader().getFieldInfos().fieldInfo(field);
+		FieldInfo fieldInfo = readerContext.reader().FieldInfos.fieldInfo(field);
+		// To be sorted or not to be sorted, that is the question
+		// TODO: do it cleaner?
+		if (fieldInfo != null && fieldInfo.DocValuesType == FieldInfo.DocValuesType.BINARY)
+		{
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.index.BinaryDocValues binaryValues = org.apache.lucene.search.FieldCache.DEFAULT.getTerms(readerContext.reader(), field, true);
+		  BinaryDocValues binaryValues = FieldCache.DEFAULT.getTerms(readerContext.reader(), field, true);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.util.Bits docsWithField = org.apache.lucene.search.FieldCache.DEFAULT.getDocsWithField(readerContext.reader(), field);
+		  Bits docsWithField = FieldCache.DEFAULT.getDocsWithField(readerContext.reader(), field);
+		  return new FunctionValuesAnonymousInnerClassHelper(this, binaryValues, docsWithField);
+		}
+		else
+		{
+		  return new DocTermsIndexDocValuesAnonymousInnerClassHelper(this, this, readerContext, field);
+		}
+	  }
+
+	  private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
+	  {
+		  private readonly BytesRefFieldSource outerInstance;
+
+		  private BinaryDocValues binaryValues;
+		  private Bits docsWithField;
+
+		  public FunctionValuesAnonymousInnerClassHelper(BytesRefFieldSource outerInstance, BinaryDocValues binaryValues, Bits docsWithField)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.binaryValues = binaryValues;
+			  this.docsWithField = docsWithField;
+		  }
+
+
+		  public override bool exists(int doc)
+		  {
+			return docsWithField.get(doc);
+		  }
+
+		  public override bool bytesVal(int doc, BytesRef target)
+		  {
+			binaryValues.get(doc, target);
+			return target.length > 0;
+		  }
+
+		  public override string strVal(int doc)
+		  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.util.BytesRef bytes = new org.apache.lucene.util.BytesRef();
+			BytesRef bytes = new BytesRef();
+			return bytesVal(doc, bytes) ? bytes.utf8ToString() : null;
+		  }
+
+		  public override object objectVal(int doc)
+		  {
+			return strVal(doc);
+		  }
+
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.description() + '=' + strVal(doc);
+		  }
+	  }
+
+	  private class DocTermsIndexDocValuesAnonymousInnerClassHelper : DocTermsIndexDocValues
+	  {
+		  private readonly BytesRefFieldSource outerInstance;
+
+		  public DocTermsIndexDocValuesAnonymousInnerClassHelper(BytesRefFieldSource outerInstance, BytesRefFieldSource this, AtomicReaderContext readerContext, string field) : base(this, readerContext, field)
+		  {
+			  this.outerInstance = outerInstance;
+		  }
+
+
+		  protected internal override string toTerm(string readableValue)
+		  {
+			return readableValue;
+		  }
+
+		  public override object objectVal(int doc)
+		  {
+			return strVal(doc);
+		  }
+
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.description() + '=' + strVal(doc);
+		  }
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs
new file mode 100644
index 0000000..cadbbce
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+
+	/// <summary>
+	/// <code>ConstNumberSource</code> is the base class for all constant numbers
+	/// </summary>
+	public abstract class ConstNumberSource : ValueSource
+	{
+	  public abstract int Int {get;}
+	  public abstract long Long {get;}
+	  public abstract float Float {get;}
+	  public abstract double Double {get;}
+	  public abstract Number Number {get;}
+	  public abstract bool Bool {get;}
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs
new file mode 100644
index 0000000..79a751c
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// <code>ConstValueSource</code> returns a constant for all documents
+	/// </summary>
+	public class ConstValueSource : ConstNumberSource
+	{
+	  internal readonly float constant;
+	  private readonly double dv;
+
+	  public ConstValueSource(float constant)
+	  {
+		this.constant = constant;
+		this.dv = constant;
+	  }
+
+	  public override string description()
+	  {
+		return "const(" + constant + ")";
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		return new FloatDocValuesAnonymousInnerClassHelper(this, this);
+	  }
+
+	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+	  {
+		  private readonly ConstValueSource outerInstance;
+
+		  public FloatDocValuesAnonymousInnerClassHelper(ConstValueSource outerInstance, ConstValueSource this) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return outerInstance.constant;
+		  }
+		  public override int intVal(int doc)
+		  {
+			return (int)outerInstance.constant;
+		  }
+		  public override long longVal(int doc)
+		  {
+			return (long)outerInstance.constant;
+		  }
+		  public override double doubleVal(int doc)
+		  {
+			return outerInstance.dv;
+		  }
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.description();
+		  }
+		  public override object objectVal(int doc)
+		  {
+			return outerInstance.constant;
+		  }
+		  public override bool boolVal(int doc)
+		  {
+			return outerInstance.constant != 0.0f;
+		  }
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return float.floatToIntBits(constant) * 31;
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (!(o is ConstValueSource))
+		{
+			return false;
+		}
+		ConstValueSource other = (ConstValueSource)o;
+		return this.constant == other.constant;
+	  }
+
+	  public override int Int
+	  {
+		  get
+		  {
+			return (int)constant;
+		  }
+	  }
+
+	  public override long Long
+	  {
+		  get
+		  {
+			return (long)constant;
+		  }
+	  }
+
+	  public override float Float
+	  {
+		  get
+		  {
+			return constant;
+		  }
+	  }
+
+	  public override double Double
+	  {
+		  get
+		  {
+			return dv;
+		  }
+	  }
+
+	  public override Number Number
+	  {
+		  get
+		  {
+			return constant;
+		  }
+	  }
+
+	  public override bool Bool
+	  {
+		  get
+		  {
+			return constant != 0.0f;
+		  }
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/DefFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DefFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/DefFunction.cs
new file mode 100644
index 0000000..05910e5
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DefFunction.cs
@@ -0,0 +1,148 @@
+using System.Collections;
+using System.Collections.Generic;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+	/*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+    /// <summary>
+	/// <seealso cref="ValueSource"/> implementation which only returns the values from the provided
+	/// ValueSources which are available for a particular docId.  Consequently, when combined
+	/// with a <seealso cref="ConstValueSource"/>, this function serves as a way to return a default
+	/// value when the values for a field are unavailable.
+	/// </summary>
+	public class DefFunction : MultiFunction
+	{
+	  public DefFunction(IList<ValueSource> sources) : base(sources)
+	  {
+	  }
+
+	  protected internal override string name()
+	  {
+		return "def";
+	  }
+
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map fcontext, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary fcontext, AtomicReaderContext readerContext)
+	  {
+
+
+		return new ValuesAnonymousInnerClassHelper(this, valsArr(sources, fcontext, readerContext));
+	  }
+
+	  private class ValuesAnonymousInnerClassHelper : Values
+	  {
+		  private readonly DefFunction outerInstance;
+
+		  public ValuesAnonymousInnerClassHelper(DefFunction outerInstance, FunctionValues[] valsArr) : base(outerInstance, valsArr)
+		  {
+			  this.outerInstance = outerInstance;
+			  upto = valsArr.Length - 1;
+		  }
+
+		  internal readonly int upto;
+
+		  private FunctionValues get(int doc)
+		  {
+			for (int i = 0; i < upto; i++)
+			{
+			  FunctionValues vals = valsArr[i];
+			  if (vals.exists(doc))
+			  {
+				return vals;
+			  }
+			}
+			return valsArr[upto];
+		  }
+
+		  public override sbyte byteVal(int doc)
+		  {
+			return get(doc).byteVal(doc);
+		  }
+
+		  public override short shortVal(int doc)
+		  {
+			return get(doc).shortVal(doc);
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return get(doc).floatVal(doc);
+		  }
+
+		  public override int intVal(int doc)
+		  {
+			return get(doc).intVal(doc);
+		  }
+
+		  public override long longVal(int doc)
+		  {
+			return get(doc).longVal(doc);
+		  }
+
+		  public override double doubleVal(int doc)
+		  {
+			return get(doc).doubleVal(doc);
+		  }
+
+		  public override string strVal(int doc)
+		  {
+			return get(doc).strVal(doc);
+		  }
+
+		  public override bool boolVal(int doc)
+		  {
+			return get(doc).boolVal(doc);
+		  }
+
+		  public override bool bytesVal(int doc, BytesRef target)
+		  {
+			return get(doc).bytesVal(doc, target);
+		  }
+
+		  public override object objectVal(int doc)
+		  {
+			return get(doc).objectVal(doc);
+		  }
+
+		  public override bool exists(int doc)
+		  {
+			// return true if any source is exists?
+			foreach (FunctionValues vals in valsArr)
+			{
+			  if (vals.exists(doc))
+			  {
+				return true;
+			  }
+			}
+			return false;
+		  }
+
+		  public override ValueFiller ValueFiller
+		  {
+			  get
+			  {
+				// TODO: need ValueSource.type() to determine correct type
+				return base.ValueFiller;
+			  }
+		  }
+	  }
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/DivFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DivFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/DivFloatFunction.cs
new file mode 100644
index 0000000..ff1b0b3
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DivFloatFunction.cs
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+
+
+	/// <summary>
+	/// Function to divide "a" by "b"
+	/// </summary>
+	public class DivFloatFunction : DualFloatFunction
+	{
+	 /// <param name="a">  the numerator. </param>
+	 /// <param name="b">  the denominator. </param>
+	  public DivFloatFunction(ValueSource a, ValueSource b) : base(a,b)
+	  {
+	  }
+
+	  protected internal override string name()
+	  {
+		return "div";
+	  }
+
+	  protected internal override float func(int doc, FunctionValues aVals, FunctionValues bVals)
+	  {
+		return aVals.floatVal(doc) / bVals.floatVal(doc);
+	  }
+	}
+
+}
\ No newline at end of file


[08/21] Moving ValueSource -> ValueSources to avoid name conflicts

Posted by sy...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs
new file mode 100644
index 0000000..df6be4c
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs
@@ -0,0 +1,190 @@
+using System;
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+
+	/*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+    /// <summary>
+	/// Function that returns <seealso cref="TFIDFSimilarity#tf(float)"/>
+	/// for every document.
+	/// <para>
+	/// Note that the configured Similarity for the field must be
+	/// a subclass of <seealso cref="TFIDFSimilarity"/>
+	/// @lucene.internal 
+	/// </para>
+	/// </summary>
+	public class TFValueSource : TermFreqValueSource
+	{
+	  public TFValueSource(string field, string val, string indexedField, BytesRef indexedBytes) : base(field, val, indexedField, indexedBytes)
+	  {
+	  }
+
+	  public override string name()
+	  {
+		return "tf";
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		Fields fields = readerContext.reader().fields();
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final Terms terms = fields.terms(indexedField);
+		Terms terms = fields.terms(indexedField);
+		IndexSearcher searcher = (IndexSearcher)context["searcher"];
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.search.similarities.TFIDFSimilarity similarity = IDFValueSource.asTFIDF(searcher.getSimilarity(), indexedField);
+		TFIDFSimilarity similarity = IDFValueSource.asTFIDF(searcher.Similarity, indexedField);
+		if (similarity == null)
+		{
+		  throw new System.NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)");
+		}
+
+		return new FloatDocValuesAnonymousInnerClassHelper(this, this, terms, similarity);
+	  }
+
+	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+	  {
+		  private readonly TFValueSource outerInstance;
+
+		  private Terms terms;
+		  private TFIDFSimilarity similarity;
+
+		  public FloatDocValuesAnonymousInnerClassHelper(TFValueSource outerInstance, TFValueSource this, Terms terms, TFIDFSimilarity similarity) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.terms = terms;
+			  this.similarity = similarity;
+			  lastDocRequested = -1;
+		  }
+
+		  internal DocsEnum docs;
+		  internal int atDoc;
+		  internal int lastDocRequested;
+
+//JAVA TO C# CONVERTER TODO TASK: Initialization blocks declared within anonymous inner classes are not converted:
+	//	  {
+	//		  reset();
+	//	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public void reset() throws java.io.IOException
+		  public virtual void reset()
+		  {
+			// no one should call us for deleted docs?
+
+			if (terms != null)
+			{
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final TermsEnum termsEnum = terms.iterator(null);
+			  TermsEnum termsEnum = terms.iterator(null);
+			  if (termsEnum.seekExact(outerInstance.indexedBytes))
+			  {
+				docs = termsEnum.docs(null, null);
+			  }
+			  else
+			  {
+				docs = null;
+			  }
+			}
+			else
+			{
+			  docs = null;
+			}
+
+			if (docs == null)
+			{
+			  docs = new DocsEnumAnonymousInnerClassHelper(this);
+			}
+			atDoc = -1;
+		  }
+
+		  private class DocsEnumAnonymousInnerClassHelper : DocsEnum
+		  {
+			  private readonly FloatDocValuesAnonymousInnerClassHelper outerInstance;
+
+			  public DocsEnumAnonymousInnerClassHelper(FloatDocValuesAnonymousInnerClassHelper outerInstance)
+			  {
+				  this.outerInstance = outerInstance;
+			  }
+
+			  public override int freq()
+			  {
+				return 0;
+			  }
+
+			  public override int docID()
+			  {
+				return DocIdSetIterator.NO_MORE_DOCS;
+			  }
+
+			  public override int nextDoc()
+			  {
+				return DocIdSetIterator.NO_MORE_DOCS;
+			  }
+
+			  public override int advance(int target)
+			  {
+				return DocIdSetIterator.NO_MORE_DOCS;
+			  }
+
+			  public override long cost()
+			  {
+				return 0;
+			  }
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			try
+			{
+			  if (doc < lastDocRequested)
+			  {
+				// out-of-order access.... reset
+				reset();
+			  }
+			  lastDocRequested = doc;
+
+			  if (atDoc < doc)
+			  {
+				atDoc = docs.advance(doc);
+			  }
+
+			  if (atDoc > doc)
+			  {
+				// term doesn't match this document... either because we hit the
+				// end, or because the next doc is after this doc.
+				return similarity.tf(0);
+			  }
+
+			  // a match!
+			  return similarity.tf(docs.freq());
+			}
+			catch (IOException e)
+			{
+			  throw new Exception("caught exception in function " + outerInstance.description() + " : doc=" + doc, e);
+			}
+		  }
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/TermFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/TermFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/TermFreqValueSource.cs
new file mode 100644
index 0000000..3a70309
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/TermFreqValueSource.cs
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Function that returns <seealso cref="DocsEnum#freq()"/> for the
+	/// supplied term in every document.
+	/// <para>
+	/// If the term does not exist in the document, returns 0.
+	/// If frequencies are omitted, returns 1.
+	/// </para>
+	/// </summary>
+	public class TermFreqValueSource : DocFreqValueSource
+	{
+	  public TermFreqValueSource(string field, string val, string indexedField, BytesRef indexedBytes) : base(field, val, indexedField, indexedBytes)
+	  {
+	  }
+
+	  public override string name()
+	  {
+		return "termfreq";
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		Fields fields = readerContext.reader().fields();
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final Terms terms = fields.terms(indexedField);
+		Terms terms = fields.terms(indexedField);
+
+		return new IntDocValuesAnonymousInnerClassHelper(this, this, terms);
+	  }
+
+	  private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
+	  {
+		  private readonly TermFreqValueSource outerInstance;
+
+		  private Terms terms;
+
+		  public IntDocValuesAnonymousInnerClassHelper(TermFreqValueSource outerInstance, TermFreqValueSource this, Terms terms) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.terms = terms;
+			  lastDocRequested = -1;
+		  }
+
+		  internal DocsEnum docs;
+		  internal int atDoc;
+		  internal int lastDocRequested;
+
+//JAVA TO C# CONVERTER TODO TASK: Initialization blocks declared within anonymous inner classes are not converted:
+	//	  {
+	//		  reset();
+	//	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public void reset() throws java.io.IOException
+		  public virtual void reset()
+		  {
+			// no one should call us for deleted docs?
+
+			if (terms != null)
+			{
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final TermsEnum termsEnum = terms.iterator(null);
+			  TermsEnum termsEnum = terms.iterator(null);
+			  if (termsEnum.seekExact(outerInstance.indexedBytes))
+			  {
+				docs = termsEnum.docs(null, null);
+			  }
+			  else
+			  {
+				docs = null;
+			  }
+			}
+			else
+			{
+			  docs = null;
+			}
+
+			if (docs == null)
+			{
+			  docs = new DocsEnumAnonymousInnerClassHelper(this);
+			}
+			atDoc = -1;
+		  }
+
+		  private class DocsEnumAnonymousInnerClassHelper : DocsEnum
+		  {
+			  private readonly IntDocValuesAnonymousInnerClassHelper outerInstance;
+
+			  public DocsEnumAnonymousInnerClassHelper(IntDocValuesAnonymousInnerClassHelper outerInstance)
+			  {
+				  this.outerInstance = outerInstance;
+			  }
+
+			  public override int freq()
+			  {
+				return 0;
+			  }
+
+			  public override int docID()
+			  {
+				return DocIdSetIterator.NO_MORE_DOCS;
+			  }
+
+			  public override int nextDoc()
+			  {
+				return DocIdSetIterator.NO_MORE_DOCS;
+			  }
+
+			  public override int advance(int target)
+			  {
+				return DocIdSetIterator.NO_MORE_DOCS;
+			  }
+
+			  public override long cost()
+			  {
+				return 0;
+			  }
+		  }
+
+		  public override int intVal(int doc)
+		  {
+			try
+			{
+			  if (doc < lastDocRequested)
+			  {
+				// out-of-order access.... reset
+				reset();
+			  }
+			  lastDocRequested = doc;
+
+			  if (atDoc < doc)
+			  {
+				atDoc = docs.advance(doc);
+			  }
+
+			  if (atDoc > doc)
+			  {
+				// term doesn't match this document... either because we hit the
+				// end, or because the next doc is after this doc.
+				return 0;
+			  }
+
+			  // a match!
+			  return docs.freq();
+			}
+			catch (IOException e)
+			{
+			  throw new Exception("caught exception in function " + outerInstance.description() + " : doc=" + doc, e);
+			}
+		  }
+	  }
+	}
+
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs
new file mode 100644
index 0000000..24a5684
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// <code>TotalTermFreqValueSource</code> returns the total term freq 
+	/// (sum of term freqs across all documents).
+	/// Returns -1 if frequencies were omitted for the field, or if 
+	/// the codec doesn't support this statistic.
+	/// @lucene.internal
+	/// </summary>
+	public class TotalTermFreqValueSource : ValueSource
+	{
+	  protected internal readonly string field;
+	  protected internal readonly string indexedField;
+	  protected internal readonly string val;
+	  protected internal readonly BytesRef indexedBytes;
+
+	  public TotalTermFreqValueSource(string field, string val, string indexedField, BytesRef indexedBytes)
+	  {
+		this.field = field;
+		this.val = val;
+		this.indexedField = indexedField;
+		this.indexedBytes = indexedBytes;
+	  }
+
+	  public virtual string name()
+	  {
+		return "totaltermfreq";
+	  }
+
+	  public override string description()
+	  {
+		return name() + '(' + field + ',' + val + ')';
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		return (FunctionValues)context[this];
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		long totalTermFreq = 0;
+		foreach (AtomicReaderContext readerContext in searcher.TopReaderContext.leaves())
+		{
+		  long val = readerContext.reader().totalTermFreq(new Term(indexedField, indexedBytes));
+		  if (val == -1)
+		  {
+			totalTermFreq = -1;
+			break;
+		  }
+		  else
+		  {
+			totalTermFreq += val;
+		  }
+		}
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final long ttf = totalTermFreq;
+		long ttf = totalTermFreq;
+		context[this] = new LongDocValuesAnonymousInnerClassHelper(this, this, ttf);
+	  }
+
+	  private class LongDocValuesAnonymousInnerClassHelper : LongDocValues
+	  {
+		  private readonly TotalTermFreqValueSource outerInstance;
+
+		  private long ttf;
+
+		  public LongDocValuesAnonymousInnerClassHelper(TotalTermFreqValueSource outerInstance, TotalTermFreqValueSource this, long ttf) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.ttf = ttf;
+		  }
+
+		  public override long longVal(int doc)
+		  {
+			return ttf;
+		  }
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return this.GetType().GetHashCode() + indexedField.GetHashCode() * 29 + indexedBytes.GetHashCode();
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this.GetType() != o.GetType())
+		{
+			return false;
+		}
+		TotalTermFreqValueSource other = (TotalTermFreqValueSource)o;
+		return this.indexedField.Equals(other.indexedField) && this.indexedBytes.Equals(other.indexedBytes);
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs
new file mode 100644
index 0000000..683e5df
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs
@@ -0,0 +1,288 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+	/*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+    /// <summary>
+	/// Converts individual ValueSource instances to leverage the FunctionValues *Val functions that work with multiple values,
+	/// i.e. <seealso cref="org.apache.lucene.queries.function.FunctionValues#doubleVal(int, double[])"/>
+	/// </summary>
+	//Not crazy about the name, but...
+	public class VectorValueSource : MultiValueSource
+	{
+	  protected internal readonly IList<ValueSource> sources;
+
+
+	  public VectorValueSource(IList<ValueSource> sources)
+	  {
+		this.sources = sources;
+	  }
+
+	  public virtual IList<ValueSource> Sources
+	  {
+		  get
+		  {
+			return sources;
+		  }
+	  }
+
+	  public override int dimension()
+	  {
+		return sources.Count;
+	  }
+
+	  public virtual string name()
+	  {
+		return "vector";
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		int size = sources.Count;
+
+		// special-case x,y and lat,lon since it's so common
+		if (size == 2)
+		{
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues x = sources.get(0).getValues(context, readerContext);
+		  FunctionValues x = sources[0].getValues(context, readerContext);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues y = sources.get(1).getValues(context, readerContext);
+		  FunctionValues y = sources[1].getValues(context, readerContext);
+		  return new FunctionValuesAnonymousInnerClassHelper(this, x, y);
+		}
+
+
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues[] valsArr = new org.apache.lucene.queries.function.FunctionValues[size];
+		FunctionValues[] valsArr = new FunctionValues[size];
+		for (int i = 0; i < size; i++)
+		{
+		  valsArr[i] = sources[i].getValues(context, readerContext);
+		}
+
+		return new FunctionValuesAnonymousInnerClassHelper2(this, valsArr);
+	  }
+
+	  private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
+	  {
+		  private readonly VectorValueSource outerInstance;
+
+		  private FunctionValues x;
+		  private FunctionValues y;
+
+		  public FunctionValuesAnonymousInnerClassHelper(VectorValueSource outerInstance, FunctionValues x, FunctionValues y)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.x = x;
+			  this.y = y;
+		  }
+
+		  public override void byteVal(int doc, sbyte[] vals)
+		  {
+			vals[0] = x.byteVal(doc);
+			vals[1] = y.byteVal(doc);
+		  }
+
+		  public override void shortVal(int doc, short[] vals)
+		  {
+			vals[0] = x.shortVal(doc);
+			vals[1] = y.shortVal(doc);
+		  }
+		  public override void intVal(int doc, int[] vals)
+		  {
+			vals[0] = x.intVal(doc);
+			vals[1] = y.intVal(doc);
+		  }
+		  public override void longVal(int doc, long[] vals)
+		  {
+			vals[0] = x.longVal(doc);
+			vals[1] = y.longVal(doc);
+		  }
+		  public override void floatVal(int doc, float[] vals)
+		  {
+			vals[0] = x.floatVal(doc);
+			vals[1] = y.floatVal(doc);
+		  }
+		  public override void doubleVal(int doc, double[] vals)
+		  {
+			vals[0] = x.doubleVal(doc);
+			vals[1] = y.doubleVal(doc);
+		  }
+		  public override void strVal(int doc, string[] vals)
+		  {
+			vals[0] = x.strVal(doc);
+			vals[1] = y.strVal(doc);
+		  }
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.name() + "(" + x.ToString(doc) + "," + y.ToString(doc) + ")";
+		  }
+	  }
+
+	  private class FunctionValuesAnonymousInnerClassHelper2 : FunctionValues
+	  {
+		  private readonly VectorValueSource outerInstance;
+
+		  private FunctionValues[] valsArr;
+
+		  public FunctionValuesAnonymousInnerClassHelper2(VectorValueSource outerInstance, FunctionValues[] valsArr)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.valsArr = valsArr;
+		  }
+
+		  public override void byteVal(int doc, sbyte[] vals)
+		  {
+			for (int i = 0; i < valsArr.Length; i++)
+			{
+			  vals[i] = valsArr[i].byteVal(doc);
+			}
+		  }
+
+		  public override void shortVal(int doc, short[] vals)
+		  {
+			for (int i = 0; i < valsArr.Length; i++)
+			{
+			  vals[i] = valsArr[i].shortVal(doc);
+			}
+		  }
+
+		  public override void floatVal(int doc, float[] vals)
+		  {
+			for (int i = 0; i < valsArr.Length; i++)
+			{
+			  vals[i] = valsArr[i].floatVal(doc);
+			}
+		  }
+
+		  public override void intVal(int doc, int[] vals)
+		  {
+			for (int i = 0; i < valsArr.Length; i++)
+			{
+			  vals[i] = valsArr[i].intVal(doc);
+			}
+		  }
+
+		  public override void longVal(int doc, long[] vals)
+		  {
+			for (int i = 0; i < valsArr.Length; i++)
+			{
+			  vals[i] = valsArr[i].longVal(doc);
+			}
+		  }
+
+		  public override void doubleVal(int doc, double[] vals)
+		  {
+			for (int i = 0; i < valsArr.Length; i++)
+			{
+			  vals[i] = valsArr[i].doubleVal(doc);
+			}
+		  }
+
+		  public override void strVal(int doc, string[] vals)
+		  {
+			for (int i = 0; i < valsArr.Length; i++)
+			{
+			  vals[i] = valsArr[i].strVal(doc);
+			}
+		  }
+
+		  public override string ToString(int doc)
+		  {
+			StringBuilder sb = new StringBuilder();
+			sb.Append(outerInstance.name()).Append('(');
+			bool firstTime = true;
+			foreach (FunctionValues vals in valsArr)
+			{
+			  if (firstTime)
+			  {
+				firstTime = false;
+			  }
+			  else
+			  {
+				sb.Append(',');
+			  }
+			  sb.Append(vals.ToString(doc));
+			}
+			sb.Append(')');
+			return sb.ToString();
+		  }
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		foreach (ValueSource source in sources)
+		{
+		  source.createWeight(context, searcher);
+		}
+	  }
+
+
+	  public override string description()
+	  {
+		StringBuilder sb = new StringBuilder();
+		sb.Append(name()).Append('(');
+		bool firstTime = true;
+		foreach (ValueSource source in sources)
+		{
+		  if (firstTime)
+		  {
+			firstTime = false;
+		  }
+		  else
+		  {
+			sb.Append(',');
+		  }
+		  sb.Append(source);
+		}
+		sb.Append(")");
+		return sb.ToString();
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this == o)
+		{
+			return true;
+		}
+		if (!(o is VectorValueSource))
+		{
+			return false;
+		}
+
+		VectorValueSource that = (VectorValueSource) o;
+
+		return sources.Equals(that.sources);
+
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return sources.GetHashCode();
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj b/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
index 6856c74..9818bc3 100644
--- a/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
+++ b/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
@@ -58,54 +58,54 @@
     <Compile Include="Function\FunctionValues.cs" />
     <Compile Include="Function\ValueSource.cs" />
     <Compile Include="Function\ValueSourceScorer.cs" />
-    <Compile Include="Function\ValueSource\BoolFunction.cs" />
-    <Compile Include="Function\ValueSource\ByteFieldSource.cs" />
-    <Compile Include="Function\ValueSource\BytesRefFieldSource.cs" />
-    <Compile Include="Function\ValueSource\ConstNumberSource.cs" />
-    <Compile Include="Function\ValueSource\ConstValueSource.cs" />
-    <Compile Include="Function\ValueSource\DefFunction.cs" />
-    <Compile Include="Function\ValueSource\DivFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\DocFreqValueSource.cs" />
-    <Compile Include="Function\ValueSource\DoubleConstValueSource.cs" />
-    <Compile Include="Function\ValueSource\DoubleFieldSource.cs" />
-    <Compile Include="Function\ValueSource\DualFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\EnumFieldSource.cs" />
-    <Compile Include="Function\ValueSource\FieldCacheSource.cs" />
-    <Compile Include="Function\ValueSource\FloatFieldSource.cs" />
-    <Compile Include="Function\ValueSource\IDFValueSource.cs" />
-    <Compile Include="Function\ValueSource\IfFunction.cs" />
-    <Compile Include="Function\ValueSource\IntFieldSource.cs" />
-    <Compile Include="Function\ValueSource\JoinDocFreqValueSource.cs" />
-    <Compile Include="Function\ValueSource\LinearFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\LiteralValueSource.cs" />
-    <Compile Include="Function\ValueSource\LongFieldSource.cs" />
-    <Compile Include="Function\ValueSource\MaxDocValueSource.cs" />
-    <Compile Include="Function\ValueSource\MaxFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\MinFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\MultiBoolFunction.cs" />
-    <Compile Include="Function\ValueSource\MultiFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\MultiFunction.cs" />
-    <Compile Include="Function\ValueSource\MultiValueSource.cs" />
-    <Compile Include="Function\ValueSource\NormValueSource.cs" />
-    <Compile Include="Function\ValueSource\NumDocsValueSource.cs" />
-    <Compile Include="Function\ValueSource\OrdFieldSource.cs" />
-    <Compile Include="Function\ValueSource\PowFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\ProductFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\QueryValueSource.cs" />
-    <Compile Include="Function\ValueSource\RangeMapFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\ReciprocalFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\ReverseOrdFieldSource.cs" />
-    <Compile Include="Function\ValueSource\ScaleFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\ShortFieldSource.cs" />
-    <Compile Include="Function\ValueSource\SimpleBoolFunction.cs" />
-    <Compile Include="Function\ValueSource\SimpleFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\SingleFunction.cs" />
-    <Compile Include="Function\ValueSource\SumFloatFunction.cs" />
-    <Compile Include="Function\ValueSource\SumTotalTermFreqValueSource.cs" />
-    <Compile Include="Function\ValueSource\TermFreqValueSource.cs" />
-    <Compile Include="Function\ValueSource\TFValueSource.cs" />
-    <Compile Include="Function\ValueSource\TotalTermFreqValueSource.cs" />
-    <Compile Include="Function\ValueSource\VectorValueSource.cs" />
+    <Compile Include="Function\ValueSources\BoolFunction.cs" />
+    <Compile Include="Function\ValueSources\ByteFieldSource.cs" />
+    <Compile Include="Function\ValueSources\BytesRefFieldSource.cs" />
+    <Compile Include="Function\ValueSources\ConstNumberSource.cs" />
+    <Compile Include="Function\ValueSources\ConstValueSource.cs" />
+    <Compile Include="Function\ValueSources\DefFunction.cs" />
+    <Compile Include="Function\ValueSources\DivFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\DocFreqValueSource.cs" />
+    <Compile Include="Function\ValueSources\DoubleConstValueSource.cs" />
+    <Compile Include="Function\ValueSources\DoubleFieldSource.cs" />
+    <Compile Include="Function\ValueSources\DualFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\EnumFieldSource.cs" />
+    <Compile Include="Function\ValueSources\FieldCacheSource.cs" />
+    <Compile Include="Function\ValueSources\FloatFieldSource.cs" />
+    <Compile Include="Function\ValueSources\IDFValueSource.cs" />
+    <Compile Include="Function\ValueSources\IfFunction.cs" />
+    <Compile Include="Function\ValueSources\IntFieldSource.cs" />
+    <Compile Include="Function\ValueSources\JoinDocFreqValueSource.cs" />
+    <Compile Include="Function\ValueSources\LinearFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\LiteralValueSource.cs" />
+    <Compile Include="Function\ValueSources\LongFieldSource.cs" />
+    <Compile Include="Function\ValueSources\MaxDocValueSource.cs" />
+    <Compile Include="Function\ValueSources\MaxFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\MinFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\MultiBoolFunction.cs" />
+    <Compile Include="Function\ValueSources\MultiFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\MultiFunction.cs" />
+    <Compile Include="Function\ValueSources\MultiValueSource.cs" />
+    <Compile Include="Function\ValueSources\NormValueSource.cs" />
+    <Compile Include="Function\ValueSources\NumDocsValueSource.cs" />
+    <Compile Include="Function\ValueSources\OrdFieldSource.cs" />
+    <Compile Include="Function\ValueSources\PowFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\ProductFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\QueryValueSource.cs" />
+    <Compile Include="Function\ValueSources\RangeMapFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\ReciprocalFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\ReverseOrdFieldSource.cs" />
+    <Compile Include="Function\ValueSources\ScaleFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\ShortFieldSource.cs" />
+    <Compile Include="Function\ValueSources\SimpleBoolFunction.cs" />
+    <Compile Include="Function\ValueSources\SimpleFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\SingleFunction.cs" />
+    <Compile Include="Function\ValueSources\SumFloatFunction.cs" />
+    <Compile Include="Function\ValueSources\SumTotalTermFreqValueSource.cs" />
+    <Compile Include="Function\ValueSources\TermFreqValueSource.cs" />
+    <Compile Include="Function\ValueSources\TFValueSource.cs" />
+    <Compile Include="Function\ValueSources\TotalTermFreqValueSource.cs" />
+    <Compile Include="Function\ValueSources\VectorValueSource.cs" />
     <Compile Include="Mlt\MoreLikeThis.cs" />
     <Compile Include="Mlt\MoreLikeThisQuery.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />


[14/21] More work on Lucene.Net.Queries

Posted by sy...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs b/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs
index 1a25108..3e2dad5 100644
--- a/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs
+++ b/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs
@@ -1,981 +1,785 @@
-using System.Collections.Generic;
+// <summary>
+// Copyright 2004-2005 The Apache Software Foundation./// 
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// 
+//     http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// </summary>
+
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
 using System.Text;
-
-/// <summary>
-/// Copyright 2004-2005 The Apache Software Foundation.
-/// 
-/// Licensed under the Apache License, Version 2.0 (the "License");
-/// you may not use this file except in compliance with the License.
-/// You may obtain a copy of the License at
-/// 
-///     http://www.apache.org/licenses/LICENSE-2.0
-/// 
-/// Unless required by applicable law or agreed to in writing, software
-/// distributed under the License is distributed on an "AS IS" BASIS,
-/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-/// See the License for the specific language governing permissions and
-/// limitations under the License.
-/// </summary>
-namespace org.apache.lucene.queries.mlt
+using Lucene.Net.Analysis;
+using Lucene.Net.Analysis.Tokenattributes;
+using Lucene.Net.Documents;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Search.Similarities;
+using Lucene.Net.Util;
+using Reader = System.IO.TextReader;
+
+namespace Lucene.Net.Queries.Mlt
 {
-
-
-	using Analyzer = org.apache.lucene.analysis.Analyzer;
-	using TokenStream = org.apache.lucene.analysis.TokenStream;
-	using CharTermAttribute = org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-	using Document = org.apache.lucene.document.Document;
-	using Fields = org.apache.lucene.index.Fields;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using IndexableField = org.apache.lucene.index.IndexableField;
-	using MultiFields = org.apache.lucene.index.MultiFields;
-	using Term = org.apache.lucene.index.Term;
-	using Terms = org.apache.lucene.index.Terms;
-	using TermsEnum = org.apache.lucene.index.TermsEnum;
-	using org.apache.lucene.search;
-	using DefaultSimilarity = org.apache.lucene.search.similarities.DefaultSimilarity;
-	using TFIDFSimilarity = org.apache.lucene.search.similarities.TFIDFSimilarity;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-	using CharsRef = org.apache.lucene.util.CharsRef;
-	using IOUtils = org.apache.lucene.util.IOUtils;
-	using PriorityQueue = org.apache.lucene.util.PriorityQueue;
-	using UnicodeUtil = org.apache.lucene.util.UnicodeUtil;
-
-
-	/// <summary>
-	/// Generate "more like this" similarity queries.
-	/// Based on this mail:
-	/// <code><pre>
-	/// Lucene does let you access the document frequency of terms, with IndexReader.docFreq().
-	/// Term frequencies can be computed by re-tokenizing the text, which, for a single document,
-	/// is usually fast enough.  But looking up the docFreq() of every term in the document is
-	/// probably too slow.
-	/// <p/>
-	/// You can use some heuristics to prune the set of terms, to avoid calling docFreq() too much,
-	/// or at all.  Since you're trying to maximize a tf*idf score, you're probably most interested
-	/// in terms with a high tf. Choosing a tf threshold even as low as two or three will radically
-	/// reduce the number of terms under consideration.  Another heuristic is that terms with a
-	/// high idf (i.e., a low df) tend to be longer.  So you could threshold the terms by the
-	/// number of characters, not selecting anything less than, e.g., six or seven characters.
-	/// With these sorts of heuristics you can usually find small set of, e.g., ten or fewer terms
-	/// that do a pretty good job of characterizing a document.
-	/// <p/>
-	/// It all depends on what you're trying to do.  If you're trying to eek out that last percent
-	/// of precision and recall regardless of computational difficulty so that you can win a TREC
-	/// competition, then the techniques I mention above are useless.  But if you're trying to
-	/// provide a "more like this" button on a search results page that does a decent job and has
-	/// good performance, such techniques might be useful.
-	/// <p/>
-	/// An efficient, effective "more-like-this" query generator would be a great contribution, if
-	/// anyone's interested.  I'd imagine that it would take a Reader or a String (the document's
-	/// text), analyzer Analyzer, and return a set of representative terms using heuristics like those
-	/// above.  The frequency and length thresholds could be parameters, etc.
-	/// <p/>
-	/// Doug
-	/// </pre></code>
-	/// <p/>
-	/// <p/>
-	/// <p/>
-	/// <h3>Initial Usage</h3>
-	/// <p/>
-	/// This class has lots of options to try to make it efficient and flexible.
-	/// The simplest possible usage is as follows. The bold
-	/// fragment is specific to this class.
-	/// <p/>
-	/// <pre class="prettyprint">
-	/// <p/>
-	/// IndexReader ir = ...
-	/// IndexSearcher is = ...
-	/// <p/>
-	/// MoreLikeThis mlt = new MoreLikeThis(ir);
-	/// Reader target = ... // orig source of doc you want to find similarities to
-	/// Query query = mlt.like( target);
-	/// <p/>
-	/// Hits hits = is.search(query);
-	/// // now the usual iteration thru 'hits' - the only thing to watch for is to make sure
-	/// //you ignore the doc if it matches your 'target' document, as it should be similar to itself
-	/// <p/>
-	/// </pre>
-	/// <p/>
-	/// Thus you:
-	/// <ol>
-	/// <li> do your normal, Lucene setup for searching,
-	/// <li> create a MoreLikeThis,
-	/// <li> get the text of the doc you want to find similarities to
-	/// <li> then call one of the like() calls to generate a similarity query
-	/// <li> call the searcher to find the similar docs
-	/// </ol>
-	/// <p/>
-	/// <h3>More Advanced Usage</h3>
-	/// <p/>
-	/// You may want to use <seealso cref="#setFieldNames setFieldNames(...)"/> so you can examine
-	/// multiple fields (e.g. body and title) for similarity.
-	/// <p/>
-	/// <p/>
-	/// Depending on the size of your index and the size and makeup of your documents you
-	/// may want to call the other set methods to control how the similarity queries are
-	/// generated:
-	/// <ul>
-	/// <li> <seealso cref="#setMinTermFreq setMinTermFreq(...)"/>
-	/// <li> <seealso cref="#setMinDocFreq setMinDocFreq(...)"/>
-	/// <li> <seealso cref="#setMaxDocFreq setMaxDocFreq(...)"/>
-	/// <li> <seealso cref="#setMaxDocFreqPct setMaxDocFreqPct(...)"/>
-	/// <li> <seealso cref="#setMinWordLen setMinWordLen(...)"/>
-	/// <li> <seealso cref="#setMaxWordLen setMaxWordLen(...)"/>
-	/// <li> <seealso cref="#setMaxQueryTerms setMaxQueryTerms(...)"/>
-	/// <li> <seealso cref="#setMaxNumTokensParsed setMaxNumTokensParsed(...)"/>
-	/// <li> <seealso cref="#setStopWords setStopWord(...)"/>
-	/// </ul>
-	/// <p/>
-	/// <hr>
-	/// <pre>
-	/// Changes: Mark Harwood 29/02/04
-	/// Some bugfixing, some refactoring, some optimisation.
-	/// - bugfix: retrieveTerms(int docNum) was not working for indexes without a termvector -added missing code
-	/// - bugfix: No significant terms being created for fields with a termvector - because
-	/// was only counting one occurrence per term/field pair in calculations(ie not including frequency info from TermVector)
-	/// - refactor: moved common code into isNoiseWord()
-	/// - optimise: when no termvector support available - used maxNumTermsParsed to limit amount of tokenization
-	/// </pre>
-	/// </summary>
-	public sealed class MoreLikeThis
-	{
-
-	  /// <summary>
-	  /// Default maximum number of tokens to parse in each example doc field that is not stored with TermVector support.
-	  /// </summary>
-	  /// <seealso cref= #getMaxNumTokensParsed </seealso>
-	  public const int DEFAULT_MAX_NUM_TOKENS_PARSED = 5000;
-
-	  /// <summary>
-	  /// Ignore terms with less than this frequency in the source doc.
-	  /// </summary>
-	  /// <seealso cref= #getMinTermFreq </seealso>
-	  /// <seealso cref= #setMinTermFreq </seealso>
-	  public const int DEFAULT_MIN_TERM_FREQ = 2;
-
-	  /// <summary>
-	  /// Ignore words which do not occur in at least this many docs.
-	  /// </summary>
-	  /// <seealso cref= #getMinDocFreq </seealso>
-	  /// <seealso cref= #setMinDocFreq </seealso>
-	  public const int DEFAULT_MIN_DOC_FREQ = 5;
-
-	  /// <summary>
-	  /// Ignore words which occur in more than this many docs.
-	  /// </summary>
-	  /// <seealso cref= #getMaxDocFreq </seealso>
-	  /// <seealso cref= #setMaxDocFreq </seealso>
-	  /// <seealso cref= #setMaxDocFreqPct </seealso>
-	  public static readonly int DEFAULT_MAX_DOC_FREQ = int.MaxValue;
-
-	  /// <summary>
-	  /// Boost terms in query based on score.
-	  /// </summary>
-	  /// <seealso cref= #isBoost </seealso>
-	  /// <seealso cref= #setBoost </seealso>
-	  public const bool DEFAULT_BOOST = false;
-
-	  /// <summary>
-	  /// Default field names. Null is used to specify that the field names should be looked
-	  /// up at runtime from the provided reader.
-	  /// </summary>
-	  public static readonly string[] DEFAULT_FIELD_NAMES = new string[]{"contents"};
-
-	  /// <summary>
-	  /// Ignore words less than this length or if 0 then this has no effect.
-	  /// </summary>
-	  /// <seealso cref= #getMinWordLen </seealso>
-	  /// <seealso cref= #setMinWordLen </seealso>
-	  public const int DEFAULT_MIN_WORD_LENGTH = 0;
-
-	  /// <summary>
-	  /// Ignore words greater than this length or if 0 then this has no effect.
-	  /// </summary>
-	  /// <seealso cref= #getMaxWordLen </seealso>
-	  /// <seealso cref= #setMaxWordLen </seealso>
-	  public const int DEFAULT_MAX_WORD_LENGTH = 0;
-
-	  /// <summary>
-	  /// Default set of stopwords.
-	  /// If null means to allow stop words.
-	  /// </summary>
-	  /// <seealso cref= #setStopWords </seealso>
-	  /// <seealso cref= #getStopWords </seealso>
-//JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET:
-//ORIGINAL LINE: public static final Set<?> DEFAULT_STOP_WORDS = null;
-	  public const HashSet<?> DEFAULT_STOP_WORDS = null;
-
-	  /// <summary>
-	  /// Current set of stop words.
-	  /// </summary>
-//JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET:
-//ORIGINAL LINE: private Set<?> stopWords = DEFAULT_STOP_WORDS;
-	  private HashSet<?> stopWords = DEFAULT_STOP_WORDS;
-
-	  /// <summary>
-	  /// Return a Query with no more than this many terms.
-	  /// </summary>
-	  /// <seealso cref= BooleanQuery#getMaxClauseCount </seealso>
-	  /// <seealso cref= #getMaxQueryTerms </seealso>
-	  /// <seealso cref= #setMaxQueryTerms </seealso>
-	  public const int DEFAULT_MAX_QUERY_TERMS = 25;
-
-	  /// <summary>
-	  /// Analyzer that will be used to parse the doc.
-	  /// </summary>
-	  private Analyzer analyzer = null;
-
-	  /// <summary>
-	  /// Ignore words less frequent that this.
-	  /// </summary>
-	  private int minTermFreq = DEFAULT_MIN_TERM_FREQ;
-
-	  /// <summary>
-	  /// Ignore words which do not occur in at least this many docs.
-	  /// </summary>
-	  private int minDocFreq = DEFAULT_MIN_DOC_FREQ;
-
-	  /// <summary>
-	  /// Ignore words which occur in more than this many docs.
-	  /// </summary>
-	  private int maxDocFreq = DEFAULT_MAX_DOC_FREQ;
-
-	  /// <summary>
-	  /// Should we apply a boost to the Query based on the scores?
-	  /// </summary>
-	  private bool boost = DEFAULT_BOOST;
-
-	  /// <summary>
-	  /// Field name we'll analyze.
-	  /// </summary>
-	  private string[] fieldNames = DEFAULT_FIELD_NAMES;
-
-	  /// <summary>
-	  /// The maximum number of tokens to parse in each example doc field that is not stored with TermVector support
-	  /// </summary>
-	  private int maxNumTokensParsed = DEFAULT_MAX_NUM_TOKENS_PARSED;
-
-	  /// <summary>
-	  /// Ignore words if less than this len.
-	  /// </summary>
-	  private int minWordLen = DEFAULT_MIN_WORD_LENGTH;
-
-	  /// <summary>
-	  /// Ignore words if greater than this len.
-	  /// </summary>
-	  private int maxWordLen = DEFAULT_MAX_WORD_LENGTH;
-
-	  /// <summary>
-	  /// Don't return a query longer than this.
-	  /// </summary>
-	  private int maxQueryTerms = DEFAULT_MAX_QUERY_TERMS;
-
-	  /// <summary>
-	  /// For idf() calculations.
-	  /// </summary>
-	  private TFIDFSimilarity similarity; // = new DefaultSimilarity();
-
-	  /// <summary>
-	  /// IndexReader to use
-	  /// </summary>
-	  private readonly IndexReader ir;
-
-	  /// <summary>
-	  /// Boost factor to use when boosting the terms
-	  /// </summary>
-	  private float boostFactor = 1;
-
-	  /// <summary>
-	  /// Returns the boost factor used when boosting terms
-	  /// </summary>
-	  /// <returns> the boost factor used when boosting terms </returns>
-	  /// <seealso cref= #setBoostFactor(float) </seealso>
-	  public float BoostFactor
-	  {
-		  get
-		  {
-			return boostFactor;
-		  }
-		  set
-		  {
-			this.boostFactor = value;
-		  }
-	  }
-
-
-	  /// <summary>
-	  /// Constructor requiring an IndexReader.
-	  /// </summary>
-	  public MoreLikeThis(IndexReader ir) : this(ir, new DefaultSimilarity())
-	  {
-	  }
-
-	  public MoreLikeThis(IndexReader ir, TFIDFSimilarity sim)
-	  {
-		this.ir = ir;
-		this.similarity = sim;
-	  }
-
-
-	  public TFIDFSimilarity Similarity
-	  {
-		  get
-		  {
-			return similarity;
-		  }
-		  set
-		  {
-			this.similarity = value;
-		  }
-	  }
-
-
-	  /// <summary>
-	  /// Returns an analyzer that will be used to parse source doc with. The default analyzer
-	  /// is not set.
-	  /// </summary>
-	  /// <returns> the analyzer that will be used to parse source doc with. </returns>
-	  public Analyzer Analyzer
-	  {
-		  get
-		  {
-			return analyzer;
-		  }
-		  set
-		  {
-			this.analyzer = value;
-		  }
-	  }
-
-
-	  /// <summary>
-	  /// Returns the frequency below which terms will be ignored in the source doc. The default
-	  /// frequency is the <seealso cref="#DEFAULT_MIN_TERM_FREQ"/>.
-	  /// </summary>
-	  /// <returns> the frequency below which terms will be ignored in the source doc. </returns>
-	  public int MinTermFreq
-	  {
-		  get
-		  {
-			return minTermFreq;
-		  }
-		  set
-		  {
-			this.minTermFreq = value;
-		  }
-	  }
-
-
-	  /// <summary>
-	  /// Returns the frequency at which words will be ignored which do not occur in at least this
-	  /// many docs. The default frequency is <seealso cref="#DEFAULT_MIN_DOC_FREQ"/>.
-	  /// </summary>
-	  /// <returns> the frequency at which words will be ignored which do not occur in at least this
-	  ///         many docs. </returns>
-	  public int MinDocFreq
-	  {
-		  get
-		  {
-			return minDocFreq;
-		  }
-		  set
-		  {
-			this.minDocFreq = value;
-		  }
-	  }
-
-
-	  /// <summary>
-	  /// Returns the maximum frequency in which words may still appear.
-	  /// Words that appear in more than this many docs will be ignored. The default frequency is
-	  /// <seealso cref="#DEFAULT_MAX_DOC_FREQ"/>.
-	  /// </summary>
-	  /// <returns> get the maximum frequency at which words are still allowed,
-	  ///         words which occur in more docs than this are ignored. </returns>
-	  public int MaxDocFreq
-	  {
-		  get
-		  {
-			return maxDocFreq;
-		  }
-		  set
-		  {
-			this.maxDocFreq = value;
-		  }
-	  }
-
-
-	  /// <summary>
-	  /// Set the maximum percentage in which words may still appear. Words that appear
-	  /// in more than this many percent of all docs will be ignored.
-	  /// </summary>
-	  /// <param name="maxPercentage"> the maximum percentage of documents (0-100) that a term may appear
-	  /// in to be still considered relevant </param>
-	  public int MaxDocFreqPct
-	  {
-		  set
-		  {
-			this.maxDocFreq = value * ir.numDocs() / 100;
-		  }
-	  }
-
-
-	  /// <summary>
-	  /// Returns whether to boost terms in query based on "score" or not. The default is
-	  /// <seealso cref="#DEFAULT_BOOST"/>.
-	  /// </summary>
-	  /// <returns> whether to boost terms in query based on "score" or not. </returns>
-	  /// <seealso cref= #setBoost </seealso>
-	  public bool Boost
-	  {
-		  get
-		  {
-			return boost;
-		  }
-		  set
-		  {
-			this.boost = value;
-		  }
-	  }
-
-
-	  /// <summary>
-	  /// Returns the field names that will be used when generating the 'More Like This' query.
-	  /// The default field names that will be used is <seealso cref="#DEFAULT_FIELD_NAMES"/>.
-	  /// </summary>
-	  /// <returns> the field names that will be used when generating the 'More Like This' query. </returns>
-	  public string[] FieldNames
-	  {
-		  get
-		  {
-			return fieldNames;
-		  }
-		  set
-		  {
-			this.fieldNames = value;
-		  }
-	  }
-
-
-	  /// <summary>
-	  /// Returns the minimum word length below which words will be ignored. Set this to 0 for no
-	  /// minimum word length. The default is <seealso cref="#DEFAULT_MIN_WORD_LENGTH"/>.
-	  /// </summary>
-	  /// <returns> the minimum word length below which words will be ignored. </returns>
-	  public int MinWordLen
-	  {
-		  get
-		  {
-			return minWordLen;
-		  }
-		  set
-		  {
-			this.minWordLen = value;
-		  }
-	  }
-
-
-	  /// <summary>
-	  /// Returns the maximum word length above which words will be ignored. Set this to 0 for no
-	  /// maximum word length. The default is <seealso cref="#DEFAULT_MAX_WORD_LENGTH"/>.
-	  /// </summary>
-	  /// <returns> the maximum word length above which words will be ignored. </returns>
-	  public int MaxWordLen
-	  {
-		  get
-		  {
-			return maxWordLen;
-		  }
-		  set
-		  {
-			this.maxWordLen = value;
-		  }
-	  }
-
-
-	  /// <summary>
-	  /// Set the set of stopwords.
-	  /// Any word in this set is considered "uninteresting" and ignored.
-	  /// Even if your Analyzer allows stopwords, you might want to tell the MoreLikeThis code to ignore them, as
-	  /// for the purposes of document similarity it seems reasonable to assume that "a stop word is never interesting".
-	  /// </summary>
-	  /// <param name="stopWords"> set of stopwords, if null it means to allow stop words </param>
-	  /// <seealso cref= #getStopWords </seealso>
-	  public HashSet<T1> StopWords<T1>
-	  {
-		  set
-		  {
-			this.stopWords = value;
-		  }
-		  get
-		  {
-			return stopWords;
-		  }
-	  }
-
-
-
-	  /// <summary>
-	  /// Returns the maximum number of query terms that will be included in any generated query.
-	  /// The default is <seealso cref="#DEFAULT_MAX_QUERY_TERMS"/>.
-	  /// </summary>
-	  /// <returns> the maximum number of query terms that will be included in any generated query. </returns>
-	  public int MaxQueryTerms
-	  {
-		  get
-		  {
-			return maxQueryTerms;
-		  }
-		  set
-		  {
-			this.maxQueryTerms = value;
-		  }
-	  }
-
-
-	  /// <returns> The maximum number of tokens to parse in each example doc field that is not stored with TermVector support </returns>
-	  /// <seealso cref= #DEFAULT_MAX_NUM_TOKENS_PARSED </seealso>
-	  public int MaxNumTokensParsed
-	  {
-		  get
-		  {
-			return maxNumTokensParsed;
-		  }
-		  set
-		  {
-			maxNumTokensParsed = value;
-		  }
-	  }
-
-
-
-	  /// <summary>
-	  /// Return a query that will return docs like the passed lucene document ID.
-	  /// </summary>
-	  /// <param name="docNum"> the documentID of the lucene doc to generate the 'More Like This" query for. </param>
-	  /// <returns> a query that will return docs like the passed lucene document ID. </returns>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public Query like(int docNum) throws IOException
-	  public Query like(int docNum)
-	  {
-		if (fieldNames == null)
-		{
-		  // gather list of valid fields from lucene
-		  ICollection<string> fields = MultiFields.getIndexedFields(ir);
-		  fieldNames = fields.toArray(new string[fields.Count]);
-		}
-
-		return createQuery(retrieveTerms(docNum));
-	  }
-
-	  /// <summary>
-	  /// Return a query that will return docs like the passed Reader.
-	  /// </summary>
-	  /// <returns> a query that will return docs like the passed Reader. </returns>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public Query like(Reader r, String fieldName) throws IOException
-	  public Query like(Reader r, string fieldName)
-	  {
-		return createQuery(retrieveTerms(r, fieldName));
-	  }
-
-	  /// <summary>
-	  /// Create the More like query from a PriorityQueue
-	  /// </summary>
-	  private Query createQuery(PriorityQueue<object[]> q)
-	  {
-		BooleanQuery query = new BooleanQuery();
-		object cur;
-		int qterms = 0;
-		float bestScore = 0;
-
-		while ((cur = q.pop()) != null)
-		{
-		  object[] ar = (object[]) cur;
-		  TermQuery tq = new TermQuery(new Term((string) ar[1], (string) ar[0]));
-
-		  if (boost)
-		  {
-			if (qterms == 0)
-			{
-			  bestScore = ((float?) ar[2]);
-			}
-			float myScore = ((float?) ar[2]);
-
-			tq.Boost = boostFactor * myScore / bestScore;
-		  }
-
-		  try
-		  {
-			query.add(tq, BooleanClause.Occur.SHOULD);
-		  }
-		  catch (BooleanQuery.TooManyClauses)
-		  {
-			break;
-		  }
-
-		  qterms++;
-		  if (maxQueryTerms > 0 && qterms >= maxQueryTerms)
-		  {
-			break;
-		  }
-		}
-
-		return query;
-	  }
-
-	  /// <summary>
-	  /// Create a PriorityQueue from a word->tf map.
-	  /// </summary>
-	  /// <param name="words"> a map of words keyed on the word(String) with Int objects as the values. </param>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private org.apache.lucene.util.PriorityQueue<Object[]> createQueue(Map<String, Int> words) throws IOException
-	  private PriorityQueue<object[]> createQueue(IDictionary<string, Int> words)
-	  {
-		// have collected all words in doc and their freqs
-		int numDocs = ir.numDocs();
-		FreqQ res = new FreqQ(words.Count); // will order words by score
-
-		foreach (string word in words.Keys) // for every word
-		{
-		  int tf = words[word].x; // term freq in the source doc
-		  if (minTermFreq > 0 && tf < minTermFreq)
-		  {
-			continue; // filter out words that don't occur enough times in the source
-		  }
-
-		  // go through all the fields and find the largest document frequency
-		  string topField = fieldNames[0];
-		  int docFreq = 0;
-		  foreach (string fieldName in fieldNames)
-		  {
-			int freq = ir.docFreq(new Term(fieldName, word));
-			topField = (freq > docFreq) ? fieldName : topField;
-			docFreq = (freq > docFreq) ? freq : docFreq;
-		  }
-
-		  if (minDocFreq > 0 && docFreq < minDocFreq)
-		  {
-			continue; // filter out words that don't occur in enough docs
-		  }
-
-		  if (docFreq > maxDocFreq)
-		  {
-			continue; // filter out words that occur in too many docs
-		  }
-
-		  if (docFreq == 0)
-		  {
-			continue; // index update problem?
-		  }
-
-		  float idf = similarity.idf(docFreq, numDocs);
-		  float score = tf * idf;
-
-		  // only really need 1st 3 entries, other ones are for troubleshooting
-		  res.insertWithOverflow(new object[]{word, topField, score, idf, docFreq, tf}); // freq in all docs -  idf -  overall score -  the top field -  the word
-		}
-		return res;
-	  }
-
-	  /// <summary>
-	  /// Describe the parameters that control how the "more like this" query is formed.
-	  /// </summary>
-	  public string describeParams()
-	  {
-		StringBuilder sb = new StringBuilder();
-		sb.Append("\t").Append("maxQueryTerms  : ").Append(maxQueryTerms).Append("\n");
-		sb.Append("\t").Append("minWordLen     : ").Append(minWordLen).Append("\n");
-		sb.Append("\t").Append("maxWordLen     : ").Append(maxWordLen).Append("\n");
-		sb.Append("\t").Append("fieldNames     : ");
-		string delim = "";
-		foreach (string fieldName in fieldNames)
-		{
-		  sb.Append(delim).Append(fieldName);
-		  delim = ", ";
-		}
-		sb.Append("\n");
-		sb.Append("\t").Append("boost          : ").Append(boost).Append("\n");
-		sb.Append("\t").Append("minTermFreq    : ").Append(minTermFreq).Append("\n");
-		sb.Append("\t").Append("minDocFreq     : ").Append(minDocFreq).Append("\n");
-		return sb.ToString();
-	  }
-
-	  /// <summary>
-	  /// Find words for a more-like-this query former.
-	  /// </summary>
-	  /// <param name="docNum"> the id of the lucene document from which to find terms </param>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public org.apache.lucene.util.PriorityQueue<Object[]> retrieveTerms(int docNum) throws IOException
-	  public PriorityQueue<object[]> retrieveTerms(int docNum)
-	  {
-		IDictionary<string, Int> termFreqMap = new Dictionary<string, Int>();
-		foreach (string fieldName in fieldNames)
-		{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.Fields vectors = ir.getTermVectors(docNum);
-		  Fields vectors = ir.getTermVectors(docNum);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.Terms vector;
-		  Terms vector;
-		  if (vectors != null)
-		  {
-			vector = vectors.terms(fieldName);
-		  }
-		  else
-		  {
-			vector = null;
-		  }
-
-		  // field does not store term vector info
-		  if (vector == null)
-		  {
-			Document d = ir.document(docNum);
-			IndexableField[] fields = d.getFields(fieldName);
-			foreach (IndexableField field in fields)
-			{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final String stringValue = field.stringValue();
-			  string stringValue = field.stringValue();
-			  if (stringValue != null)
-			  {
-				addTermFrequencies(new StringReader(stringValue), termFreqMap, fieldName);
-			  }
-			}
-		  }
-		  else
-		  {
-			addTermFrequencies(termFreqMap, vector);
-		  }
-		}
-
-		return createQueue(termFreqMap);
-	  }
-
-	  /// <summary>
-	  /// Adds terms and frequencies found in vector into the Map termFreqMap
-	  /// </summary>
-	  /// <param name="termFreqMap"> a Map of terms and their frequencies </param>
-	  /// <param name="vector"> List of terms and their frequencies for a doc/field </param>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private void addTermFrequencies(Map<String, Int> termFreqMap, org.apache.lucene.index.Terms vector) throws IOException
-	  private void addTermFrequencies(IDictionary<string, Int> termFreqMap, Terms vector)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.TermsEnum termsEnum = vector.iterator(null);
-		TermsEnum termsEnum = vector.iterator(null);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.CharsRef spare = new org.apache.lucene.util.CharsRef();
-		CharsRef spare = new CharsRef();
-		BytesRef text;
-		while ((text = termsEnum.next()) != null)
-		{
-		  UnicodeUtil.UTF8toUTF16(text, spare);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final String term = spare.toString();
-		  string term = spare.ToString();
-		  if (isNoiseWord(term))
-		  {
-			continue;
-		  }
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int freq = (int) termsEnum.totalTermFreq();
-		  int freq = (int) termsEnum.totalTermFreq();
-
-		  // increment frequency
-		  Int cnt = termFreqMap[term];
-		  if (cnt == null)
-		  {
-			cnt = new Int();
-			termFreqMap[term] = cnt;
-			cnt.x = freq;
-		  }
-		  else
-		  {
-			cnt.x += freq;
-		  }
-		}
-	  }
-
-	  /// <summary>
-	  /// Adds term frequencies found by tokenizing text from reader into the Map words
-	  /// </summary>
-	  /// <param name="r"> a source of text to be tokenized </param>
-	  /// <param name="termFreqMap"> a Map of terms and their frequencies </param>
-	  /// <param name="fieldName"> Used by analyzer for any special per-field analysis </param>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private void addTermFrequencies(Reader r, Map<String, Int> termFreqMap, String fieldName) throws IOException
-	  private void addTermFrequencies(Reader r, IDictionary<string, Int> termFreqMap, string fieldName)
-	  {
-		if (analyzer == null)
-		{
-		  throw new System.NotSupportedException("To use MoreLikeThis without " + "term vectors, you must provide an Analyzer");
-		}
-		TokenStream ts = analyzer.tokenStream(fieldName, r);
-		try
-		{
-		  int tokenCount = 0;
-		  // for every token
-		  CharTermAttribute termAtt = ts.addAttribute(typeof(CharTermAttribute));
-		  ts.reset();
-		  while (ts.incrementToken())
-		  {
-			string word = termAtt.ToString();
-			tokenCount++;
-			if (tokenCount > maxNumTokensParsed)
-			{
-			  break;
-			}
-			if (isNoiseWord(word))
-			{
-			  continue;
-			}
-
-			// increment frequency
-			Int cnt = termFreqMap[word];
-			if (cnt == null)
-			{
-			  termFreqMap[word] = new Int();
-			}
-			else
-			{
-			  cnt.x++;
-			}
-		  }
-		  ts.end();
-		}
-		finally
-		{
-		  IOUtils.closeWhileHandlingException(ts);
-		}
-	  }
-
-
-	  /// <summary>
-	  /// determines if the passed term is likely to be of interest in "more like" comparisons
-	  /// </summary>
-	  /// <param name="term"> The word being considered </param>
-	  /// <returns> true if should be ignored, false if should be used in further analysis </returns>
-	  private bool isNoiseWord(string term)
-	  {
-		int len = term.Length;
-		if (minWordLen > 0 && len < minWordLen)
-		{
-		  return true;
-		}
-		if (maxWordLen > 0 && len > maxWordLen)
-		{
-		  return true;
-		}
-		return stopWords != null && stopWords.Contains(term);
-	  }
-
-
-	  /// <summary>
-	  /// Find words for a more-like-this query former.
-	  /// The result is a priority queue of arrays with one entry for <b>every word</b> in the document.
-	  /// Each array has 6 elements.
-	  /// The elements are:
-	  /// <ol>
-	  /// <li> The word (String)
-	  /// <li> The top field that this word comes from (String)
-	  /// <li> The score for this word (Float)
-	  /// <li> The IDF value (Float)
-	  /// <li> The frequency of this word in the index (Integer)
-	  /// <li> The frequency of this word in the source document (Integer)
-	  /// </ol>
-	  /// This is a somewhat "advanced" routine, and in general only the 1st entry in the array is of interest.
-	  /// This method is exposed so that you can identify the "interesting words" in a document.
-	  /// For an easier method to call see <seealso cref="#retrieveInterestingTerms retrieveInterestingTerms()"/>.
-	  /// </summary>
-	  /// <param name="r"> the reader that has the content of the document </param>
-	  /// <param name="fieldName"> field passed to the analyzer to use when analyzing the content </param>
-	  /// <returns> the most interesting words in the document ordered by score, with the highest scoring, or best entry, first </returns>
-	  /// <seealso cref= #retrieveInterestingTerms </seealso>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public org.apache.lucene.util.PriorityQueue<Object[]> retrieveTerms(Reader r, String fieldName) throws IOException
-	  public PriorityQueue<object[]> retrieveTerms(Reader r, string fieldName)
-	  {
-		IDictionary<string, Int> words = new Dictionary<string, Int>();
-		addTermFrequencies(r, words, fieldName);
-		return createQueue(words);
-	  }
-
-	  /// <seealso cref= #retrieveInterestingTerms(java.io.Reader, String) </seealso>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public String[] retrieveInterestingTerms(int docNum) throws IOException
-	  public string[] retrieveInterestingTerms(int docNum)
-	  {
-		List<object> al = new List<object>(maxQueryTerms);
-		PriorityQueue<object[]> pq = retrieveTerms(docNum);
-		object cur;
-		int lim = maxQueryTerms; // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...
-		// we just want to return the top words
-		while (((cur = pq.pop()) != null) && lim-- > 0)
-		{
-		  object[] ar = (object[]) cur;
-		  al.Add(ar[0]); // the 1st entry is the interesting word
-		}
-		string[] res = new string[al.Count];
-		return al.toArray(res);
-	  }
-
-	  /// <summary>
-	  /// Convenience routine to make it easy to return the most interesting words in a document.
-	  /// More advanced users will call <seealso cref="#retrieveTerms(Reader, String) retrieveTerms()"/> directly.
-	  /// </summary>
-	  /// <param name="r"> the source document </param>
-	  /// <param name="fieldName"> field passed to analyzer to use when analyzing the content </param>
-	  /// <returns> the most interesting words in the document </returns>
-	  /// <seealso cref= #retrieveTerms(java.io.Reader, String) </seealso>
-	  /// <seealso cref= #setMaxQueryTerms </seealso>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public String[] retrieveInterestingTerms(Reader r, String fieldName) throws IOException
-	  public string[] retrieveInterestingTerms(Reader r, string fieldName)
-	  {
-		List<object> al = new List<object>(maxQueryTerms);
-		PriorityQueue<object[]> pq = retrieveTerms(r, fieldName);
-		object cur;
-		int lim = maxQueryTerms; // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...
-		// we just want to return the top words
-		while (((cur = pq.pop()) != null) && lim-- > 0)
-		{
-		  object[] ar = (object[]) cur;
-		  al.Add(ar[0]); // the 1st entry is the interesting word
-		}
-		string[] res = new string[al.Count];
-		return al.toArray(res);
-	  }
-
-	  /// <summary>
-	  /// PriorityQueue that orders words by score.
-	  /// </summary>
-	  private class FreqQ : PriorityQueue<object[]>
-	  {
-		internal FreqQ(int s) : base(s)
-		{
-		}
-
-		protected internal override bool lessThan(object[] aa, object[] bb)
-		{
-		  float? fa = (float?) aa[2];
-		  float? fb = (float?) bb[2];
-		  return fa > fb;
-		}
-	  }
-
-	  /// <summary>
-	  /// Use for frequencies and to avoid renewing Integers.
-	  /// </summary>
-	  private class Int
-	  {
-		internal int x;
-
-		internal Int()
-		{
-		  x = 1;
-		}
-	  }
-	}
+    /// <summary>
+    /// Generate "more like this" similarity queries.
+    /// Based on this mail:
+    /// <code><pre>
+    /// Lucene does let you access the document frequency of terms, with IndexReader.docFreq().
+    /// Term frequencies can be computed by re-tokenizing the text, which, for a single document,
+    /// is usually fast enough.  But looking up the docFreq() of every term in the document is
+    /// probably too slow.
+    /// <p/>
+    /// You can use some heuristics to prune the set of terms, to avoid calling docFreq() too much,
+    /// or at all.  Since you're trying to maximize a tf*idf score, you're probably most interested
+    /// in terms with a high tf. Choosing a tf threshold even as low as two or three will radically
+    /// reduce the number of terms under consideration.  Another heuristic is that terms with a
+    /// high idf (i.e., a low df) tend to be longer.  So you could threshold the terms by the
+    /// number of characters, not selecting anything less than, e.g., six or seven characters.
+    /// With these sorts of heuristics you can usually find small set of, e.g., ten or fewer terms
+    /// that do a pretty good job of characterizing a document.
+    /// <p/>
+    /// It all depends on what you're trying to do.  If you're trying to eek out that last percent
+    /// of precision and recall regardless of computational difficulty so that you can win a TREC
+    /// competition, then the techniques I mention above are useless.  But if you're trying to
+    /// provide a "more like this" button on a search results page that does a decent job and has
+    /// good performance, such techniques might be useful.
+    /// <p/>
+    /// An efficient, effective "more-like-this" query generator would be a great contribution, if
+    /// anyone's interested.  I'd imagine that it would take a Reader or a String (the document's
+    /// text), analyzer Analyzer, and return a set of representative terms using heuristics like those
+    /// above.  The frequency and length thresholds could be parameters, etc.
+    /// <p/>
+    /// Doug
+    /// </pre></code>
+    /// <p/>
+    /// <p/>
+    /// <p/>
+    /// <h3>Initial Usage</h3>
+    /// <p/>
+    /// This class has lots of options to try to make it efficient and flexible.
+    /// The simplest possible usage is as follows. The bold
+    /// fragment is specific to this class.
+    /// <p/>
+    /// <pre class="prettyprint">
+    /// <p/>
+    /// IndexReader ir = ...
+    /// IndexSearcher is = ...
+    /// <p/>
+    /// MoreLikeThis mlt = new MoreLikeThis(ir);
+    /// Reader target = ... // orig source of doc you want to find similarities to
+    /// Query query = mlt.like( target);
+    /// <p/>
+    /// Hits hits = is.search(query);
+    /// // now the usual iteration thru 'hits' - the only thing to watch for is to make sure
+    /// //you ignore the doc if it matches your 'target' document, as it should be similar to itself
+    /// <p/>
+    /// </pre>
+    /// <p/>
+    /// Thus you:
+    /// <ol>
+    /// <li> do your normal, Lucene setup for searching,
+    /// <li> create a MoreLikeThis,
+    /// <li> get the text of the doc you want to find similarities to
+    /// <li> then call one of the like() calls to generate a similarity query
+    /// <li> call the searcher to find the similar docs
+    /// </ol>
+    /// <p/>
+    /// <h3>More Advanced Usage</h3>
+    /// <p/>
+    /// You may want to use <seealso cref="#setFieldNames setFieldNames(...)"/> so you can examine
+    /// multiple fields (e.g. body and title) for similarity.
+    /// <p/>
+    /// <p/>
+    /// Depending on the size of your index and the size and makeup of your documents you
+    /// may want to call the other set methods to control how the similarity queries are
+    /// generated:
+    /// <ul>
+    /// <li> <seealso cref="#setMinTermFreq setMinTermFreq(...)"/>
+    /// <li> <seealso cref="#setMinDocFreq setMinDocFreq(...)"/>
+    /// <li> <seealso cref="#setMaxDocFreq setMaxDocFreq(...)"/>
+    /// <li> <seealso cref="#setMaxDocFreqPct setMaxDocFreqPct(...)"/>
+    /// <li> <seealso cref="#setMinWordLen setMinWordLen(...)"/>
+    /// <li> <seealso cref="#setMaxWordLen setMaxWordLen(...)"/>
+    /// <li> <seealso cref="#setMaxQueryTerms setMaxQueryTerms(...)"/>
+    /// <li> <seealso cref="#setMaxNumTokensParsed setMaxNumTokensParsed(...)"/>
+    /// <li> <seealso cref="#setStopWords setStopWord(...)"/>
+    /// </ul>
+    /// <p/>
+    /// <hr>
+    /// <pre>
+    /// Changes: Mark Harwood 29/02/04
+    /// Some bugfixing, some refactoring, some optimisation.
+    /// - bugfix: retrieveTerms(int docNum) was not working for indexes without a termvector -added missing code
+    /// - bugfix: No significant terms being created for fields with a termvector - because
+    /// was only counting one occurrence per term/field pair in calculations(ie not including frequency info from TermVector)
+    /// - refactor: moved common code into isNoiseWord()
+    /// - optimise: when no termvector support available - used maxNumTermsParsed to limit amount of tokenization
+    /// </pre>
+    /// </summary>
+    public sealed class MoreLikeThis
+    {
+
+        /// <summary>
+        /// Default maximum number of tokens to parse in each example doc field that is not stored with TermVector support.
+        /// </summary>
+        /// <seealso cref= #getMaxNumTokensParsed </seealso>
+        public const int DEFAULT_MAX_NUM_TOKENS_PARSED = 5000;
+
+        /// <summary>
+        /// Ignore terms with less than this frequency in the source doc.
+        /// </summary>
+        /// <seealso cref= #getMinTermFreq </seealso>
+        /// <seealso cref= #setMinTermFreq </seealso>
+        public const int DEFAULT_MIN_TERM_FREQ = 2;
+
+        /// <summary>
+        /// Ignore words which do not occur in at least this many docs.
+        /// </summary>
+        /// <seealso cref= #getMinDocFreq </seealso>
+        /// <seealso cref= #setMinDocFreq </seealso>
+        public const int DEFAULT_MIN_DOC_FREQ = 5;
+
+        /// <summary>
+        /// Ignore words which occur in more than this many docs.
+        /// </summary>
+        /// <seealso cref= #getMaxDocFreq </seealso>
+        /// <seealso cref= #setMaxDocFreq </seealso>
+        /// <seealso cref= #setMaxDocFreqPct </seealso>
+        public static readonly int DEFAULT_MAX_DOC_FREQ = int.MaxValue;
+
+        /// <summary>
+        /// Boost terms in query based on score.
+        /// </summary>
+        /// <seealso cref= #isBoost </seealso>
+        /// <seealso cref= #setBoost </seealso>
+        public const bool DEFAULT_BOOST = false;
+
+        /// <summary>
+        /// Default field names. Null is used to specify that the field names should be looked
+        /// up at runtime from the provided reader.
+        /// </summary>
+        public static readonly string[] DEFAULT_FIELD_NAMES = new string[] { "contents" };
+
+        /// <summary>
+        /// Ignore words less than this length or if 0 then this has no effect.
+        /// </summary>
+        /// <seealso cref= #getMinWordLen </seealso>
+        /// <seealso cref= #setMinWordLen </seealso>
+        public const int DEFAULT_MIN_WORD_LENGTH = 0;
+
+        /// <summary>
+        /// Ignore words greater than this length or if 0 then this has no effect.
+        /// </summary>
+        /// <seealso cref= #getMaxWordLen </seealso>
+        /// <seealso cref= #setMaxWordLen </seealso>
+        public const int DEFAULT_MAX_WORD_LENGTH = 0;
+
+        /// <summary>
+        /// Default set of stopwords.
+        /// If null means to allow stop words.
+        /// </summary>
+        /// <seealso cref= #setStopWords </seealso>
+        /// <seealso cref= #getStopWords </seealso>
+        public const ISet<string> DEFAULT_STOP_WORDS = null;
+
+        /// <summary>
+        /// Return a Query with no more than this many terms.
+        /// </summary>
+        /// <seealso cref= BooleanQuery#getMaxClauseCount </seealso>
+        /// <seealso cref= #getMaxQueryTerms </seealso>
+        /// <seealso cref= #setMaxQueryTerms </seealso>
+        public const int DEFAULT_MAX_QUERY_TERMS = 25;
+
+        /// <summary>
+        /// IndexReader to use
+        /// </summary>
+        private readonly IndexReader ir;
+
+        /// <summary>
+        /// Boost factor to use when boosting the terms
+        /// </summary>
+        private float boostFactor = 1;
+
+        /// <summary>
+        /// Returns the boost factor used when boosting terms
+        /// </summary>
+        /// <returns> the boost factor used when boosting terms </returns>
+        /// <seealso cref= #setBoostFactor(float) </seealso>
+        public float BoostFactor
+        {
+            get
+            {
+                return boostFactor;
+            }
+            set
+            {
+                this.boostFactor = value;
+            }
+        }
+
+
+        /// <summary>
+        /// Constructor requiring an IndexReader.
+        /// </summary>
+        public MoreLikeThis(IndexReader ir)
+            : this(ir, new DefaultSimilarity())
+        {
+        }
+
+        public MoreLikeThis(IndexReader ir, TFIDFSimilarity sim)
+        {
+            this.ir = ir;
+            this.Similarity = sim;
+            StopWords = DEFAULT_STOP_WORDS;
+
+            MinTermFreq = DEFAULT_MIN_TERM_FREQ;
+            MinDocFreq = DEFAULT_MIN_DOC_FREQ;
+            MaxDocFreq = DEFAULT_MAX_DOC_FREQ;
+            Boost = DEFAULT_BOOST;
+            FieldNames = DEFAULT_FIELD_NAMES;
+            MaxNumTokensParsed = DEFAULT_MAX_NUM_TOKENS_PARSED;
+            MinWordLen = DEFAULT_MIN_WORD_LENGTH;
+            MaxWordLen = DEFAULT_MAX_WORD_LENGTH;
+            MaxQueryTerms = DEFAULT_MAX_QUERY_TERMS;
+        }
+
+
+        public TFIDFSimilarity Similarity { get; set; }
+
+
+        /// <summary>
+        /// Returns an analyzer that will be used to parse source doc with. The default analyzer
+        /// is not set.
+        /// </summary>
+        /// <returns> the analyzer that will be used to parse source doc with. </returns>
+        public Analyzer Analyzer { get; set; }
+
+
+        /// <summary>
+        /// Returns the frequency below which terms will be ignored in the source doc. The default
+        /// frequency is the <seealso cref="#DEFAULT_MIN_TERM_FREQ"/>.
+        /// </summary>
+        /// <returns> the frequency below which terms will be ignored in the source doc. </returns>
+        public int MinTermFreq { get; set; }
+
+
+        /// <summary>
+        /// Returns the frequency at which words will be ignored which do not occur in at least this
+        /// many docs. The default frequency is <seealso cref="#DEFAULT_MIN_DOC_FREQ"/>.
+        /// </summary>
+        /// <returns> the frequency at which words will be ignored which do not occur in at least this
+        ///         many docs. </returns>
+        public int MinDocFreq { get; set; }
+
+
+        /// <summary>
+        /// Returns the maximum frequency in which words may still appear.
+        /// Words that appear in more than this many docs will be ignored. The default frequency is
+        /// <seealso cref="#DEFAULT_MAX_DOC_FREQ"/>.
+        /// </summary>
+        /// <returns> get the maximum frequency at which words are still allowed,
+        ///         words which occur in more docs than this are ignored. </returns>
+        public int MaxDocFreq { get; set; }
+
+
+        /// <summary>
+        /// Set the maximum percentage in which words may still appear. Words that appear
+        /// in more than this many percent of all docs will be ignored.
+        /// </summary>
+        /// <param name="maxPercentage"> the maximum percentage of documents (0-100) that a term may appear
+        /// in to be still considered relevant </param>
+        public int MaxDocFreqPct
+        {
+            set
+            {
+                this.MaxDocFreq = value * ir.NumDocs / 100;
+            }
+        }
+
+
+        /// <summary>
+        /// Returns whether to boost terms in query based on "score" or not. The default is
+        /// <seealso cref="#DEFAULT_BOOST"/>.
+        /// </summary>
+        /// <returns> whether to boost terms in query based on "score" or not. </returns>
+        /// <seealso cref= #setBoost </seealso>
+        public bool Boost { get; set; }
+
+
+        /// <summary>
+        /// Returns the field names that will be used when generating the 'More Like This' query.
+        /// The default field names that will be used is <seealso cref="#DEFAULT_FIELD_NAMES"/>.
+        /// </summary>
+        /// <returns> the field names that will be used when generating the 'More Like This' query. </returns>
+        public string[] FieldNames { get; set; }
+
+
+        /// <summary>
+        /// Returns the minimum word length below which words will be ignored. Set this to 0 for no
+        /// minimum word length. The default is <seealso cref="#DEFAULT_MIN_WORD_LENGTH"/>.
+        /// </summary>
+        /// <returns> the minimum word length below which words will be ignored. </returns>
+        public int MinWordLen { get; set; }
+
+
+        /// <summary>
+        /// Returns the maximum word length above which words will be ignored. Set this to 0 for no
+        /// maximum word length. The default is <seealso cref="#DEFAULT_MAX_WORD_LENGTH"/>.
+        /// </summary>
+        /// <returns> the maximum word length above which words will be ignored. </returns>
+        public int MaxWordLen { get; set; }
+
+
+        /// <summary>
+        /// Set the set of stopwords.
+        /// Any word in this set is considered "uninteresting" and ignored.
+        /// Even if your Analyzer allows stopwords, you might want to tell the MoreLikeThis code to ignore them, as
+        /// for the purposes of document similarity it seems reasonable to assume that "a stop word is never interesting".
+        /// </summary>
+        /// <param name="stopWords"> set of stopwords, if null it means to allow stop words </param>
+        /// <seealso cref= #getStopWords </seealso>
+        public ISet<string> StopWords { get; set; }
+
+        /// <summary>
+        /// Returns the maximum number of query terms that will be included in any generated query.
+        /// The default is <seealso cref="#DEFAULT_MAX_QUERY_TERMS"/>.
+        /// </summary>
+        /// <returns> the maximum number of query terms that will be included in any generated query. </returns>
+        public int MaxQueryTerms { get; set; }
+
+
+        /// <returns> The maximum number of tokens to parse in each example doc field that is not stored with TermVector support </returns>
+        /// <seealso cref= #DEFAULT_MAX_NUM_TOKENS_PARSED </seealso>
+        public int MaxNumTokensParsed { get; set; }
+
+
+
+        /// <summary>
+        /// Return a query that will return docs like the passed lucene document ID.
+        /// </summary>
+        /// <param name="docNum"> the documentID of the lucene doc to generate the 'More Like This" query for. </param>
+        /// <returns> a query that will return docs like the passed lucene document ID. </returns>
+        public Query Like(int docNum)
+        {
+            if (FieldNames == null)
+            {
+                // gather list of valid fields from lucene
+                ICollection<string> fields = MultiFields.GetIndexedFields(ir);
+                FieldNames = fields.ToArray();
+            }
+
+            return CreateQuery(RetrieveTerms(docNum));
+        }
+
+        /// <summary>
+        /// Return a query that will return docs like the passed Reader.
+        /// </summary>
+        /// <returns> a query that will return docs like the passed Reader. </returns>
+        public Query Like(Reader r, string fieldName)
+        {
+            return CreateQuery(RetrieveTerms(r, fieldName));
+        }
+
+        /// <summary>
+        /// Create the More like query from a PriorityQueue
+        /// </summary>
+        private Query CreateQuery(PriorityQueue<object[]> q)
+        {
+            BooleanQuery query = new BooleanQuery();
+            object cur;
+            int qterms = 0;
+            float bestScore = 0;
+
+            while ((cur = q.Pop()) != null)
+            {
+                object[] ar = (object[])cur;
+                TermQuery tq = new TermQuery(new Term((string)ar[1], (string)ar[0]));
+
+                if (Boost)
+                {
+                    if (qterms == 0)
+                    {
+                        bestScore = ((float?)ar[2]);
+                    }
+                    float myScore = ((float?)ar[2]);
+
+                    tq.Boost = boostFactor * myScore / bestScore;
+                }
+
+                try
+                {
+                    query.Add(tq, BooleanClause.Occur.SHOULD);
+                }
+                catch (BooleanQuery.TooManyClauses)
+                {
+                    break;
+                }
+
+                qterms++;
+                if (MaxQueryTerms > 0 && qterms >= MaxQueryTerms)
+                {
+                    break;
+                }
+            }
+
+            return query;
+        }
+
+        /// <summary>
+        /// Create a PriorityQueue from a word->tf map.
+        /// </summary>
+        /// <param name="words"> a map of words keyed on the word(String) with Int objects as the values. </param>
+        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+        //ORIGINAL LINE: private org.apache.lucene.util.PriorityQueue<Object[]> createQueue(Map<String, Int> words) throws IOException
+        private PriorityQueue<object[]> createQueue(IDictionary<string, Int> words)
+        {
+            // have collected all words in doc and their freqs
+            int numDocs = ir.NumDocs;
+            FreqQ res = new FreqQ(words.Count); // will order words by score
+
+            foreach (string word in words.Keys) // for every word
+            {
+                int tf = words[word].x; // term freq in the source doc
+                if (MinTermFreq > 0 && tf < MinTermFreq)
+                {
+                    continue; // filter out words that don't occur enough times in the source
+                }
+
+                // go through all the fields and find the largest document frequency
+                string topField = FieldNames[0];
+                int docFreq = 0;
+                foreach (string fieldName in FieldNames)
+                {
+                    int freq = ir.DocFreq(new Term(fieldName, word));
+                    topField = (freq > docFreq) ? fieldName : topField;
+                    docFreq = (freq > docFreq) ? freq : docFreq;
+                }
+
+                if (MinDocFreq > 0 && docFreq < MinDocFreq)
+                {
+                    continue; // filter out words that don't occur in enough docs
+                }
+
+                if (docFreq > MaxDocFreq)
+                {
+                    continue; // filter out words that occur in too many docs
+                }
+
+                if (docFreq == 0)
+                {
+                    continue; // index update problem?
+                }
+
+                float idf = Similarity.Idf(docFreq, numDocs);
+                float score = tf * idf;
+
+                // only really need 1st 3 entries, other ones are for troubleshooting
+                res.InsertWithOverflow(new object[] { word, topField, score, idf, docFreq, tf }); // freq in all docs -  idf -  overall score -  the top field -  the word
+            }
+            return res;
+        }
+
+        /// <summary>
+        /// Describe the parameters that control how the "more like this" query is formed.
+        /// </summary>
+        public string describeParams()
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append("\t").Append("maxQueryTerms  : ").Append(MaxQueryTerms).Append("\n");
+            sb.Append("\t").Append("minWordLen     : ").Append(MinWordLen).Append("\n");
+            sb.Append("\t").Append("maxWordLen     : ").Append(MaxWordLen).Append("\n");
+            sb.Append("\t").Append("fieldNames     : ");
+            string delim = "";
+            foreach (string fieldName in FieldNames)
+            {
+                sb.Append(delim).Append(fieldName);
+                delim = ", ";
+            }
+            sb.Append("\n");
+            sb.Append("\t").Append("boost          : ").Append(Boost).Append("\n");
+            sb.Append("\t").Append("minTermFreq    : ").Append(MinTermFreq).Append("\n");
+            sb.Append("\t").Append("minDocFreq     : ").Append(MinDocFreq).Append("\n");
+            return sb.ToString();
+        }
+
+        /// <summary>
+        /// Find words for a more-like-this query former.
+        /// </summary>
+        /// <param name="docNum"> the id of the lucene document from which to find terms </param>
+        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+        //ORIGINAL LINE: public org.apache.lucene.util.PriorityQueue<Object[]> retrieveTerms(int docNum) throws IOException
+        public PriorityQueue<object[]> RetrieveTerms(int docNum)
+        {
+            IDictionary<string, Int> termFreqMap = new Dictionary<string, Int>();
+            foreach (string fieldName in FieldNames)
+            {
+                //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+                //ORIGINAL LINE: final org.apache.lucene.index.Fields vectors = ir.getTermVectors(docNum);
+                Fields vectors = ir.GetTermVectors(docNum);
+                //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+                //ORIGINAL LINE: final org.apache.lucene.index.Terms vector;
+                Terms vector;
+                if (vectors != null)
+                {
+                    vector = vectors.Terms(fieldName);
+                }
+                else
+                {
+                    vector = null;
+                }
+
+                // field does not store term vector info
+                if (vector == null)
+                {
+                    Document d = ir.Document(docNum);
+                    IndexableField[] fields = d.GetFields(fieldName);
+                    foreach (IndexableField field in fields)
+                    {
+                        string stringValue = field.StringValue;
+                        if (stringValue != null)
+                        {
+                            AddTermFrequencies(new StringReader(stringValue), termFreqMap, fieldName);
+                        }
+                    }
+                }
+                else
+                {
+                    AddTermFrequencies(termFreqMap, vector);
+                }
+            }
+
+            return createQueue(termFreqMap);
+        }
+
+        /// <summary>
+        /// Adds terms and frequencies found in vector into the Map termFreqMap
+        /// </summary>
+        /// <param name="termFreqMap"> a Map of terms and their frequencies </param>
+        /// <param name="vector"> List of terms and their frequencies for a doc/field </param>
+        private void AddTermFrequencies(IDictionary<string, Int> termFreqMap, Terms vector)
+        {
+            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+            //ORIGINAL LINE: final org.apache.lucene.index.TermsEnum termsEnum = vector.iterator(null);
+            TermsEnum termsEnum = vector.Iterator(null);
+            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+            //ORIGINAL LINE: final org.apache.lucene.util.CharsRef spare = new org.apache.lucene.util.CharsRef();
+            CharsRef spare = new CharsRef();
+            BytesRef text;
+            while ((text = termsEnum.Next()) != null)
+            {
+                UnicodeUtil.UTF8toUTF16(text, spare);
+                //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+                //ORIGINAL LINE: final String term = spare.toString();
+                string term = spare.ToString();
+                if (IsNoiseWord(term))
+                {
+                    continue;
+                }
+                //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+                //ORIGINAL LINE: final int freq = (int) termsEnum.totalTermFreq();
+                int freq = (int)termsEnum.TotalTermFreq();
+
+                // increment frequency
+                Int cnt = termFreqMap[term];
+                if (cnt == null)
+                {
+                    cnt = new Int();
+                    termFreqMap[term] = cnt;
+                    cnt.x = freq;
+                }
+                else
+                {
+                    cnt.x += freq;
+                }
+            }
+        }
+
+        /// <summary>
+        /// Adds term frequencies found by tokenizing text from reader into the Map words
+        /// </summary>
+        /// <param name="r"> a source of text to be tokenized </param>
+        /// <param name="termFreqMap"> a Map of terms and their frequencies </param>
+        /// <param name="fieldName"> Used by analyzer for any special per-field analysis </param>
+        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+        //ORIGINAL LINE: private void addTermFrequencies(Reader r, Map<String, Int> termFreqMap, String fieldName) throws IOException
+        private void AddTermFrequencies(Reader r, IDictionary<string, Int> termFreqMap, string fieldName)
+        {
+            if (Analyzer == null)
+            {
+                throw new System.NotSupportedException("To use MoreLikeThis without " + "term vectors, you must provide an Analyzer");
+            }
+            TokenStream ts = Analyzer.TokenStream(fieldName, r);
+            try
+            {
+                int tokenCount = 0;
+                // for every token
+                var termAtt = ts.AddAttribute<CharTermAttribute>();
+                ts.Reset();
+                while (ts.IncrementToken())
+                {
+                    string word = termAtt.ToString();
+                    tokenCount++;
+                    if (tokenCount > MaxNumTokensParsed)
+                    {
+                        break;
+                    }
+                    if (IsNoiseWord(word))
+                    {
+                        continue;
+                    }
+
+                    // increment frequency
+                    Int cnt = termFreqMap[word];
+                    if (cnt == null)
+                    {
+                        termFreqMap[word] = new Int();
+                    }
+                    else
+                    {
+                        cnt.x++;
+                    }
+                }
+                ts.End();
+            }
+            finally
+            {
+                IOUtils.CloseWhileHandlingException(ts);
+            }
+        }
+
+
+        /// <summary>
+        /// determines if the passed term is likely to be of interest in "more like" comparisons
+        /// </summary>
+        /// <param name="term"> The word being considered </param>
+        /// <returns> true if should be ignored, false if should be used in further analysis </returns>
+        private bool IsNoiseWord(string term)
+        {
+            int len = term.Length;
+            if (MinWordLen > 0 && len < MinWordLen)
+            {
+                return true;
+            }
+            if (MaxWordLen > 0 && len > MaxWordLen)
+            {
+                return true;
+            }
+            return StopWords != null && StopWords.Contains(term);
+        }
+
+
+        /// <summary>
+        /// Find words for a more-like-this query former.
+        /// The result is a priority queue of arrays with one entry for <b>every word</b> in the document.
+        /// Each array has 6 elements.
+        /// The elements are:
+        /// <ol>
+        /// <li> The word (String)
+        /// <li> The top field that this word comes from (String)
+        /// <li> The score for this word (Float)
+        /// <li> The IDF value (Float)
+        /// <li> The frequency of this word in the index (Integer)
+        /// <li> The frequency of this word in the source document (Integer)
+        /// </ol>
+        /// This is a somewhat "advanced" routine, and in general only the 1st entry in the array is of interest.
+        /// This method is exposed so that you can identify the "interesting words" in a document.
+        /// For an easier method to call see <seealso cref="#retrieveInterestingTerms retrieveInterestingTerms()"/>.
+        /// </summary>
+        /// <param name="r"> the reader that has the content of the document </param>
+        /// <param name="fieldName"> field passed to the analyzer to use when analyzing the content </param>
+        /// <returns> the most interesting words in the document ordered by score, with the highest scoring, or best entry, first </returns>
+        /// <seealso cref= #retrieveInterestingTerms </seealso>
+        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+        //ORIGINAL LINE: public org.apache.lucene.util.PriorityQueue<Object[]> retrieveTerms(Reader r, String fieldName) throws IOException
+        public PriorityQueue<object[]> RetrieveTerms(Reader r, string fieldName)
+        {
+            IDictionary<string, Int> words = new Dictionary<string, Int>();
+            AddTermFrequencies(r, words, fieldName);
+            return createQueue(words);
+        }
+
+        /// <seealso cref= #retrieveInterestingTerms(java.io.Reader, String) </seealso>
+        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+        //ORIGINAL LINE: public String[] retrieveInterestingTerms(int docNum) throws IOException
+        public string[] RetrieveInterestingTerms(int docNum)
+        {
+            var al = new List<object>(MaxQueryTerms);
+            var pq = RetrieveTerms(docNum);
+            object cur;
+            int lim = MaxQueryTerms; // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...
+            // we just want to return the top words
+            while (((cur = pq.Pop()) != null) && lim-- > 0)
+            {
+                object[] ar = (object[])cur;
+                al.Add(ar[0]); // the 1st entry is the interesting word
+            }
+            string[] res = new string[al.Count];
+            return al.ToArray(res);
+        }
+
+        /// <summary>
+        /// Convenience routine to make it easy to return the most interesting words in a document.
+        /// More advanced users will call <seealso cref="#retrieveTerms(Reader, String) retrieveTerms()"/> directly.
+        /// </summary>
+        /// <param name="r"> the source document </param>
+        /// <param name="fieldName"> field passed to analyzer to use when analyzing the content </param>
+        /// <returns> the most interesting words in the document </returns>
+        /// <seealso cref= #retrieveTerms(java.io.Reader, String) </seealso>
+        /// <seealso cref= #setMaxQueryTerms </seealso>
+        public string[] RetrieveInterestingTerms(Reader r, string fieldName)
+        {
+            List<object> al = new List<object>(MaxQueryTerms);
+            PriorityQueue<object[]> pq = RetrieveTerms(r, fieldName);
+            object cur;
+            int lim = MaxQueryTerms; // have to be careful, retrieveTerms returns all words but that's probably not useful to our caller...
+            // we just want to return the top words
+            while (((cur = pq.Pop()) != null) && lim-- > 0)
+            {
+                object[] ar = (object[])cur;
+                al.Add(ar[0]); // the 1st entry is the interesting word
+            }
+            string[] res = new string[al.Count];
+            return al.ToArray(res);
+        }
+
+        /// <summary>
+        /// PriorityQueue that orders words by score.
+        /// </summary>
+        private class FreqQ : PriorityQueue<object[]>
+        {
+            internal FreqQ(int s)
+                : base(s)
+            {
+            }
+
+            public override bool LessThan(object[] aa, object[] bb)
+            {
+                float? fa = (float?)aa[2];
+                float? fb = (float?)bb[2];
+                return fa > fb;
+            }
+        }
+
+        /// <summary>
+        /// Use for frequencies and to avoid renewing Integers.
+        /// </summary>
+        private class Int
+        {
+            internal int x;
+
+            internal Int()
+            {
+                x = 1;
+            }
+        }
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs b/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs
index d397720..c9dcbe9 100644
--- a/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs
+++ b/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs
@@ -1,8 +1,9 @@
 using System.Collections.Generic;
-
 /*
  * Created on 25-Jan-2006
  */
+using Lucene.Net.Queries.Mlt;
+
 namespace org.apache.lucene.queries.mlt
 {
 
@@ -206,7 +207,7 @@ namespace org.apache.lucene.queries.mlt
 		result = prime * result + minDocFreq;
 		result = prime * result + minTermFrequency;
 		result = prime * result + Arrays.GetHashCode(moreLikeFields);
-		result = prime * result + float.floatToIntBits(percentTermsToMatch);
+		result = prime * result + Number.FloatToIntBits(percentTermsToMatch);
 		result = prime * result + ((stopWords == null) ? 0 : stopWords.GetHashCode());
 		return result;
 	  }
@@ -275,7 +276,7 @@ namespace org.apache.lucene.queries.mlt
 		{
 			return false;
 		}
-		if (float.floatToIntBits(percentTermsToMatch) != float.floatToIntBits(other.percentTermsToMatch))
+		if (Number.FloatToIntBits(percentTermsToMatch) != Number.FloatToIntBits(other.percentTermsToMatch))
 		{
 			return false;
 		}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/TermFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/TermFilter.cs b/src/Lucene.Net.Queries/TermFilter.cs
index 1e4ffd0..d2580c7 100644
--- a/src/Lucene.Net.Queries/TermFilter.cs
+++ b/src/Lucene.Net.Queries/TermFilter.cs
@@ -1,139 +1,122 @@
-namespace org.apache.lucene.queries
-{
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using DocsEnum = org.apache.lucene.index.DocsEnum;
-	using Term = org.apache.lucene.index.Term;
-	using Terms = org.apache.lucene.index.Terms;
-	using TermsEnum = org.apache.lucene.index.TermsEnum;
-	using DocIdSet = org.apache.lucene.search.DocIdSet;
-	using DocIdSetIterator = org.apache.lucene.search.DocIdSetIterator;
-	using Filter = org.apache.lucene.search.Filter;
-	using Bits = org.apache.lucene.util.Bits;
-
-	/// <summary>
-	/// A filter that includes documents that match with a specific term.
-	/// </summary>
-	public sealed class TermFilter : Filter
-	{
-
-	  private readonly Term term;
-
-	  /// <param name="term"> The term documents need to have in order to be a match for this filter. </param>
-	  public TermFilter(Term term)
-	  {
-		if (term == null)
-		{
-		  throw new System.ArgumentException("Term must not be null");
-		}
-		else if (term.field() == null)
-		{
-		  throw new System.ArgumentException("Field must not be null");
-		}
-		this.term = term;
-	  }
-
-	  /// <returns> The term this filter includes documents with. </returns>
-	  public Term Term
-	  {
-		  get
-		  {
-			return term;
-		  }
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.AtomicReaderContext context, final org.apache.lucene.util.Bits acceptDocs) throws java.io.IOException
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-	  public override DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs)
-	  {
-		Terms terms = context.reader().terms(term.field());
-		if (terms == null)
-		{
-		  return null;
-		}
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.TermsEnum termsEnum = terms.iterator(null);
-		TermsEnum termsEnum = terms.iterator(null);
-		if (!termsEnum.seekExact(term.bytes()))
-		{
-		  return null;
-		}
-		return new DocIdSetAnonymousInnerClassHelper(this, acceptDocs, termsEnum);
-	  }
-
-	  private class DocIdSetAnonymousInnerClassHelper : DocIdSet
-	  {
-		  private readonly TermFilter outerInstance;
-
-		  private Bits acceptDocs;
-		  private TermsEnum termsEnum;
-
-		  public DocIdSetAnonymousInnerClassHelper(TermFilter outerInstance, Bits acceptDocs, TermsEnum termsEnum)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.acceptDocs = acceptDocs;
-			  this.termsEnum = termsEnum;
-		  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.search.DocIdSetIterator iterator() throws java.io.IOException
-		  public override DocIdSetIterator iterator()
-		  {
-			return termsEnum.docs(acceptDocs, null, DocsEnum.FLAG_NONE);
-		  }
-
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this == o)
-		{
-			return true;
-		}
-		if (o == null || this.GetType() != o.GetType())
-		{
-			return false;
-		}
-
-		TermFilter that = (TermFilter) o;
-
-		if (term != null ?!term.Equals(that.term) : that.term != null)
-		{
-			return false;
-		}
-
-		return true;
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return term != null ? term.GetHashCode() : 0;
-	  }
-
-	  public override string ToString()
-	  {
-		return term.field() + ":" + term.text();
-	  }
-
-	}
+namespace Lucene.Net.Queries
+{
 
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// A filter that includes documents that match with a specific term.
+    /// </summary>
+    public sealed class TermFilter : Filter
+    {
+
+        private readonly Term term;
+
+        /// <param name="term"> The term documents need to have in order to be a match for this filter. </param>
+        public TermFilter(Term term)
+        {
+            if (term == null)
+            {
+                throw new System.ArgumentException("Term must not be null");
+            }
+            else if (term.Field() == null)
+            {
+                throw new System.ArgumentException("Field must not be null");
+            }
+            this.term = term;
+        }
+
+        /// <returns> The term this filter includes documents with. </returns>
+        public Term Term
+        {
+            get
+            {
+                return term;
+            }
+        }
+
+        public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
+        {
+            Terms terms = context.AtomicReader.Terms(term.Field());
+            if (terms == null)
+            {
+                return null;
+            }
+
+            TermsEnum termsEnum = terms.Iterator(null);
+            if (!termsEnum.SeekExact(term.Bytes()))
+            {
+                return null;
+            }
+            return new DocIdSetAnonymousInnerClassHelper(this, acceptDocs, termsEnum);
+        }
+
+        private class DocIdSetAnonymousInnerClassHelper : DocIdSet
+        {
+            private readonly TermFilter outerInstance;
+
+            private Bits acceptDocs;
+            private TermsEnum termsEnum;
+
+            public DocIdSetAnonymousInnerClassHelper(TermFilter outerInstance, Bits acceptDocs, TermsEnum termsEnum)
+            {
+                this.outerInstance = outerInstance;
+                this.acceptDocs = acceptDocs;
+                this.termsEnum = termsEnum;
+            }
+
+            public override DocIdSetIterator GetIterator()
+            {
+                return termsEnum.Docs(acceptDocs, null, DocsEnum.FLAG_NONE);
+            }
+        }
+
+        public override bool Equals(object o)
+        {
+            if (this == o)
+            {
+                return true;
+            }
+            if (o == null || this.GetType() != o.GetType())
+            {
+                return false;
+            }
+
+            TermFilter that = (TermFilter)o;
+
+            if (term != null ? !term.Equals(that.term) : that.term != null)
+            {
+                return false;
+            }
+
+            return true;
+        }
+
+        public override int GetHashCode()
+        {
+            return term != null ? term.GetHashCode() : 0;
+        }
+
+        public override string ToString()
+        {
+            return term.Field() + ":" + term.Text();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/TermsFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/TermsFilter.cs b/src/Lucene.Net.Queries/TermsFilter.cs
index be418fb..667cd55 100644
--- a/src/Lucene.Net.Queries/TermsFilter.cs
+++ b/src/Lucene.Net.Queries/TermsFilter.cs
@@ -1,8 +1,13 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using System.Text;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Support;
+using Lucene.Net.Util;
 
-namespace org.apache.lucene.queries
+namespace Lucene.Net.Queries
 {
 
 	/*
@@ -21,18 +26,7 @@ namespace org.apache.lucene.queries
 	 * See the License for the specific language governing permissions and
 	 * limitations under the License.
 	 */
-
-	using org.apache.lucene.index;
-	using DocIdSet = org.apache.lucene.search.DocIdSet;
-	using DocIdSetIterator = org.apache.lucene.search.DocIdSetIterator;
-	using Filter = org.apache.lucene.search.Filter;
-	using ArrayUtil = org.apache.lucene.util.ArrayUtil;
-	using Bits = org.apache.lucene.util.Bits;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-	using FixedBitSet = org.apache.lucene.util.FixedBitSet;
-
-
-	/// <summary>
+    /// <summary>
 	/// Constructs a filter for docs matching any of the terms added to this class.
 	/// Unlike a RangeFilter this can be used for filtering on multiple terms that are not necessarily in
 	/// a sequence. An example might be a collection of primary keys from a database query result or perhaps
@@ -62,8 +56,6 @@ namespace org.apache.lucene.queries
 	  /// Creates a new <seealso cref="TermsFilter"/> from the given list. The list
 	  /// can contain duplicate terms and multiple fields.
 	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-//ORIGINAL LINE: public TermsFilter(final java.util.List<Term> terms)
 	  public TermsFilter(IList<Term> terms) : this(new FieldAndTermEnumAnonymousInnerClassHelper(this, terms), terms.Count)
 	  {
 	  }
@@ -82,10 +74,10 @@ namespace org.apache.lucene.queries
 		  }
 
 			// we need to sort for deduplication and to have a common cache key
-		  internal readonly IEnumerator<Term> iter;
-		  public override BytesRef next()
+		  readonly IEnumerator<Term> iter;
+		  public override BytesRef Next()
 		  {
-			if (iter.hasNext())
+			if (iter.HasNext())
 			{
 			  Term next = iter.next();
 			  field = next.field();
@@ -99,8 +91,6 @@ namespace org.apache.lucene.queries
 	  /// Creates a new <seealso cref="TermsFilter"/> from the given <seealso cref="BytesRef"/> list for
 	  /// a single field.
 	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-//ORIGINAL LINE: public TermsFilter(final String field, final java.util.List<org.apache.lucene.util.BytesRef> terms)
 	  public TermsFilter(string field, IList<BytesRef> terms) : this(new FieldAndTermEnumAnonymousInnerClassHelper2(this, field, terms), terms.Count)
 	  {
 	  }
@@ -115,16 +105,16 @@ namespace org.apache.lucene.queries
 		  {
 			  this.outerInstance = outerInstance;
 			  this.terms = terms;
-			  iter = sort(terms).GetEnumerator();
+			  iter = Sort(terms).GetEnumerator();
 		  }
 
 			// we need to sort for deduplication and to have a common cache key
-		  internal readonly IEnumerator<BytesRef> iter;
-		  public override BytesRef next()
+		  readonly IEnumerator<BytesRef> iter;
+		  public override BytesRef Next()
 		  {
-			if (iter.hasNext())
+			if (iter.HasNext())
 			{
-			  return iter.next();
+			  return iter.Next();
 			}
 			return null;
 		  }
@@ -134,9 +124,7 @@ namespace org.apache.lucene.queries
 	  /// Creates a new <seealso cref="TermsFilter"/> from the given <seealso cref="BytesRef"/> array for
 	  /// a single field.
 	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-//ORIGINAL LINE: public TermsFilter(final String field, final org.apache.lucene.util.BytesRef...terms)
-	  public TermsFilter(string field, params BytesRef[] terms) : this(field, Arrays.asList(terms))
+	  public TermsFilter(string field, params BytesRef[] terms) : this(field, Arrays.AsList(terms))
 	  {
 		// this ctor prevents unnecessary Term creations
 	  }
@@ -145,9 +133,7 @@ namespace org.apache.lucene.queries
 	  /// Creates a new <seealso cref="TermsFilter"/> from the given array. The array can
 	  /// contain duplicate terms and multiple fields.
 	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-//ORIGINAL LINE: public TermsFilter(final Term... terms)
-	  public TermsFilter(params Term[] terms) : this(Arrays.asList(terms))
+	  public TermsFilter(params Term[] terms) : this(terms.ToList())
 	  {
 	  }
 
@@ -175,7 +161,7 @@ namespace org.apache.lucene.queries
 		string previousField = null;
 		BytesRef currentTerm;
 		string currentField;
-		while ((currentTerm = iter.next()) != null)
+		while ((currentTerm = iter.Next()) != null)
 		{
 		  currentField = iter.field();
 		  if (currentField == null)
@@ -187,15 +173,13 @@ namespace org.apache.lucene.queries
 			// deduplicate
 			if (previousField.Equals(currentField))
 			{
-			  if (previousTerm.bytesEquals(currentTerm))
+			  if (previousTerm.BytesEquals(currentTerm))
 			  {
 				continue;
 			  }
 			}
 			else
 			{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int start = lastTermsAndField == null ? 0 : lastTermsAndField.end;
 			  int start = lastTermsAndField == null ? 0 : lastTermsAndField.end;
 			  lastTermsAndField = new TermsAndField(start, index, previousField);
 			  termsAndFields.Add(lastTermsAndField);
@@ -215,31 +199,20 @@ namespace org.apache.lucene.queries
 		  previousField = currentField;
 		}
 		offsets[index] = lastEndOffset;
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int start = lastTermsAndField == null ? 0 : lastTermsAndField.end;
 		int start = lastTermsAndField == null ? 0 : lastTermsAndField.end;
 		lastTermsAndField = new TermsAndField(start, index, previousField);
 		termsAndFields.Add(lastTermsAndField);
-		this.termsBytes = ArrayUtil.shrink(serializedTerms, lastEndOffset);
+		this.termsBytes = ArrayUtil.Shrink(serializedTerms, lastEndOffset);
 		this.termsAndFields = termsAndFields.ToArray();
 		this.hashCode_Renamed = hash;
 
 	  }
 
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.search.DocIdSet getDocIdSet(AtomicReaderContext context, org.apache.lucene.util.Bits acceptDocs) throws java.io.IOException
-	  public override DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs)
+	  public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
 	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final AtomicReader reader = context.reader();
-		AtomicReader reader = context.reader();
+		AtomicReader reader = context.AtomicReader;
 		FixedBitSet result = null; // lazy init if needed - no need to create a big bitset ahead of time
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final Fields fields = reader.fields();
-		Fields fields = reader.fields();
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.BytesRef spare = new org.apache.lucene.util.BytesRef(this.termsBytes);
+		Fields fields = reader.Fields;
 		BytesRef spare = new BytesRef(this.termsBytes);
 		if (fields == null)
 		{
@@ -250,7 +223,7 @@ namespace org.apache.lucene.queries
 		DocsEnum docs = null;
 		foreach (TermsAndField termsAndField in this.termsAndFields)
 		{
-		  if ((terms = fields.terms(termsAndField.field)) != null)
+		  if ((terms = fields.Terms(termsAndField.field)) != null)
 		  {
 			termsEnum = terms.iterator(termsEnum); // this won't return null
 			for (int i = termsAndField.start; i < termsAndField.end; i++)
@@ -321,15 +294,15 @@ namespace org.apache.lucene.queries
 		  TermsAndField current = termsAndFields[i];
 		  for (int j = current.start; j < current.end; j++)
 		  {
-			spare.offset = offsets[j];
-			spare.length = offsets[j + 1] - offsets[j];
+			spare.Offset = offsets[j];
+			spare.Length = offsets[j + 1] - offsets[j];
 			if (!first)
 			{
 			  builder.Append(' ');
 			}
 			first = false;
 			builder.Append(current.field).Append(':');
-			builder.Append(spare.utf8ToString());
+			builder.Append(spare.Utf8ToString());
 		  }
 		}
 
@@ -401,9 +374,9 @@ namespace org.apache.lucene.queries
 
 	  private abstract class FieldAndTermEnum
 	  {
-		protected internal string field_Renamed;
+		protected internal string field;
 
-		public abstract BytesRef next();
+		public abstract BytesRef Next();
 
 		public FieldAndTermEnum()
 		{
@@ -411,13 +384,13 @@ namespace org.apache.lucene.queries
 
 		public FieldAndTermEnum(string field)
 		{
-			this.field_Renamed = field;
+			this.field = field;
 		}
 
-		public virtual string field()
-		{
-		  return field_Renamed;
-		}
+	      public virtual string Field
+	      {
+	          get { return field; }
+	      }
 	  }
 
 	  /*
@@ -425,7 +398,7 @@ namespace org.apache.lucene.queries
 	   */
 //JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET:
 //ORIGINAL LINE: private static <T extends Comparable<? base T>> java.util.List<T> sort(java.util.List<T> toSort)
-	  private static IList<T> sort<T>(IList<T> toSort) where T : Comparable<? base T>
+	  private static IList<T> Sort<T>(IList<T> toSort) where T : Comparable<? base T>
 	  {
 		if (toSort.Count == 0)
 		{


[03/21] git commit: Fixed TestDoubleBarrelLRUCache.TestThreadCorrectness

Posted by sy...@apache.org.
Fixed TestDoubleBarrelLRUCache.TestThreadCorrectness

Faulty equals() had led to runtime an type error. Time comparison with
current time was incorrectly C#ized.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/9b9b4a26
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/9b9b4a26
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/9b9b4a26

Branch: refs/heads/master
Commit: 9b9b4a264dc0e02f9c2bc57891bbd652029ba5c5
Parents: 95cd6c2
Author: Prad Nelluru <pr...@microsoft.com>
Authored: Tue Sep 16 12:01:20 2014 -0700
Committer: Prad Nelluru <pr...@microsoft.com>
Committed: Tue Sep 16 12:01:20 2014 -0700

----------------------------------------------------------------------
 .../core/Util/TestDoubleBarrelLRUCache.cs              | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9b9b4a26/src/Lucene.Net.Tests/core/Util/TestDoubleBarrelLRUCache.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestDoubleBarrelLRUCache.cs b/src/Lucene.Net.Tests/core/Util/TestDoubleBarrelLRUCache.cs
index 6c87358..5b3f7bb 100644
--- a/src/Lucene.Net.Tests/core/Util/TestDoubleBarrelLRUCache.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestDoubleBarrelLRUCache.cs
@@ -79,10 +79,10 @@ namespace Lucene.Net.Util
 
             internal readonly CloneableObject[] Objs;
             internal readonly DoubleBarrelLRUCache<CloneableObject, object> c;
-            internal readonly long EndTime;
+            internal readonly DateTime EndTime;
             internal volatile bool Failed;
 
-            public CacheThread(TestDoubleBarrelLRUCache outerInstance, DoubleBarrelLRUCache<CloneableObject, object> c, CloneableObject[] objs, long endTime)
+            public CacheThread(TestDoubleBarrelLRUCache outerInstance, DoubleBarrelLRUCache<CloneableObject, object> c, CloneableObject[] objs, DateTime endTime)
             {
                 this.OuterInstance = outerInstance;
                 this.c = c;
@@ -115,7 +115,7 @@ namespace Lucene.Net.Util
                         }
                         if ((++count % 10000) == 0)
                         {
-                            if (DateTime.Now.Millisecond >= EndTime)
+                            if (DateTime.Now.CompareTo(EndTime) > 0)
                             {
                                 break;
                             }
@@ -156,7 +156,7 @@ namespace Lucene.Net.Util
             }
 
             CacheThread[] threads = new CacheThread[NUM_THREADS];
-            long endTime = DateTime.Now.Millisecond + 1000L;
+            DateTime endTime = DateTime.Now.AddSeconds(1);
             for (int i = 0; i < NUM_THREADS; i++)
             {
                 threads[i] = new CacheThread(this, c, objs, endTime);
@@ -181,7 +181,10 @@ namespace Lucene.Net.Util
 
             public override bool Equals(object other)
             {
-                return this.Value.Equals(((CloneableObject)other).Value);
+                if (other.GetType().Equals(typeof (CloneableObject)))
+                    return this.Value.Equals(((CloneableObject) other).Value);
+                else
+                    return false;
             }
 
             public override int GetHashCode()


[10/21] Moving ValueSource -> ValueSources to avoid name conflicts

Posted by sy...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs
new file mode 100644
index 0000000..c9b467a
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    internal class ConstIntDocValues : IntDocValues
+	{
+	  internal readonly int ival;
+	  internal readonly float fval;
+	  internal readonly double dval;
+	  internal readonly long lval;
+	  internal readonly string sval;
+	  internal readonly ValueSource parent;
+
+	  internal ConstIntDocValues(int val, ValueSource parent) : base(parent)
+	  {
+		ival = val;
+		fval = val;
+		dval = val;
+		lval = val;
+		sval = Convert.ToString(val);
+		this.parent = parent;
+	  }
+
+	  public override float floatVal(int doc)
+	  {
+		return fval;
+	  }
+	  public override int intVal(int doc)
+	  {
+		return ival;
+	  }
+	  public override long longVal(int doc)
+	  {
+		return lval;
+	  }
+	  public override double doubleVal(int doc)
+	  {
+		return dval;
+	  }
+	  public override string strVal(int doc)
+	  {
+		return sval;
+	  }
+	  public override string ToString(int doc)
+	  {
+		return parent.description() + '=' + sval;
+	  }
+	}
+
+	internal class ConstDoubleDocValues : DoubleDocValues
+	{
+	  internal readonly int ival;
+	  internal readonly float fval;
+	  internal readonly double dval;
+	  internal readonly long lval;
+	  internal readonly string sval;
+	  internal readonly ValueSource parent;
+
+	  internal ConstDoubleDocValues(double val, ValueSource parent) : base(parent)
+	  {
+		ival = (int)val;
+		fval = (float)val;
+		dval = val;
+		lval = (long)val;
+		sval = Convert.ToString(val);
+		this.parent = parent;
+	  }
+
+	  public override float floatVal(int doc)
+	  {
+		return fval;
+	  }
+	  public override int intVal(int doc)
+	  {
+		return ival;
+	  }
+	  public override long longVal(int doc)
+	  {
+		return lval;
+	  }
+	  public override double doubleVal(int doc)
+	  {
+		return dval;
+	  }
+	  public override string strVal(int doc)
+	  {
+		return sval;
+	  }
+	  public override string ToString(int doc)
+	  {
+		return parent.description() + '=' + sval;
+	  }
+	}
+
+
+	/// <summary>
+	/// <code>DocFreqValueSource</code> returns the number of documents containing the term.
+	/// @lucene.internal
+	/// </summary>
+	public class DocFreqValueSource : ValueSource
+	{
+	  protected internal readonly string field;
+	  protected internal readonly string indexedField;
+	  protected internal readonly string val;
+	  protected internal readonly BytesRef indexedBytes;
+
+	  public DocFreqValueSource(string field, string val, string indexedField, BytesRef indexedBytes)
+	  {
+		this.field = field;
+		this.val = val;
+		this.indexedField = indexedField;
+		this.indexedBytes = indexedBytes;
+	  }
+
+	  public virtual string name()
+	  {
+		return "docfreq";
+	  }
+
+	  public override string description()
+	  {
+		return name() + '(' + field + ',' + val + ')';
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		IndexSearcher searcher = (IndexSearcher)context["searcher"];
+		int docfreq = searcher.IndexReader.docFreq(new Term(indexedField, indexedBytes));
+		return new ConstIntDocValues(docfreq, this);
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		context["searcher"] = searcher;
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return this.GetType().GetHashCode() + indexedField.GetHashCode() * 29 + indexedBytes.GetHashCode();
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this.GetType() != o.GetType())
+		{
+			return false;
+		}
+		DocFreqValueSource other = (DocFreqValueSource)o;
+		return this.indexedField.Equals(other.indexedField) && this.indexedBytes.Equals(other.indexedBytes);
+	  }
+	}
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs
new file mode 100644
index 0000000..97806b5
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Function that returns a constant double value for every document.
+	/// </summary>
+	public class DoubleConstValueSource : ConstNumberSource
+	{
+	  internal readonly double constant;
+	  private readonly float fv;
+	  private readonly long lv;
+
+	  public DoubleConstValueSource(double constant)
+	  {
+		this.constant = constant;
+		this.fv = (float)constant;
+		this.lv = (long)constant;
+	  }
+
+	  public override string description()
+	  {
+		return "const(" + constant + ")";
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		return new DoubleDocValuesAnonymousInnerClassHelper(this, this);
+	  }
+
+	  private class DoubleDocValuesAnonymousInnerClassHelper : DoubleDocValues
+	  {
+		  private readonly DoubleConstValueSource outerInstance;
+
+		  public DoubleDocValuesAnonymousInnerClassHelper(DoubleConstValueSource outerInstance, DoubleConstValueSource this) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return outerInstance.fv;
+		  }
+
+		  public override int intVal(int doc)
+		  {
+			return (int) outerInstance.lv;
+		  }
+
+		  public override long longVal(int doc)
+		  {
+			return outerInstance.lv;
+		  }
+
+		  public override double doubleVal(int doc)
+		  {
+			return outerInstance.constant;
+		  }
+
+		  public override string strVal(int doc)
+		  {
+			return Convert.ToString(outerInstance.constant);
+		  }
+
+		  public override object objectVal(int doc)
+		  {
+			return outerInstance.constant;
+		  }
+
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.description();
+		  }
+	  }
+
+	  public override int GetHashCode()
+	  {
+		long bits = double.doubleToRawLongBits(constant);
+		return (int)(bits ^ ((long)((ulong)bits >> 32)));
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (!(o is DoubleConstValueSource))
+		{
+			return false;
+		}
+		DoubleConstValueSource other = (DoubleConstValueSource) o;
+		return this.constant == other.constant;
+	  }
+
+	  public override int Int
+	  {
+		  get
+		  {
+			return (int)lv;
+		  }
+	  }
+
+	  public override long Long
+	  {
+		  get
+		  {
+			return lv;
+		  }
+	  }
+
+	  public override float Float
+	  {
+		  get
+		  {
+			return fv;
+		  }
+	  }
+
+	  public override double Double
+	  {
+		  get
+		  {
+			return constant;
+		  }
+	  }
+
+	  public override Number Number
+	  {
+		  get
+		  {
+			return constant;
+		  }
+	  }
+
+	  public override bool Bool
+	  {
+		  get
+		  {
+			return constant != 0;
+		  }
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/DoubleFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DoubleFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/DoubleFieldSource.cs
new file mode 100644
index 0000000..d9c09dc
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DoubleFieldSource.cs
@@ -0,0 +1,140 @@
+using System.Collections;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Obtains double field values from <seealso cref="FieldCache#getDoubles"/> and makes
+	/// those values available as other numeric types, casting as needed.
+	/// </summary>
+	public class DoubleFieldSource : FieldCacheSource
+	{
+
+	  protected internal readonly FieldCache.DoubleParser parser;
+
+	  public DoubleFieldSource(string field) : this(field, null)
+	  {
+	  }
+
+	  public DoubleFieldSource(string field, FieldCache.DoubleParser parser) : base(field)
+	  {
+		this.parser = parser;
+	  }
+
+	  public override string description()
+	  {
+		return "double(" + field + ')';
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Doubles arr = cache.getDoubles(readerContext.reader(), field, parser, true);
+		FieldCache.Doubles arr = cache.getDoubles(readerContext.reader(), field, parser, true);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.util.Bits valid = cache.getDocsWithField(readerContext.reader(), field);
+		Bits valid = cache.getDocsWithField(readerContext.reader(), field);
+		return new DoubleDocValuesAnonymousInnerClassHelper(this, this, arr, valid);
+
+	  }
+
+	  private class DoubleDocValuesAnonymousInnerClassHelper : DoubleDocValues
+	  {
+		  private readonly DoubleFieldSource outerInstance;
+
+		  private FieldCache.Doubles arr;
+		  private Bits valid;
+
+		  public DoubleDocValuesAnonymousInnerClassHelper(DoubleFieldSource outerInstance, DoubleFieldSource this, FieldCache.Doubles arr, Bits valid) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.arr = arr;
+			  this.valid = valid;
+		  }
+
+		  public override double doubleVal(int doc)
+		  {
+			return arr.get(doc);
+		  }
+
+		  public override bool exists(int doc)
+		  {
+			return arr.get(doc) != 0 || valid.get(doc);
+		  }
+
+		  public override ValueFiller ValueFiller
+		  {
+			  get
+			  {
+				return new ValueFillerAnonymousInnerClassHelper(this);
+			  }
+		  }
+
+		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
+		  {
+			  private readonly DoubleDocValuesAnonymousInnerClassHelper outerInstance;
+
+			  public ValueFillerAnonymousInnerClassHelper(DoubleDocValuesAnonymousInnerClassHelper outerInstance)
+			  {
+				  this.outerInstance = outerInstance;
+				  mval = new MutableValueDouble();
+			  }
+
+			  private readonly MutableValueDouble mval;
+
+			  public override MutableValue Value
+			  {
+				  get
+				  {
+					return mval;
+				  }
+			  }
+
+			  public override void fillValue(int doc)
+			  {
+				mval.value = outerInstance.arr.get(doc);
+				mval.exists = mval.value != 0 || outerInstance.valid.get(doc);
+			  }
+		  }
+
+
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (o.GetType() != typeof(DoubleFieldSource))
+		{
+			return false;
+		}
+		DoubleFieldSource other = (DoubleFieldSource) o;
+		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int h = parser == null ? typeof(double?).GetHashCode() : parser.GetType().GetHashCode();
+		h += base.GetHashCode();
+		return h;
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/DualFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DualFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/DualFloatFunction.cs
new file mode 100644
index 0000000..47a0b42
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DualFloatFunction.cs
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Abstract <seealso cref="ValueSource"/> implementation which wraps two ValueSources
+	/// and applies an extendible float function to their values.
+	/// 
+	/// </summary>
+	public abstract class DualFloatFunction : ValueSource
+	{
+	  protected internal readonly ValueSource a;
+	  protected internal readonly ValueSource b;
+
+	 /// <param name="a">  the base. </param>
+	 /// <param name="b">  the exponent. </param>
+	  public DualFloatFunction(ValueSource a, ValueSource b)
+	  {
+		this.a = a;
+		this.b = b;
+	  }
+
+	  protected internal abstract string name();
+	  protected internal abstract float func(int doc, FunctionValues aVals, FunctionValues bVals);
+
+	  public override string description()
+	  {
+		return name() + "(" + a.description() + "," + b.description() + ")";
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues aVals = a.getValues(context, readerContext);
+		FunctionValues aVals = a.getValues(context, readerContext);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues bVals = b.getValues(context, readerContext);
+		FunctionValues bVals = b.getValues(context, readerContext);
+		return new FloatDocValuesAnonymousInnerClassHelper(this, this, aVals, bVals);
+	  }
+
+	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+	  {
+		  private readonly DualFloatFunction outerInstance;
+
+		  private FunctionValues aVals;
+		  private FunctionValues bVals;
+
+		  public FloatDocValuesAnonymousInnerClassHelper(DualFloatFunction outerInstance, DualFloatFunction this, FunctionValues aVals, FunctionValues bVals) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.aVals = aVals;
+			  this.bVals = bVals;
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return outerInstance.func(doc, aVals, bVals);
+		  }
+
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.name() + '(' + aVals.ToString(doc) + ',' + bVals.ToString(doc) + ')';
+		  }
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		a.createWeight(context,searcher);
+		b.createWeight(context,searcher);
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int h = a.GetHashCode();
+		h ^= (h << 13) | ((int)((uint)h >> 20));
+		h += b.GetHashCode();
+		h ^= (h << 23) | ((int)((uint)h >> 10));
+		h += name().GetHashCode();
+		return h;
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this.GetType() != o.GetType())
+		{
+			return false;
+		}
+		DualFloatFunction other = (DualFloatFunction)o;
+		return this.a.Equals(other.a) && this.b.Equals(other.b);
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
new file mode 100644
index 0000000..a7fe04c
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
@@ -0,0 +1,335 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+
+	/*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+    /// <summary>
+	/// Obtains int field values from <seealso cref="FieldCache#getInts"/> and makes
+	/// those values available as other numeric types, casting as needed.
+	/// strVal of the value is not the int value, but its string (displayed) value
+	/// </summary>
+	public class EnumFieldSource : FieldCacheSource
+	{
+	  internal const int? DEFAULT_VALUE = -1;
+
+	  internal readonly FieldCache.IntParser parser;
+	  internal readonly IDictionary<int?, string> enumIntToStringMap;
+	  internal readonly IDictionary<string, int?> enumStringToIntMap;
+
+	  public EnumFieldSource(string field, FieldCache.IntParser parser, IDictionary<int?, string> enumIntToStringMap, IDictionary<string, int?> enumStringToIntMap) : base(field)
+	  {
+		this.parser = parser;
+		this.enumIntToStringMap = enumIntToStringMap;
+		this.enumStringToIntMap = enumStringToIntMap;
+	  }
+
+	  private static int? tryParseInt(string valueStr)
+	  {
+		int? intValue = null;
+		try
+		{
+		  intValue = Convert.ToInt32(valueStr);
+		}
+		catch (NumberFormatException)
+		{
+		}
+		return intValue;
+	  }
+
+	  private string intValueToStringValue(int? intVal)
+	  {
+		if (intVal == null)
+		{
+		  return null;
+		}
+
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final String enumString = enumIntToStringMap.get(intVal);
+		string enumString = enumIntToStringMap[intVal];
+		if (enumString != null)
+		{
+		  return enumString;
+		}
+		// can't find matching enum name - return DEFAULT_VALUE.toString()
+		return DEFAULT_VALUE.ToString();
+	  }
+
+	  private int? stringValueToIntValue(string stringVal)
+	  {
+		if (stringVal == null)
+		{
+		  return null;
+		}
+
+		int? intValue;
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final Integer enumInt = enumStringToIntMap.get(stringVal);
+		int? enumInt = enumStringToIntMap[stringVal];
+		if (enumInt != null) //enum int found for string
+		{
+		  return enumInt;
+		}
+
+		//enum int not found for string
+		intValue = tryParseInt(stringVal);
+		if (intValue == null) //not Integer
+		{
+		  intValue = DEFAULT_VALUE;
+		}
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final String enumString = enumIntToStringMap.get(intValue);
+		string enumString = enumIntToStringMap[intValue];
+		if (enumString != null) //has matching string
+		{
+		  return intValue;
+		}
+
+		return DEFAULT_VALUE;
+	  }
+
+	  public override string description()
+	  {
+		return "enum(" + field + ')';
+	  }
+
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Ints arr = cache.getInts(readerContext.reader(), field, parser, true);
+		FieldCache.Ints arr = cache.getInts(readerContext.reader(), field, parser, true);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.util.Bits valid = cache.getDocsWithField(readerContext.reader(), field);
+		Bits valid = cache.getDocsWithField(readerContext.reader(), field);
+
+		return new IntDocValuesAnonymousInnerClassHelper(this, this, arr, valid);
+	  }
+
+	  private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
+	  {
+		  private readonly EnumFieldSource outerInstance;
+
+		  private FieldCache.Ints arr;
+		  private Bits valid;
+
+		  public IntDocValuesAnonymousInnerClassHelper(EnumFieldSource outerInstance, EnumFieldSource this, FieldCache.Ints arr, Bits valid) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.arr = arr;
+			  this.valid = valid;
+			  val = new MutableValueInt();
+		  }
+
+		  internal readonly MutableValueInt val;
+
+		  public override float floatVal(int doc)
+		  {
+			return (float) arr.get(doc);
+		  }
+
+		  public override int intVal(int doc)
+		  {
+			return arr.get(doc);
+		  }
+
+		  public override long longVal(int doc)
+		  {
+			return (long) arr.get(doc);
+		  }
+
+		  public override double doubleVal(int doc)
+		  {
+			return (double) arr.get(doc);
+		  }
+
+		  public override string strVal(int doc)
+		  {
+			int? intValue = arr.get(doc);
+			return outerInstance.intValueToStringValue(intValue);
+		  }
+
+		  public override object objectVal(int doc)
+		  {
+			return valid.get(doc) ? arr.get(doc) : null;
+		  }
+
+		  public override bool exists(int doc)
+		  {
+			return valid.get(doc);
+		  }
+
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.description() + '=' + strVal(doc);
+		  }
+
+
+		  public override ValueSourceScorer getRangeScorer(IndexReader reader, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
+		  {
+			int? lower = outerInstance.stringValueToIntValue(lowerVal);
+			int? upper = outerInstance.stringValueToIntValue(upperVal);
+
+			// instead of using separate comparison functions, adjust the endpoints.
+
+			if (lower == null)
+			{
+			  lower = int.MinValue;
+			}
+			else
+			{
+			  if (!includeLower && lower < int.MaxValue)
+			  {
+				  lower++;
+			  }
+			}
+
+			if (upper == null)
+			{
+			  upper = int.MaxValue;
+			}
+			else
+			{
+			  if (!includeUpper && upper > int.MinValue)
+			  {
+				  upper--;
+			  }
+			}
+
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final int ll = lower;
+			int ll = lower.Value;
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final int uu = upper;
+			int uu = upper.Value;
+
+			return new ValueSourceScorerAnonymousInnerClassHelper(this, reader, this, ll, uu);
+		  }
+
+		  private class ValueSourceScorerAnonymousInnerClassHelper : ValueSourceScorer
+		  {
+			  private readonly IntDocValuesAnonymousInnerClassHelper outerInstance;
+
+			  private int ll;
+			  private int uu;
+
+			  public ValueSourceScorerAnonymousInnerClassHelper(IntDocValuesAnonymousInnerClassHelper outerInstance, IndexReader reader, EnumFieldSource this, int ll, int uu) : base(reader, this)
+			  {
+				  this.outerInstance = outerInstance;
+				  this.ll = ll;
+				  this.uu = uu;
+			  }
+
+			  public override bool matchesValue(int doc)
+			  {
+				int val = outerInstance.arr.get(doc);
+				// only check for deleted if it's the default value
+				// if (val==0 && reader.isDeleted(doc)) return false;
+				return val >= ll && val <= uu;
+			  }
+		  }
+
+		  public override ValueFiller ValueFiller
+		  {
+			  get
+			  {
+				return new ValueFillerAnonymousInnerClassHelper(this);
+			  }
+		  }
+
+		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
+		  {
+			  private readonly IntDocValuesAnonymousInnerClassHelper outerInstance;
+
+			  public ValueFillerAnonymousInnerClassHelper(IntDocValuesAnonymousInnerClassHelper outerInstance)
+			  {
+				  this.outerInstance = outerInstance;
+				  mval = new MutableValueInt();
+			  }
+
+			  private readonly MutableValueInt mval;
+
+			  public override MutableValue Value
+			  {
+				  get
+				  {
+					return mval;
+				  }
+			  }
+
+			  public override void fillValue(int doc)
+			  {
+				mval.value = outerInstance.arr.get(doc);
+				mval.exists = outerInstance.valid.get(doc);
+			  }
+		  }
+
+
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this == o)
+		{
+			return true;
+		}
+		if (o == null || this.GetType() != o.GetType())
+		{
+			return false;
+		}
+		if (!base.Equals(o))
+		{
+			return false;
+		}
+
+		EnumFieldSource that = (EnumFieldSource) o;
+
+		if (!enumIntToStringMap.Equals(that.enumIntToStringMap))
+		{
+			return false;
+		}
+		if (!enumStringToIntMap.Equals(that.enumStringToIntMap))
+		{
+			return false;
+		}
+		if (!parser.Equals(that.parser))
+		{
+			return false;
+		}
+
+		return true;
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int result = base.GetHashCode();
+		result = 31 * result + parser.GetHashCode();
+		result = 31 * result + enumIntToStringMap.GetHashCode();
+		result = 31 * result + enumStringToIntMap.GetHashCode();
+		return result;
+	  }
+	}
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs
new file mode 100644
index 0000000..ab76bfa
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// A base class for ValueSource implementations that retrieve values for
+	/// a single field from the <seealso cref="org.apache.lucene.search.FieldCache"/>.
+	/// 
+	/// 
+	/// </summary>
+	public abstract class FieldCacheSource : ValueSource
+	{
+	  protected internal readonly string field;
+	  protected internal readonly FieldCache cache = FieldCache.DEFAULT;
+
+	  public FieldCacheSource(string field)
+	  {
+		this.field = field;
+	  }
+
+	  public virtual FieldCache FieldCache
+	  {
+		  get
+		  {
+			return cache;
+		  }
+	  }
+
+	  public virtual string Field
+	  {
+		  get
+		  {
+			return field;
+		  }
+	  }
+
+	  public override string description()
+	  {
+		return field;
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (!(o is FieldCacheSource))
+		{
+			return false;
+		}
+		FieldCacheSource other = (FieldCacheSource)o;
+		return this.field.Equals(other.field) && this.cache == other.cache;
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return cache.GetHashCode() + field.GetHashCode();
+	  }
+
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs
new file mode 100644
index 0000000..a40f119
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Obtains float field values from <seealso cref="FieldCache#getFloats"/> and makes those
+	/// values available as other numeric types, casting as needed.
+	/// </summary>
+	public class FloatFieldSource : FieldCacheSource
+	{
+
+	  protected internal readonly FieldCache.FloatParser parser;
+
+	  public FloatFieldSource(string field) : this(field, null)
+	  {
+	  }
+
+	  public FloatFieldSource(string field, FieldCache.FloatParser parser) : base(field)
+	  {
+		this.parser = parser;
+	  }
+
+	  public override string description()
+	  {
+		return "float(" + field + ')';
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Floats arr = cache.getFloats(readerContext.reader(), field, parser, true);
+		FieldCache.Floats arr = cache.getFloats(readerContext.reader(), field, parser, true);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.util.Bits valid = cache.getDocsWithField(readerContext.reader(), field);
+		Bits valid = cache.getDocsWithField(readerContext.reader(), field);
+
+		return new FloatDocValuesAnonymousInnerClassHelper(this, this, arr, valid);
+	  }
+
+	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+	  {
+		  private readonly FloatFieldSource outerInstance;
+
+		  private FieldCache.Floats arr;
+		  private Bits valid;
+
+		  public FloatDocValuesAnonymousInnerClassHelper(FloatFieldSource outerInstance, FloatFieldSource this, FieldCache.Floats arr, Bits valid) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.arr = arr;
+			  this.valid = valid;
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return arr.get(doc);
+		  }
+
+		  public override object objectVal(int doc)
+		  {
+			return valid.get(doc) ? arr.get(doc) : null;
+		  }
+
+		  public override bool exists(int doc)
+		  {
+			return arr.get(doc) != 0 || valid.get(doc);
+		  }
+
+		  public override ValueFiller ValueFiller
+		  {
+			  get
+			  {
+				return new ValueFillerAnonymousInnerClassHelper(this);
+			  }
+		  }
+
+		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
+		  {
+			  private readonly FloatDocValuesAnonymousInnerClassHelper outerInstance;
+
+			  public ValueFillerAnonymousInnerClassHelper(FloatDocValuesAnonymousInnerClassHelper outerInstance)
+			  {
+				  this.outerInstance = outerInstance;
+				  mval = new MutableValueFloat();
+			  }
+
+			  private readonly MutableValueFloat mval;
+
+			  public override MutableValue Value
+			  {
+				  get
+				  {
+					return mval;
+				  }
+			  }
+
+			  public override void fillValue(int doc)
+			  {
+				mval.value = outerInstance.arr.get(doc);
+				mval.exists = mval.value != 0 || outerInstance.valid.get(doc);
+			  }
+		  }
+
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (o.GetType() != typeof(FloatFieldSource))
+		{
+			return false;
+		}
+		FloatFieldSource other = (FloatFieldSource)o;
+		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int h = parser == null ? typeof(float?).GetHashCode() : parser.GetType().GetHashCode();
+		h += base.GetHashCode();
+		return h;
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs
new file mode 100644
index 0000000..38532e2
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/IDFValueSource.cs
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Function that returns <seealso cref="TFIDFSimilarity #idf(long, long)"/>
+	/// for every document.
+	/// <para>
+	/// Note that the configured Similarity for the field must be
+	/// a subclass of <seealso cref="TFIDFSimilarity"/>
+	/// @lucene.internal 
+	/// </para>
+	/// </summary>
+	public class IDFValueSource : DocFreqValueSource
+	{
+	  public IDFValueSource(string field, string val, string indexedField, BytesRef indexedBytes) : base(field, val, indexedField, indexedBytes)
+	  {
+	  }
+
+	  public override string name()
+	  {
+		return "idf";
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		IndexSearcher searcher = (IndexSearcher)context["searcher"];
+		TFIDFSimilarity sim = asTFIDF(searcher.Similarity, field);
+		if (sim == null)
+		{
+		  throw new System.NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)");
+		}
+		int docfreq = searcher.IndexReader.docFreq(new Term(indexedField, indexedBytes));
+		float idf = sim.idf(docfreq, searcher.IndexReader.maxDoc());
+		return new ConstDoubleDocValues(idf, this);
+	  }
+
+	  // tries extra hard to cast the sim to TFIDFSimilarity
+	  internal static TFIDFSimilarity asTFIDF(Similarity sim, string field)
+	  {
+		while (sim is PerFieldSimilarityWrapper)
+		{
+		  sim = ((PerFieldSimilarityWrapper)sim).get(field);
+		}
+		if (sim is TFIDFSimilarity)
+		{
+		  return (TFIDFSimilarity)sim;
+		}
+		else
+		{
+		  return null;
+		}
+	  }
+	}
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/IfFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/IfFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/IfFunction.cs
new file mode 100644
index 0000000..8fee427
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/IfFunction.cs
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Depending on the boolean value of the <code>ifSource</code> function,
+	/// returns the value of the <code>trueSource</code> or <code>falseSource</code> function.
+	/// </summary>
+	public class IfFunction : BoolFunction
+	{
+	  private readonly ValueSource ifSource;
+	  private readonly ValueSource trueSource;
+	  private readonly ValueSource falseSource;
+
+
+	  public IfFunction(ValueSource ifSource, ValueSource trueSource, ValueSource falseSource)
+	  {
+		this.ifSource = ifSource;
+		this.trueSource = trueSource;
+		this.falseSource = falseSource;
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues ifVals = ifSource.getValues(context, readerContext);
+		FunctionValues ifVals = ifSource.getValues(context, readerContext);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues trueVals = trueSource.getValues(context, readerContext);
+		FunctionValues trueVals = trueSource.getValues(context, readerContext);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues falseVals = falseSource.getValues(context, readerContext);
+		FunctionValues falseVals = falseSource.getValues(context, readerContext);
+
+		return new FunctionValuesAnonymousInnerClassHelper(this, ifVals, trueVals, falseVals);
+
+	  }
+
+	  private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
+	  {
+		  private readonly IfFunction outerInstance;
+
+		  private FunctionValues ifVals;
+		  private FunctionValues trueVals;
+		  private FunctionValues falseVals;
+
+		  public FunctionValuesAnonymousInnerClassHelper(IfFunction outerInstance, FunctionValues ifVals, FunctionValues trueVals, FunctionValues falseVals)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.ifVals = ifVals;
+			  this.trueVals = trueVals;
+			  this.falseVals = falseVals;
+		  }
+
+		  public override sbyte byteVal(int doc)
+		  {
+			return ifVals.boolVal(doc) ? trueVals.byteVal(doc) : falseVals.byteVal(doc);
+		  }
+
+		  public override short shortVal(int doc)
+		  {
+			return ifVals.boolVal(doc) ? trueVals.shortVal(doc) : falseVals.shortVal(doc);
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return ifVals.boolVal(doc) ? trueVals.floatVal(doc) : falseVals.floatVal(doc);
+		  }
+
+		  public override int intVal(int doc)
+		  {
+			return ifVals.boolVal(doc) ? trueVals.intVal(doc) : falseVals.intVal(doc);
+		  }
+
+		  public override long longVal(int doc)
+		  {
+			return ifVals.boolVal(doc) ? trueVals.longVal(doc) : falseVals.longVal(doc);
+		  }
+
+		  public override double doubleVal(int doc)
+		  {
+			return ifVals.boolVal(doc) ? trueVals.doubleVal(doc) : falseVals.doubleVal(doc);
+		  }
+
+		  public override string strVal(int doc)
+		  {
+			return ifVals.boolVal(doc) ? trueVals.strVal(doc) : falseVals.strVal(doc);
+		  }
+
+		  public override bool boolVal(int doc)
+		  {
+			return ifVals.boolVal(doc) ? trueVals.boolVal(doc) : falseVals.boolVal(doc);
+		  }
+
+		  public override bool bytesVal(int doc, BytesRef target)
+		  {
+			return ifVals.boolVal(doc) ? trueVals.bytesVal(doc, target) : falseVals.bytesVal(doc, target);
+		  }
+
+		  public override object objectVal(int doc)
+		  {
+			return ifVals.boolVal(doc) ? trueVals.objectVal(doc) : falseVals.objectVal(doc);
+		  }
+
+		  public override bool exists(int doc)
+		  {
+			return true; // TODO: flow through to any sub-sources?
+		  }
+
+		  public override ValueFiller ValueFiller
+		  {
+			  get
+			  {
+				// TODO: we need types of trueSource / falseSource to handle this
+				// for now, use float.
+				return base.ValueFiller;
+			  }
+		  }
+
+		  public override string ToString(int doc)
+		  {
+			return "if(" + ifVals.ToString(doc) + ',' + trueVals.ToString(doc) + ',' + falseVals.ToString(doc) + ')';
+		  }
+	  }
+
+	  public override string description()
+	  {
+		return "if(" + ifSource.description() + ',' + trueSource.description() + ',' + falseSource + ')';
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int h = ifSource.GetHashCode();
+		h = h * 31 + trueSource.GetHashCode();
+		h = h * 31 + falseSource.GetHashCode();
+		return h;
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (!(o is IfFunction))
+		{
+			return false;
+		}
+		IfFunction other = (IfFunction)o;
+		return ifSource.Equals(other.ifSource) && trueSource.Equals(other.trueSource) && falseSource.Equals(other.falseSource);
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		ifSource.createWeight(context, searcher);
+		trueSource.createWeight(context, searcher);
+		falseSource.createWeight(context, searcher);
+	  }
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs
new file mode 100644
index 0000000..5ed7345
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Obtains int field values from <seealso cref="FieldCache#getInts"/> and makes those
+	/// values available as other numeric types, casting as needed.
+	/// </summary>
+	public class IntFieldSource : FieldCacheSource
+	{
+	  internal readonly FieldCache.IntParser parser;
+
+	  public IntFieldSource(string field) : this(field, null)
+	  {
+	  }
+
+	  public IntFieldSource(string field, FieldCache.IntParser parser) : base(field)
+	  {
+		this.parser = parser;
+	  }
+
+	  public override string description()
+	  {
+		return "int(" + field + ')';
+	  }
+
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Ints arr = cache.getInts(readerContext.reader(), field, parser, true);
+		FieldCache.Ints arr = cache.getInts(readerContext.reader(), field, parser, true);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.util.Bits valid = cache.getDocsWithField(readerContext.reader(), field);
+		Bits valid = cache.getDocsWithField(readerContext.reader(), field);
+
+		return new IntDocValuesAnonymousInnerClassHelper(this, this, arr, valid);
+	  }
+
+	  private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
+	  {
+		  private readonly IntFieldSource outerInstance;
+
+		  private FieldCache.Ints arr;
+		  private Bits valid;
+
+		  public IntDocValuesAnonymousInnerClassHelper(IntFieldSource outerInstance, IntFieldSource this, FieldCache.Ints arr, Bits valid) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.arr = arr;
+			  this.valid = valid;
+			  val = new MutableValueInt();
+		  }
+
+		  internal readonly MutableValueInt val;
+
+		  public override float floatVal(int doc)
+		  {
+			return (float)arr.get(doc);
+		  }
+
+		  public override int intVal(int doc)
+		  {
+			return arr.get(doc);
+		  }
+
+		  public override long longVal(int doc)
+		  {
+			return (long)arr.get(doc);
+		  }
+
+		  public override double doubleVal(int doc)
+		  {
+			return (double)arr.get(doc);
+		  }
+
+		  public override string strVal(int doc)
+		  {
+			return Convert.ToString(arr.get(doc));
+		  }
+
+		  public override object objectVal(int doc)
+		  {
+			return valid.get(doc) ? arr.get(doc) : null;
+		  }
+
+		  public override bool exists(int doc)
+		  {
+			return arr.get(doc) != 0 || valid.get(doc);
+		  }
+
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.description() + '=' + intVal(doc);
+		  }
+
+		  public override ValueFiller ValueFiller
+		  {
+			  get
+			  {
+				return new ValueFillerAnonymousInnerClassHelper(this);
+			  }
+		  }
+
+		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
+		  {
+			  private readonly IntDocValuesAnonymousInnerClassHelper outerInstance;
+
+			  public ValueFillerAnonymousInnerClassHelper(IntDocValuesAnonymousInnerClassHelper outerInstance)
+			  {
+				  this.outerInstance = outerInstance;
+				  mval = new MutableValueInt();
+			  }
+
+			  private readonly MutableValueInt mval;
+
+			  public override MutableValue Value
+			  {
+				  get
+				  {
+					return mval;
+				  }
+			  }
+
+			  public override void fillValue(int doc)
+			  {
+				mval.value = outerInstance.arr.get(doc);
+				mval.exists = mval.value != 0 || outerInstance.valid.get(doc);
+			  }
+		  }
+
+
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (o.GetType() != typeof(IntFieldSource))
+		{
+			return false;
+		}
+		IntFieldSource other = (IntFieldSource)o;
+		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int h = parser == null ? typeof(int?).GetHashCode() : parser.GetType().GetHashCode();
+		h += base.GetHashCode();
+		return h;
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs
new file mode 100644
index 0000000..3319eda
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Use a field value and find the Document Frequency within another field.
+	/// 
+	/// @since solr 4.0
+	/// </summary>
+	public class JoinDocFreqValueSource : FieldCacheSource
+	{
+
+	  public const string NAME = "joindf";
+
+	  protected internal readonly string qfield;
+
+	  public JoinDocFreqValueSource(string field, string qfield) : base(field)
+	  {
+		this.qfield = qfield;
+	  }
+
+	  public override string description()
+	  {
+		return NAME + "(" + field + ":(" + qfield + "))";
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.index.BinaryDocValues terms = cache.getTerms(readerContext.reader(), field, false, org.apache.lucene.util.packed.PackedInts.FAST);
+		BinaryDocValues terms = cache.getTerms(readerContext.reader(), field, false, PackedInts.FAST);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.index.IndexReader top = org.apache.lucene.index.ReaderUtil.getTopLevelContext(readerContext).reader();
+		IndexReader top = ReaderUtil.getTopLevelContext(readerContext).reader();
+		Terms t = MultiFields.getTerms(top, qfield);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.index.TermsEnum termsEnum = t == null ? org.apache.lucene.index.TermsEnum.EMPTY : t.iterator(null);
+		TermsEnum termsEnum = t == null ? TermsEnum.EMPTY : t.iterator(null);
+
+		return new IntDocValuesAnonymousInnerClassHelper(this, this, terms, termsEnum);
+	  }
+
+	  private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
+	  {
+		  private readonly JoinDocFreqValueSource outerInstance;
+
+		  private BinaryDocValues terms;
+		  private TermsEnum termsEnum;
+
+		  public IntDocValuesAnonymousInnerClassHelper(JoinDocFreqValueSource outerInstance, JoinDocFreqValueSource this, BinaryDocValues terms, TermsEnum termsEnum) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.terms = terms;
+			  this.termsEnum = termsEnum;
+			  @ref = new BytesRef();
+		  }
+
+		  internal readonly BytesRef @ref;
+
+		  public override int intVal(int doc)
+		  {
+			try
+			{
+			  terms.get(doc, @ref);
+			  if (termsEnum.seekExact(@ref))
+			  {
+				return termsEnum.docFreq();
+			  }
+			  else
+			  {
+				return 0;
+			  }
+			}
+			catch (IOException e)
+			{
+			  throw new Exception("caught exception in function " + outerInstance.description() + " : doc=" + doc, e);
+			}
+		  }
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (o.GetType() != typeof(JoinDocFreqValueSource))
+		{
+			return false;
+		}
+		JoinDocFreqValueSource other = (JoinDocFreqValueSource)o;
+		if (!qfield.Equals(other.qfield))
+		{
+			return false;
+		}
+		return base.Equals(other);
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return qfield.GetHashCode() + base.GetHashCode();
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs
new file mode 100644
index 0000000..7924547
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// <code>LinearFloatFunction</code> implements a linear function over
+	/// another <seealso cref="ValueSource"/>.
+	/// <br>
+	/// Normally Used as an argument to a <seealso cref="FunctionQuery"/>
+	/// 
+	/// 
+	/// </summary>
+	public class LinearFloatFunction : ValueSource
+	{
+	  protected internal readonly ValueSource source;
+	  protected internal readonly float slope;
+	  protected internal readonly float intercept;
+
+	  public LinearFloatFunction(ValueSource source, float slope, float intercept)
+	  {
+		this.source = source;
+		this.slope = slope;
+		this.intercept = intercept;
+	  }
+
+	  public override string description()
+	  {
+		return slope + "*float(" + source.description() + ")+" + intercept;
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
+		FunctionValues vals = source.getValues(context, readerContext);
+		return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals);
+	  }
+
+	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+	  {
+		  private readonly LinearFloatFunction outerInstance;
+
+		  private FunctionValues vals;
+
+		  public FloatDocValuesAnonymousInnerClassHelper(LinearFloatFunction outerInstance, LinearFloatFunction this, FunctionValues vals) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.vals = vals;
+		  }
+
+		  public override float floatVal(int doc)
+		  {
+			return vals.floatVal(doc) * outerInstance.slope + outerInstance.intercept;
+		  }
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.slope + "*float(" + vals.ToString(doc) + ")+" + outerInstance.intercept;
+		  }
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		source.createWeight(context, searcher);
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int h = float.floatToIntBits(slope);
+		h = ((int)((uint)h >> 2)) | (h << 30);
+		h += float.floatToIntBits(intercept);
+		h ^= (h << 14) | ((int)((uint)h >> 19));
+		return h + source.GetHashCode();
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (typeof(LinearFloatFunction) != o.GetType())
+		{
+			return false;
+		}
+		LinearFloatFunction other = (LinearFloatFunction)o;
+		return this.slope == other.slope && this.intercept == other.intercept && this.source.Equals(other.source);
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs
new file mode 100644
index 0000000..4b91199
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs
@@ -0,0 +1,112 @@
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+	/*
+	 * Licensed to the Apache Software Foundation (ASF) under one or more
+	 * contributor license agreements.  See the NOTICE file distributed with
+	 * this work for additional information regarding copyright ownership.
+	 * The ASF licenses this file to You under the Apache License, Version 2.0
+	 * (the "License"); you may not use this file except in compliance with
+	 * the License.  You may obtain a copy of the License at
+	 *
+	 *     http://www.apache.org/licenses/LICENSE-2.0
+	 *
+	 * Unless required by applicable law or agreed to in writing, software
+	 * distributed under the License is distributed on an "AS IS" BASIS,
+	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	 * See the License for the specific language governing permissions and
+	 * limitations under the License.
+	 */
+    /// <summary>
+	/// Pass a the field value through as a String, no matter the type // Q: doesn't this mean it's a "string"?
+	/// 
+	/// 
+	/// </summary>
+	public class LiteralValueSource : ValueSource
+	{
+	  protected internal readonly string @string;
+	  protected internal readonly BytesRef bytesRef;
+
+	  public LiteralValueSource(string @string)
+	  {
+		this.@string = @string;
+		this.bytesRef = new BytesRef(@string);
+	  }
+
+	  /// <summary>
+	  /// returns the literal value </summary>
+	  public virtual string Value
+	  {
+		  get
+		  {
+			return @string;
+		  }
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+
+		return new StrDocValuesAnonymousInnerClassHelper(this, this);
+	  }
+
+	  private class StrDocValuesAnonymousInnerClassHelper : StrDocValues
+	  {
+		  private readonly LiteralValueSource outerInstance;
+
+		  public StrDocValuesAnonymousInnerClassHelper(LiteralValueSource outerInstance, LiteralValueSource this) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+		  }
+
+		  public override string strVal(int doc)
+		  {
+			return outerInstance.@string;
+		  }
+
+		  public override bool bytesVal(int doc, BytesRef target)
+		  {
+			target.copyBytes(outerInstance.bytesRef);
+			return true;
+		  }
+
+		  public override string ToString(int doc)
+		  {
+			return outerInstance.@string;
+		  }
+	  }
+
+	  public override string description()
+	  {
+		return "literal(" + @string + ")";
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this == o)
+		{
+			return true;
+		}
+		if (!(o is LiteralValueSource))
+		{
+			return false;
+		}
+
+		LiteralValueSource that = (LiteralValueSource) o;
+
+		return @string.Equals(that.@string);
+
+	  }
+
+	  public static readonly int hash = typeof(LiteralValueSource).GetHashCode();
+	  public override int GetHashCode()
+	  {
+		return hash + @string.GetHashCode();
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs
new file mode 100644
index 0000000..00b902f
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Obtains long field values from <seealso cref="FieldCache#getLongs"/> and makes those
+	/// values available as other numeric types, casting as needed.
+	/// </summary>
+	public class LongFieldSource : FieldCacheSource
+	{
+
+	  protected internal readonly FieldCache.LongParser parser;
+
+	  public LongFieldSource(string field) : this(field, null)
+	  {
+	  }
+
+	  public LongFieldSource(string field, FieldCache.LongParser parser) : base(field)
+	  {
+		this.parser = parser;
+	  }
+
+	  public override string description()
+	  {
+		return "long(" + field + ')';
+	  }
+
+	  public virtual long externalToLong(string extVal)
+	  {
+		return Convert.ToInt64(extVal);
+	  }
+
+	  public virtual object longToObject(long val)
+	  {
+		return val;
+	  }
+
+	  public virtual string longToString(long val)
+	  {
+		return longToObject(val).ToString();
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Longs arr = cache.getLongs(readerContext.reader(), field, parser, true);
+		FieldCache.Longs arr = cache.getLongs(readerContext.reader(), field, parser, true);
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.util.Bits valid = cache.getDocsWithField(readerContext.reader(), field);
+		Bits valid = cache.getDocsWithField(readerContext.reader(), field);
+
+		return new LongDocValuesAnonymousInnerClassHelper(this, this, arr, valid);
+	  }
+
+	  private class LongDocValuesAnonymousInnerClassHelper : LongDocValues
+	  {
+		  private readonly LongFieldSource outerInstance;
+
+		  private FieldCache.Longs arr;
+		  private Bits valid;
+
+		  public LongDocValuesAnonymousInnerClassHelper(LongFieldSource outerInstance, LongFieldSource this, FieldCache.Longs arr, Bits valid) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.arr = arr;
+			  this.valid = valid;
+		  }
+
+		  public override long longVal(int doc)
+		  {
+			return arr.get(doc);
+		  }
+
+		  public override bool exists(int doc)
+		  {
+			return arr.get(doc) != 0 || valid.get(doc);
+		  }
+
+		  public override object objectVal(int doc)
+		  {
+			return valid.get(doc) ? outerInstance.longToObject(arr.get(doc)) : null;
+		  }
+
+		  public override string strVal(int doc)
+		  {
+			return valid.get(doc) ? outerInstance.longToString(arr.get(doc)) : null;
+		  }
+
+		  protected internal override long externalToLong(string extVal)
+		  {
+			return outerInstance.externalToLong(extVal);
+		  }
+
+		  public override ValueFiller ValueFiller
+		  {
+			  get
+			  {
+				return new ValueFillerAnonymousInnerClassHelper(this);
+			  }
+		  }
+
+		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
+		  {
+			  private readonly LongDocValuesAnonymousInnerClassHelper outerInstance;
+
+			  public ValueFillerAnonymousInnerClassHelper(LongDocValuesAnonymousInnerClassHelper outerInstance)
+			  {
+				  this.outerInstance = outerInstance;
+				  mval = outerInstance.outerInstance.newMutableValueLong();
+			  }
+
+			  private readonly MutableValueLong mval;
+
+			  public override MutableValue Value
+			  {
+				  get
+				  {
+					return mval;
+				  }
+			  }
+
+			  public override void fillValue(int doc)
+			  {
+				mval.value = outerInstance.arr.get(doc);
+				mval.exists = mval.value != 0 || outerInstance.valid.get(doc);
+			  }
+		  }
+
+	  }
+
+	  protected internal virtual MutableValueLong newMutableValueLong()
+	  {
+		return new MutableValueLong();
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (o.GetType() != this.GetType())
+		{
+			return false;
+		}
+		LongFieldSource other = (LongFieldSource) o;
+		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
+	  }
+
+	  public override int GetHashCode()
+	  {
+		int h = parser == null ? this.GetType().GetHashCode() : parser.GetType().GetHashCode();
+		h += base.GetHashCode();
+		return h;
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/MaxDocValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MaxDocValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/MaxDocValueSource.cs
new file mode 100644
index 0000000..0d65888
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MaxDocValueSource.cs
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    // javadocs
+
+
+    /// <summary>
+	/// Returns the value of <seealso cref="IndexReader#maxDoc()"/>
+	/// for every document. This is the number of documents
+	/// including deletions.
+	/// </summary>
+	public class MaxDocValueSource : ValueSource
+	{
+	  public virtual string name()
+	  {
+		return "maxdoc";
+	  }
+
+	  public override string description()
+	  {
+		return name() + "()";
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		context["searcher"] = searcher;
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+		IndexSearcher searcher = (IndexSearcher)context["searcher"];
+		return new ConstIntDocValues(searcher.IndexReader.maxDoc(), this);
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		return this.GetType() == o.GetType();
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return this.GetType().GetHashCode();
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/MaxFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MaxFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MaxFloatFunction.cs
new file mode 100644
index 0000000..ba86891
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MaxFloatFunction.cs
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+
+
+	/// <summary>
+	/// <code>MaxFloatFunction</code> returns the max of it's components.
+	/// </summary>
+	public class MaxFloatFunction : MultiFloatFunction
+	{
+	  public MaxFloatFunction(ValueSource[] sources) : base(sources)
+	  {
+	  }
+
+	  protected internal override string name()
+	  {
+		return "max";
+	  }
+
+	  protected internal override float func(int doc, FunctionValues[] valsArr)
+	  {
+		if (valsArr.Length == 0)
+		{
+			return 0.0f;
+		}
+		float val = float.NegativeInfinity;
+		foreach (FunctionValues vals in valsArr)
+		{
+		  val = Math.Max(vals.floatVal(doc), val);
+		}
+		return val;
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/MinFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MinFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MinFloatFunction.cs
new file mode 100644
index 0000000..8905f5b
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MinFloatFunction.cs
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using org.apache.lucene.queries.function;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+
+
+	/// <summary>
+	/// <code>MinFloatFunction</code> returns the min of it's components.
+	/// </summary>
+	public class MinFloatFunction : MultiFloatFunction
+	{
+	  public MinFloatFunction(ValueSource[] sources) : base(sources)
+	  {
+	  }
+
+	  protected internal override string name()
+	  {
+		return "min";
+	  }
+
+	  protected internal override float func(int doc, FunctionValues[] valsArr)
+	  {
+		if (valsArr.Length == 0)
+		{
+			return 0.0f;
+		}
+		float val = float.PositiveInfinity;
+		foreach (FunctionValues vals in valsArr)
+		{
+		  val = Math.Min(vals.floatVal(doc), val);
+		}
+		return val;
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
new file mode 100644
index 0000000..5419e47
--- /dev/null
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using org.apache.lucene.queries.function;
+using org.apache.lucene.queries.function.docvalues;
+
+namespace Lucene.Net.Queries.Function.ValueSources
+{
+    /// <summary>
+	/// Abstract <seealso cref="ValueSource"/> implementation which wraps multiple ValueSources
+	/// and applies an extendible boolean function to their values.
+	/// 
+	/// </summary>
+	public abstract class MultiBoolFunction : BoolFunction
+	{
+	  protected internal readonly IList<ValueSource> sources;
+
+	  public MultiBoolFunction(IList<ValueSource> sources)
+	  {
+		this.sources = sources;
+	  }
+
+	  protected internal abstract string name();
+
+	  protected internal abstract bool func(int doc, FunctionValues[] vals);
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.docvalues.BoolDocValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override BoolDocValues getValues(IDictionary context, AtomicReaderContext readerContext)
+	  {
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues[] vals = new org.apache.lucene.queries.function.FunctionValues[sources.size()];
+		FunctionValues[] vals = new FunctionValues[sources.Count];
+		int i = 0;
+		foreach (ValueSource source in sources)
+		{
+		  vals[i++] = source.getValues(context, readerContext);
+		}
+
+		return new BoolDocValuesAnonymousInnerClassHelper(this, this, vals);
+	  }
+
+	  private class BoolDocValuesAnonymousInnerClassHelper : BoolDocValues
+	  {
+		  private readonly MultiBoolFunction outerInstance;
+
+		  private FunctionValues[] vals;
+
+		  public BoolDocValuesAnonymousInnerClassHelper(MultiBoolFunction outerInstance, MultiBoolFunction this, FunctionValues[] vals) : base(this)
+		  {
+			  this.outerInstance = outerInstance;
+			  this.vals = vals;
+		  }
+
+		  public override bool boolVal(int doc)
+		  {
+			return outerInstance.func(doc, vals);
+		  }
+
+		  public override string ToString(int doc)
+		  {
+			StringBuilder sb = new StringBuilder(outerInstance.name());
+			sb.Append('(');
+			bool first = true;
+			foreach (FunctionValues dv in vals)
+			{
+			  if (first)
+			  {
+				first = false;
+			  }
+			  else
+			  {
+				sb.Append(',');
+			  }
+			  sb.Append(dv.ToString(doc));
+			}
+			return sb.ToString();
+		  }
+	  }
+
+	  public override string description()
+	  {
+		StringBuilder sb = new StringBuilder(name());
+		sb.Append('(');
+		bool first = true;
+		foreach (ValueSource source in sources)
+		{
+		  if (first)
+		  {
+			first = false;
+		  }
+		  else
+		  {
+			sb.Append(',');
+		  }
+		  sb.Append(source.description());
+		}
+		return sb.ToString();
+	  }
+
+	  public override int GetHashCode()
+	  {
+		return sources.GetHashCode() + name().GetHashCode();
+	  }
+
+	  public override bool Equals(object o)
+	  {
+		if (this.GetType() != o.GetType())
+		{
+			return false;
+		}
+		MultiBoolFunction other = (MultiBoolFunction)o;
+		return this.sources.Equals(other.sources);
+	  }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+	  {
+		foreach (ValueSource source in sources)
+		{
+		  source.createWeight(context, searcher);
+		}
+	  }
+	}
+
+}
\ No newline at end of file


[18/21] More work on Lucene.Net.Queries

Posted by sy...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/DocValues/DoubleDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/DocValues/DoubleDocValues.cs b/src/Lucene.Net.Queries/Function/DocValues/DoubleDocValues.cs
index afc2a59..572f72d 100644
--- a/src/Lucene.Net.Queries/Function/DocValues/DoubleDocValues.cs
+++ b/src/Lucene.Net.Queries/Function/DocValues/DoubleDocValues.cs
@@ -1,256 +1,251 @@
 using System;
+using Lucene.Net.Index;
+using Lucene.Net.Util.Mutable;
 
-namespace org.apache.lucene.queries.function.docvalues
+namespace Lucene.Net.Queries.Function.DocValues
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueDouble = org.apache.lucene.util.mutable.MutableValueDouble;
-
-	/// <summary>
-	/// Abstract <seealso cref="FunctionValues"/> implementation which supports retrieving double values.
-	/// Implementations can control how the double values are loaded through <seealso cref="#doubleVal(int)"/>}
-	/// </summary>
-	public abstract class DoubleDocValues : FunctionValues
-	{
-	  protected internal readonly ValueSource vs;
-
-	  public DoubleDocValues(ValueSource vs)
-	  {
-		this.vs = vs;
-	  }
-
-	  public override sbyte byteVal(int doc)
-	  {
-		return (sbyte)doubleVal(doc);
-	  }
-
-	  public override short shortVal(int doc)
-	  {
-		return (short)doubleVal(doc);
-	  }
-
-	  public override float floatVal(int doc)
-	  {
-		return (float)doubleVal(doc);
-	  }
-
-	  public override int intVal(int doc)
-	  {
-		return (int)doubleVal(doc);
-	  }
-
-	  public override long longVal(int doc)
-	  {
-		return (long)doubleVal(doc);
-	  }
-
-	  public override bool boolVal(int doc)
-	  {
-		return doubleVal(doc) != 0;
-	  }
-
-	  public override abstract double doubleVal(int doc);
-
-	  public override string strVal(int doc)
-	  {
-		return Convert.ToString(doubleVal(doc));
-	  }
-
-	  public override object objectVal(int doc)
-	  {
-		return exists(doc) ? doubleVal(doc) : null;
-	  }
-
-	  public override string ToString(int doc)
-	  {
-		return vs.description() + '=' + strVal(doc);
-	  }
-
-	  public override ValueSourceScorer getRangeScorer(IndexReader reader, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
-	  {
-		double lower, upper;
-
-		if (lowerVal == null)
-		{
-		  lower = double.NegativeInfinity;
-		}
-		else
-		{
-		  lower = Convert.ToDouble(lowerVal);
-		}
-
-		 if (upperVal == null)
-		 {
-		  upper = double.PositiveInfinity;
-		 }
-		else
-		{
-		  upper = Convert.ToDouble(upperVal);
-		}
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final double l = lower;
-		double l = lower;
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final double u = upper;
-		double u = upper;
-
-
-		if (includeLower && includeUpper)
-		{
-		  return new ValueSourceScorerAnonymousInnerClassHelper(this, reader, this, l, u);
-		}
-		else if (includeLower && !includeUpper)
-		{
-		  return new ValueSourceScorerAnonymousInnerClassHelper2(this, reader, this, l, u);
-		}
-		else if (!includeLower && includeUpper)
-		{
-		  return new ValueSourceScorerAnonymousInnerClassHelper3(this, reader, this, l, u);
-		}
-		else
-		{
-		  return new ValueSourceScorerAnonymousInnerClassHelper4(this, reader, this, l, u);
-		}
-	  }
-
-	  private class ValueSourceScorerAnonymousInnerClassHelper : ValueSourceScorer
-	  {
-		  private readonly DoubleDocValues outerInstance;
-
-		  private double l;
-		  private double u;
-
-		  public ValueSourceScorerAnonymousInnerClassHelper(DoubleDocValues outerInstance, IndexReader reader, org.apache.lucene.queries.function.docvalues.DoubleDocValues this, double l, double u) : base(reader, this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.l = l;
-			  this.u = u;
-		  }
-
-		  public override bool matchesValue(int doc)
-		  {
-			double docVal = outerInstance.doubleVal(doc);
-			return docVal >= l && docVal <= u;
-		  }
-	  }
-
-	  private class ValueSourceScorerAnonymousInnerClassHelper2 : ValueSourceScorer
-	  {
-		  private readonly DoubleDocValues outerInstance;
-
-		  private double l;
-		  private double u;
-
-		  public ValueSourceScorerAnonymousInnerClassHelper2(DoubleDocValues outerInstance, IndexReader reader, org.apache.lucene.queries.function.docvalues.DoubleDocValues this, double l, double u) : base(reader, this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.l = l;
-			  this.u = u;
-		  }
-
-		  public override bool matchesValue(int doc)
-		  {
-			double docVal = outerInstance.doubleVal(doc);
-			return docVal >= l && docVal < u;
-		  }
-	  }
-
-	  private class ValueSourceScorerAnonymousInnerClassHelper3 : ValueSourceScorer
-	  {
-		  private readonly DoubleDocValues outerInstance;
-
-		  private double l;
-		  private double u;
-
-		  public ValueSourceScorerAnonymousInnerClassHelper3(DoubleDocValues outerInstance, IndexReader reader, org.apache.lucene.queries.function.docvalues.DoubleDocValues this, double l, double u) : base(reader, this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.l = l;
-			  this.u = u;
-		  }
-
-		  public override bool matchesValue(int doc)
-		  {
-			double docVal = outerInstance.doubleVal(doc);
-			return docVal > l && docVal <= u;
-		  }
-	  }
-
-	  private class ValueSourceScorerAnonymousInnerClassHelper4 : ValueSourceScorer
-	  {
-		  private readonly DoubleDocValues outerInstance;
-
-		  private double l;
-		  private double u;
-
-		  public ValueSourceScorerAnonymousInnerClassHelper4(DoubleDocValues outerInstance, IndexReader reader, org.apache.lucene.queries.function.docvalues.DoubleDocValues this, double l, double u) : base(reader, this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.l = l;
-			  this.u = u;
-		  }
-
-		  public override bool matchesValue(int doc)
-		  {
-			double docVal = outerInstance.doubleVal(doc);
-			return docVal > l && docVal < u;
-		  }
-	  }
-
-	  public override ValueFiller ValueFiller
-	  {
-		  get
-		  {
-			return new ValueFillerAnonymousInnerClassHelper(this);
-		  }
-	  }
-
-	  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-	  {
-		  private readonly DoubleDocValues outerInstance;
-
-		  public ValueFillerAnonymousInnerClassHelper(DoubleDocValues outerInstance)
-		  {
-			  this.outerInstance = outerInstance;
-			  mval = new MutableValueDouble();
-		  }
-
-		  private readonly MutableValueDouble mval;
-
-		  public override MutableValue Value
-		  {
-			  get
-			  {
-				return mval;
-			  }
-		  }
-
-		  public override void fillValue(int doc)
-		  {
-			mval.value = outerInstance.doubleVal(doc);
-			mval.exists = outerInstance.exists(doc);
-		  }
-	  }
-
-	}
-
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// Abstract <seealso cref="FunctionValues"/> implementation which supports retrieving double values.
+    /// Implementations can control how the double values are loaded through <seealso cref="#DoubleVal(int)"/>}
+    /// </summary>
+    public abstract class DoubleDocValues : FunctionValues
+    {
+        protected internal readonly ValueSource vs;
+
+        protected DoubleDocValues(ValueSource vs)
+        {
+            this.vs = vs;
+        }
+
+        public override sbyte ByteVal(int doc)
+        {
+            return (sbyte)DoubleVal(doc);
+        }
+
+        public override short ShortVal(int doc)
+        {
+            return (short)DoubleVal(doc);
+        }
+
+        public override float FloatVal(int doc)
+        {
+            return (float)DoubleVal(doc);
+        }
+
+        public override int IntVal(int doc)
+        {
+            return (int)DoubleVal(doc);
+        }
+
+        public override long LongVal(int doc)
+        {
+            return (long)DoubleVal(doc);
+        }
+
+        public override bool BoolVal(int doc)
+        {
+            return DoubleVal(doc) != 0;
+        }
+
+        public override abstract double DoubleVal(int doc);
+
+        public override string StrVal(int doc)
+        {
+            return Convert.ToString(DoubleVal(doc));
+        }
+
+        public override object ObjectVal(int doc)
+        {
+            return Exists(doc) ? DoubleVal(doc) : (double?)null;
+        }
+
+        public override string ToString(int doc)
+        {
+            return vs.Description + '=' + StrVal(doc);
+        }
+
+        public override ValueSourceScorer GetRangeScorer(IndexReader reader, string lowerVal, string upperVal,
+            bool includeLower, bool includeUpper)
+        {
+            double lower, upper;
+
+            if (lowerVal == null)
+            {
+                lower = double.NegativeInfinity;
+            }
+            else
+            {
+                lower = Convert.ToDouble(lowerVal);
+            }
+
+            if (upperVal == null)
+            {
+                upper = double.PositiveInfinity;
+            }
+            else
+            {
+                upper = Convert.ToDouble(upperVal);
+            }
+
+            double l = lower;
+            double u = upper;
+            if (includeLower && includeUpper)
+            {
+                return new ValueSourceScorerAnonymousInnerClassHelper(this, reader, this, l, u);
+            }
+            else if (includeLower && !includeUpper)
+            {
+                return new ValueSourceScorerAnonymousInnerClassHelper2(this, reader, this, l, u);
+            }
+            else if (!includeLower && includeUpper)
+            {
+                return new ValueSourceScorerAnonymousInnerClassHelper3(this, reader, this, l, u);
+            }
+            else
+            {
+                return new ValueSourceScorerAnonymousInnerClassHelper4(this, reader, this, l, u);
+            }
+        }
+
+        private class ValueSourceScorerAnonymousInnerClassHelper : ValueSourceScorer
+        {
+            private readonly DoubleDocValues outerInstance;
+
+            private double l;
+            private double u;
+
+            public ValueSourceScorerAnonymousInnerClassHelper(DoubleDocValues outerInstance, IndexReader reader, DoubleDocValues @this, double l, double u)
+                : base(reader, @this)
+            {
+                this.outerInstance = outerInstance;
+                this.l = l;
+                this.u = u;
+            }
+
+            public override bool MatchesValue(int doc)
+            {
+                double docVal = outerInstance.DoubleVal(doc);
+                return docVal >= l && docVal <= u;
+            }
+        }
+
+        private class ValueSourceScorerAnonymousInnerClassHelper2 : ValueSourceScorer
+        {
+            private readonly DoubleDocValues outerInstance;
+
+            private double l;
+            private double u;
+
+            public ValueSourceScorerAnonymousInnerClassHelper2(DoubleDocValues outerInstance, IndexReader reader, DoubleDocValues @this, double l, double u)
+                : base(reader, @this)
+            {
+                this.outerInstance = outerInstance;
+                this.l = l;
+                this.u = u;
+            }
+
+            public override bool MatchesValue(int doc)
+            {
+                double docVal = outerInstance.DoubleVal(doc);
+                return docVal >= l && docVal < u;
+            }
+        }
+
+        private class ValueSourceScorerAnonymousInnerClassHelper3 : ValueSourceScorer
+        {
+            private readonly DoubleDocValues outerInstance;
+
+            private double l;
+            private double u;
+
+            public ValueSourceScorerAnonymousInnerClassHelper3(DoubleDocValues outerInstance, IndexReader reader, DoubleDocValues @this, double l, double u)
+                : base(reader, @this)
+            {
+                this.outerInstance = outerInstance;
+                this.l = l;
+                this.u = u;
+            }
+
+            public override bool MatchesValue(int doc)
+            {
+                double docVal = outerInstance.DoubleVal(doc);
+                return docVal > l && docVal <= u;
+            }
+        }
+
+        private class ValueSourceScorerAnonymousInnerClassHelper4 : ValueSourceScorer
+        {
+            private readonly DoubleDocValues outerInstance;
+
+            private double l;
+            private double u;
+
+            public ValueSourceScorerAnonymousInnerClassHelper4(DoubleDocValues outerInstance, IndexReader reader,
+                DoubleDocValues @this, double l, double u)
+                : base(reader, @this)
+            {
+                this.outerInstance = outerInstance;
+                this.l = l;
+                this.u = u;
+            }
+
+            public override bool MatchesValue(int doc)
+            {
+                double docVal = outerInstance.DoubleVal(doc);
+                return docVal > l && docVal < u;
+            }
+        }
+
+        public override AbstractValueFiller ValueFiller
+        {
+            get
+            {
+                return new ValueFillerAnonymousInnerClassHelper(this);
+            }
+        }
+
+        private class ValueFillerAnonymousInnerClassHelper : AbstractValueFiller
+        {
+            private readonly DoubleDocValues outerInstance;
+
+            public ValueFillerAnonymousInnerClassHelper(DoubleDocValues outerInstance)
+            {
+                this.outerInstance = outerInstance;
+                mval = new MutableValueDouble();
+            }
+
+            private readonly MutableValueDouble mval;
+
+            public override MutableValue Value
+            {
+                get
+                {
+                    return mval;
+                }
+            }
+
+            public override void FillValue(int doc)
+            {
+                mval.Value = outerInstance.DoubleVal(doc);
+                mval.Exists = outerInstance.Exists(doc);
+            }
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/DocValues/FloatDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/DocValues/FloatDocValues.cs b/src/Lucene.Net.Queries/Function/DocValues/FloatDocValues.cs
index 72df9b0..130ed04 100644
--- a/src/Lucene.Net.Queries/Function/DocValues/FloatDocValues.cs
+++ b/src/Lucene.Net.Queries/Function/DocValues/FloatDocValues.cs
@@ -1,117 +1,113 @@
 using System;
+using Lucene.Net.Util.Mutable;
 
-namespace org.apache.lucene.queries.function.docvalues
+namespace Lucene.Net.Queries.Function.DocValues
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueFloat = org.apache.lucene.util.mutable.MutableValueFloat;
-
-	/// <summary>
-	/// Abstract <seealso cref="FunctionValues"/> implementation which supports retrieving float values.
-	/// Implementations can control how the float values are loaded through <seealso cref="#floatVal(int)"/>}
-	/// </summary>
-	public abstract class FloatDocValues : FunctionValues
-	{
-	  protected internal readonly ValueSource vs;
-
-	  public FloatDocValues(ValueSource vs)
-	  {
-		this.vs = vs;
-	  }
-
-	  public override sbyte byteVal(int doc)
-	  {
-		return (sbyte)floatVal(doc);
-	  }
-
-	  public override short shortVal(int doc)
-	  {
-		return (short)floatVal(doc);
-	  }
-
-	  public override abstract float floatVal(int doc);
-
-	  public override int intVal(int doc)
-	  {
-		return (int)floatVal(doc);
-	  }
-
-	  public override long longVal(int doc)
-	  {
-		return (long)floatVal(doc);
-	  }
-
-	  public override double doubleVal(int doc)
-	  {
-		return (double)floatVal(doc);
-	  }
-
-	  public override string strVal(int doc)
-	  {
-		return Convert.ToString(floatVal(doc));
-	  }
-
-	  public override object objectVal(int doc)
-	  {
-		return exists(doc) ? floatVal(doc) : null;
-	  }
-
-	  public override string ToString(int doc)
-	  {
-		return vs.description() + '=' + strVal(doc);
-	  }
-
-	  public override ValueFiller ValueFiller
-	  {
-		  get
-		  {
-			return new ValueFillerAnonymousInnerClassHelper(this);
-		  }
-	  }
-
-	  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-	  {
-		  private readonly FloatDocValues outerInstance;
-
-		  public ValueFillerAnonymousInnerClassHelper(FloatDocValues outerInstance)
-		  {
-			  this.outerInstance = outerInstance;
-			  mval = new MutableValueFloat();
-		  }
-
-		  private readonly MutableValueFloat mval;
-
-		  public override MutableValue Value
-		  {
-			  get
-			  {
-				return mval;
-			  }
-		  }
-
-		  public override void fillValue(int doc)
-		  {
-			mval.value = outerInstance.floatVal(doc);
-			mval.exists = outerInstance.exists(doc);
-		  }
-	  }
-	}
-
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// Abstract <seealso cref="FunctionValues"/> implementation which supports retrieving float values.
+    /// Implementations can control how the float values are loaded through <seealso cref="#FloatVal(int)"/>}
+    /// </summary>
+    public abstract class FloatDocValues : FunctionValues
+    {
+        protected internal readonly ValueSource vs;
+
+        public FloatDocValues(ValueSource vs)
+        {
+            this.vs = vs;
+        }
+
+        public override sbyte ByteVal(int doc)
+        {
+            return (sbyte)FloatVal(doc);
+        }
+
+        public override short ShortVal(int doc)
+        {
+            return (short)FloatVal(doc);
+        }
+
+        public override abstract float FloatVal(int doc);
+
+        public override int IntVal(int doc)
+        {
+            return (int)FloatVal(doc);
+        }
+
+        public override long LongVal(int doc)
+        {
+            return (long)FloatVal(doc);
+        }
+
+        public override double DoubleVal(int doc)
+        {
+            return (double)FloatVal(doc);
+        }
+
+        public override string StrVal(int doc)
+        {
+            return Convert.ToString(FloatVal(doc));
+        }
+
+        public override object ObjectVal(int doc)
+        {
+            return Exists(doc) ? FloatVal(doc) : (float?)null;
+        }
+
+        public override string ToString(int doc)
+        {
+            return vs.Description + '=' + StrVal(doc);
+        }
+
+        public override AbstractValueFiller ValueFiller
+        {
+            get
+            {
+                return new ValueFillerAnonymousInnerClassHelper(this);
+            }
+        }
+
+        private class ValueFillerAnonymousInnerClassHelper : AbstractValueFiller
+        {
+            private readonly FloatDocValues outerInstance;
+
+            public ValueFillerAnonymousInnerClassHelper(FloatDocValues outerInstance)
+            {
+                this.outerInstance = outerInstance;
+                mval = new MutableValueFloat();
+            }
+
+            private readonly MutableValueFloat mval;
+
+            public override MutableValue Value
+            {
+                get
+                {
+                    return mval;
+                }
+            }
+
+            public override void FillValue(int doc)
+            {
+                mval.Value = outerInstance.FloatVal(doc);
+                mval.Exists = outerInstance.Exists(doc);
+            }
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/DocValues/IntDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/DocValues/IntDocValues.cs b/src/Lucene.Net.Queries/Function/DocValues/IntDocValues.cs
index c3f934e..a4fd701 100644
--- a/src/Lucene.Net.Queries/Function/DocValues/IntDocValues.cs
+++ b/src/Lucene.Net.Queries/Function/DocValues/IntDocValues.cs
@@ -1,183 +1,177 @@
 using System;
+using Lucene.Net.Index;
+using Lucene.Net.Util.Mutable;
 
-namespace org.apache.lucene.queries.function.docvalues
+namespace Lucene.Net.Queries.Function.DocValues
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueInt = org.apache.lucene.util.mutable.MutableValueInt;
-
-	/// <summary>
-	/// Abstract <seealso cref="FunctionValues"/> implementation which supports retrieving int values.
-	/// Implementations can control how the int values are loaded through <seealso cref="#intVal(int)"/>
-	/// </summary>
-	public abstract class IntDocValues : FunctionValues
-	{
-	  protected internal readonly ValueSource vs;
-
-	  public IntDocValues(ValueSource vs)
-	  {
-		this.vs = vs;
-	  }
-
-	  public override sbyte byteVal(int doc)
-	  {
-		return (sbyte)intVal(doc);
-	  }
-
-	  public override short shortVal(int doc)
-	  {
-		return (short)intVal(doc);
-	  }
-
-	  public override float floatVal(int doc)
-	  {
-		return (float)intVal(doc);
-	  }
-
-	  public override abstract int intVal(int doc);
-
-	  public override long longVal(int doc)
-	  {
-		return (long)intVal(doc);
-	  }
-
-	  public override double doubleVal(int doc)
-	  {
-		return (double)intVal(doc);
-	  }
-
-	  public override string strVal(int doc)
-	  {
-		return Convert.ToString(intVal(doc));
-	  }
-
-	  public override object objectVal(int doc)
-	  {
-		return exists(doc) ? intVal(doc) : null;
-	  }
-
-	  public override string ToString(int doc)
-	  {
-		return vs.description() + '=' + strVal(doc);
-	  }
-
-	  public override ValueSourceScorer getRangeScorer(IndexReader reader, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
-	  {
-		int lower, upper;
-
-		// instead of using separate comparison functions, adjust the endpoints.
-
-		if (lowerVal == null)
-		{
-		  lower = int.MinValue;
-		}
-		else
-		{
-		  lower = Convert.ToInt32(lowerVal);
-		  if (!includeLower && lower < int.MaxValue)
-		  {
-			  lower++;
-		  }
-		}
-
-		 if (upperVal == null)
-		 {
-		  upper = int.MaxValue;
-		 }
-		else
-		{
-		  upper = Convert.ToInt32(upperVal);
-		  if (!includeUpper && upper > int.MinValue)
-		  {
-			  upper--;
-		  }
-		}
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int ll = lower;
-		int ll = lower;
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int uu = upper;
-		int uu = upper;
-
-		return new ValueSourceScorerAnonymousInnerClassHelper(this, reader, this, ll, uu);
-	  }
-
-	  private class ValueSourceScorerAnonymousInnerClassHelper : ValueSourceScorer
-	  {
-		  private readonly IntDocValues outerInstance;
-
-		  private int ll;
-		  private int uu;
-
-		  public ValueSourceScorerAnonymousInnerClassHelper(IntDocValues outerInstance, IndexReader reader, org.apache.lucene.queries.function.docvalues.IntDocValues this, int ll, int uu) : base(reader, this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.ll = ll;
-			  this.uu = uu;
-		  }
-
-		  public override bool matchesValue(int doc)
-		  {
-			int val = outerInstance.intVal(doc);
-			// only check for deleted if it's the default value
-			// if (val==0 && reader.isDeleted(doc)) return false;
-			return val >= ll && val <= uu;
-		  }
-	  }
-
-	  public override ValueFiller ValueFiller
-	  {
-		  get
-		  {
-			return new ValueFillerAnonymousInnerClassHelper(this);
-		  }
-	  }
-
-	  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-	  {
-		  private readonly IntDocValues outerInstance;
-
-		  public ValueFillerAnonymousInnerClassHelper(IntDocValues outerInstance)
-		  {
-			  this.outerInstance = outerInstance;
-			  mval = new MutableValueInt();
-		  }
-
-		  private readonly MutableValueInt mval;
-
-		  public override MutableValue Value
-		  {
-			  get
-			  {
-				return mval;
-			  }
-		  }
-
-		  public override void fillValue(int doc)
-		  {
-			mval.value = outerInstance.intVal(doc);
-			mval.exists = outerInstance.exists(doc);
-		  }
-	  }
-	}
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// Abstract <seealso cref="FunctionValues"/> implementation which supports retrieving int values.
+    /// Implementations can control how the int values are loaded through <seealso cref="#IntVal(int)"/>
+    /// </summary>
+    public abstract class IntDocValues : FunctionValues
+    {
+        protected internal readonly ValueSource vs;
+
+        public IntDocValues(ValueSource vs)
+        {
+            this.vs = vs;
+        }
+
+        public override sbyte ByteVal(int doc)
+        {
+            return (sbyte)IntVal(doc);
+        }
+
+        public override short ShortVal(int doc)
+        {
+            return (short)IntVal(doc);
+        }
+
+        public override float FloatVal(int doc)
+        {
+            return (float)IntVal(doc);
+        }
+
+        public override abstract int IntVal(int doc);
+
+        public override long LongVal(int doc)
+        {
+            return (long)IntVal(doc);
+        }
+
+        public override double DoubleVal(int doc)
+        {
+            return (double)IntVal(doc);
+        }
+
+        public override string StrVal(int doc)
+        {
+            return Convert.ToString(IntVal(doc));
+        }
+
+        public override object ObjectVal(int doc)
+        {
+            return Exists(doc) ? IntVal(doc) : (int?)null;
+        }
+
+        public override string ToString(int doc)
+        {
+            return vs.Description + '=' + StrVal(doc);
+        }
+
+        public override ValueSourceScorer GetRangeScorer(IndexReader reader, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
+        {
+            int lower, upper;
+
+            // instead of using separate comparison functions, adjust the endpoints.
+
+            if (lowerVal == null)
+            {
+                lower = int.MinValue;
+            }
+            else
+            {
+                lower = Convert.ToInt32(lowerVal);
+                if (!includeLower && lower < int.MaxValue)
+                {
+                    lower++;
+                }
+            }
+
+            if (upperVal == null)
+            {
+                upper = int.MaxValue;
+            }
+            else
+            {
+                upper = Convert.ToInt32(upperVal);
+                if (!includeUpper && upper > int.MinValue)
+                {
+                    upper--;
+                }
+            }
+
+            int ll = lower;
+            int uu = upper;
+
+            return new ValueSourceScorerAnonymousInnerClassHelper(this, reader, this, ll, uu);
+        }
+
+        private class ValueSourceScorerAnonymousInnerClassHelper : ValueSourceScorer
+        {
+            private readonly IntDocValues outerInstance;
+
+            private int ll;
+            private int uu;
+
+            public ValueSourceScorerAnonymousInnerClassHelper(IntDocValues outerInstance, IndexReader reader, IntDocValues @this, int ll, int uu)
+                : base(reader, @this)
+            {
+                this.outerInstance = outerInstance;
+                this.ll = ll;
+                this.uu = uu;
+            }
+
+            public override bool MatchesValue(int doc)
+            {
+                int val = outerInstance.IntVal(doc);
+                // only check for deleted if it's the default value
+                // if (val==0 && reader.isDeleted(doc)) return false;
+                return val >= ll && val <= uu;
+            }
+        }
+
+        public override AbstractValueFiller ValueFiller
+        {
+            get
+            {
+                return new ValueFillerAnonymousInnerClassHelper(this);
+            }
+        }
+
+        private class ValueFillerAnonymousInnerClassHelper : AbstractValueFiller
+        {
+            private readonly IntDocValues outerInstance;
+
+            public ValueFillerAnonymousInnerClassHelper(IntDocValues outerInstance)
+            {
+                this.outerInstance = outerInstance;
+                mval = new MutableValueInt();
+            }
+
+            private readonly MutableValueInt mval;
+
+            public override MutableValue Value
+            {
+                get
+                {
+                    return mval;
+                }
+            }
+
+            public override void FillValue(int doc)
+            {
+                mval.Value = outerInstance.IntVal(doc);
+                mval.Exists = outerInstance.Exists(doc);
+            }
+        }
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/DocValues/LongDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/DocValues/LongDocValues.cs b/src/Lucene.Net.Queries/Function/DocValues/LongDocValues.cs
index da27a4c..18700b2 100644
--- a/src/Lucene.Net.Queries/Function/DocValues/LongDocValues.cs
+++ b/src/Lucene.Net.Queries/Function/DocValues/LongDocValues.cs
@@ -1,193 +1,187 @@
 using System;
+using Lucene.Net.Index;
+using Lucene.Net.Util.Mutable;
 
-namespace org.apache.lucene.queries.function.docvalues
+namespace Lucene.Net.Queries.Function.DocValues
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueLong = org.apache.lucene.util.mutable.MutableValueLong;
-
-	/// <summary>
-	/// Abstract <seealso cref="FunctionValues"/> implementation which supports retrieving long values.
-	/// Implementations can control how the long values are loaded through <seealso cref="#longVal(int)"/>}
-	/// </summary>
-	public abstract class LongDocValues : FunctionValues
-	{
-	  protected internal readonly ValueSource vs;
-
-	  public LongDocValues(ValueSource vs)
-	  {
-		this.vs = vs;
-	  }
-
-	  public override sbyte byteVal(int doc)
-	  {
-		return (sbyte)longVal(doc);
-	  }
-
-	  public override short shortVal(int doc)
-	  {
-		return (short)longVal(doc);
-	  }
-
-	  public override float floatVal(int doc)
-	  {
-		return (float)longVal(doc);
-	  }
-
-	  public override int intVal(int doc)
-	  {
-		return (int)longVal(doc);
-	  }
-
-	  public override abstract long longVal(int doc);
-
-	  public override double doubleVal(int doc)
-	  {
-		return (double)longVal(doc);
-	  }
-
-	  public override bool boolVal(int doc)
-	  {
-		return longVal(doc) != 0;
-	  }
-
-	  public override string strVal(int doc)
-	  {
-		return Convert.ToString(longVal(doc));
-	  }
-
-	  public override object objectVal(int doc)
-	  {
-		return exists(doc) ? longVal(doc) : null;
-	  }
-
-	  public override string ToString(int doc)
-	  {
-		return vs.description() + '=' + strVal(doc);
-	  }
-
-	  protected internal virtual long externalToLong(string extVal)
-	  {
-		return Convert.ToInt64(extVal);
-	  }
-
-	  public override ValueSourceScorer getRangeScorer(IndexReader reader, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
-	  {
-		long lower, upper;
-
-		// instead of using separate comparison functions, adjust the endpoints.
-
-		if (lowerVal == null)
-		{
-		  lower = long.MinValue;
-		}
-		else
-		{
-		  lower = externalToLong(lowerVal);
-		  if (!includeLower && lower < long.MaxValue)
-		  {
-			  lower++;
-		  }
-		}
-
-		 if (upperVal == null)
-		 {
-		  upper = long.MaxValue;
-		 }
-		else
-		{
-		  upper = externalToLong(upperVal);
-		  if (!includeUpper && upper > long.MinValue)
-		  {
-			  upper--;
-		  }
-		}
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final long ll = lower;
-		long ll = lower;
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final long uu = upper;
-		long uu = upper;
-
-		return new ValueSourceScorerAnonymousInnerClassHelper(this, reader, this, ll, uu);
-	  }
-
-	  private class ValueSourceScorerAnonymousInnerClassHelper : ValueSourceScorer
-	  {
-		  private readonly LongDocValues outerInstance;
-
-		  private long ll;
-		  private long uu;
-
-		  public ValueSourceScorerAnonymousInnerClassHelper(LongDocValues outerInstance, IndexReader reader, org.apache.lucene.queries.function.docvalues.LongDocValues this, long ll, long uu) : base(reader, this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.ll = ll;
-			  this.uu = uu;
-		  }
-
-		  public override bool matchesValue(int doc)
-		  {
-			long val = outerInstance.longVal(doc);
-			// only check for deleted if it's the default value
-			// if (val==0 && reader.isDeleted(doc)) return false;
-			return val >= ll && val <= uu;
-		  }
-	  }
-
-	  public override ValueFiller ValueFiller
-	  {
-		  get
-		  {
-			return new ValueFillerAnonymousInnerClassHelper(this);
-		  }
-	  }
-
-	  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-	  {
-		  private readonly LongDocValues outerInstance;
-
-		  public ValueFillerAnonymousInnerClassHelper(LongDocValues outerInstance)
-		  {
-			  this.outerInstance = outerInstance;
-			  mval = new MutableValueLong();
-		  }
-
-		  private readonly MutableValueLong mval;
-
-		  public override MutableValue Value
-		  {
-			  get
-			  {
-				return mval;
-			  }
-		  }
-
-		  public override void fillValue(int doc)
-		  {
-			mval.value = outerInstance.longVal(doc);
-			mval.exists = outerInstance.exists(doc);
-		  }
-	  }
-	}
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// Abstract <seealso cref="FunctionValues"/> implementation which supports retrieving long values.
+    /// Implementations can control how the long values are loaded through <seealso cref="#LongVal(int)"/>}
+    /// </summary>
+    public abstract class LongDocValues : FunctionValues
+    {
+        protected internal readonly ValueSource vs;
+
+        protected LongDocValues(ValueSource vs)
+        {
+            this.vs = vs;
+        }
+
+        public override sbyte ByteVal(int doc)
+        {
+            return (sbyte)LongVal(doc);
+        }
+
+        public override short ShortVal(int doc)
+        {
+            return (short)LongVal(doc);
+        }
+
+        public override float FloatVal(int doc)
+        {
+            return (float)LongVal(doc);
+        }
+
+        public override int IntVal(int doc)
+        {
+            return (int)LongVal(doc);
+        }
+
+        public override abstract long LongVal(int doc);
+
+        public override double DoubleVal(int doc)
+        {
+            return (double)LongVal(doc);
+        }
+
+        public override bool BoolVal(int doc)
+        {
+            return LongVal(doc) != 0;
+        }
+
+        public override string StrVal(int doc)
+        {
+            return Convert.ToString(LongVal(doc));
+        }
+
+        public override object ObjectVal(int doc)
+        {
+            return Exists(doc) ? LongVal(doc) : (long?)null;
+        }
+
+        public override string ToString(int doc)
+        {
+            return vs.Description + '=' + StrVal(doc);
+        }
+
+        protected virtual long ExternalToLong(string extVal)
+        {
+            return Convert.ToInt64(extVal);
+        }
+
+        public override ValueSourceScorer GetRangeScorer(IndexReader reader, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
+        {
+            long lower, upper;
+
+            // instead of using separate comparison functions, adjust the endpoints.
+
+            if (lowerVal == null)
+            {
+                lower = long.MinValue;
+            }
+            else
+            {
+                lower = ExternalToLong(lowerVal);
+                if (!includeLower && lower < long.MaxValue)
+                {
+                    lower++;
+                }
+            }
+
+            if (upperVal == null)
+            {
+                upper = long.MaxValue;
+            }
+            else
+            {
+                upper = ExternalToLong(upperVal);
+                if (!includeUpper && upper > long.MinValue)
+                {
+                    upper--;
+                }
+            }
+
+            long ll = lower;
+            long uu = upper;
+
+            return new ValueSourceScorerAnonymousInnerClassHelper(this, reader, this, ll, uu);
+        }
+
+        private class ValueSourceScorerAnonymousInnerClassHelper : ValueSourceScorer
+        {
+            private readonly LongDocValues outerInstance;
+
+            private long ll;
+            private long uu;
+
+            public ValueSourceScorerAnonymousInnerClassHelper(LongDocValues outerInstance, IndexReader reader, LongDocValues @this, long ll, long uu)
+                : base(reader, @this)
+            {
+                this.outerInstance = outerInstance;
+                this.ll = ll;
+                this.uu = uu;
+            }
+
+            public override bool MatchesValue(int doc)
+            {
+                long val = outerInstance.LongVal(doc);
+                // only check for deleted if it's the default value
+                // if (val==0 && reader.isDeleted(doc)) return false;
+                return val >= ll && val <= uu;
+            }
+        }
+
+        public override AbstractValueFiller ValueFiller
+        {
+            get
+            {
+                return new ValueFillerAnonymousInnerClassHelper(this);
+            }
+        }
+
+        private class ValueFillerAnonymousInnerClassHelper : AbstractValueFiller
+        {
+            private readonly LongDocValues outerInstance;
+
+            public ValueFillerAnonymousInnerClassHelper(LongDocValues outerInstance)
+            {
+                this.outerInstance = outerInstance;
+                mval = new MutableValueLong();
+            }
+
+            private readonly MutableValueLong mval;
+
+            public override MutableValue Value
+            {
+                get
+                {
+                    return mval;
+                }
+            }
+
+            public override void FillValue(int doc)
+            {
+                mval.Value = outerInstance.LongVal(doc);
+                mval.Exists = outerInstance.Exists(doc);
+            }
+        }
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/DocValues/StrDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/DocValues/StrDocValues.cs b/src/Lucene.Net.Queries/Function/DocValues/StrDocValues.cs
index ea3c450..41f520a 100644
--- a/src/Lucene.Net.Queries/Function/DocValues/StrDocValues.cs
+++ b/src/Lucene.Net.Queries/Function/DocValues/StrDocValues.cs
@@ -1,89 +1,87 @@
-namespace org.apache.lucene.queries.function.docvalues
-{
-
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
+using Lucene.Net.Util.Mutable;
 
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueStr = org.apache.lucene.util.mutable.MutableValueStr;
+namespace Lucene.Net.Queries.Function.DocValues
+{
 
-	/// <summary>
-	/// Abstract <seealso cref="FunctionValues"/> implementation which supports retrieving String values.
-	/// Implementations can control how the String values are loaded through <seealso cref="#strVal(int)"/>}
-	/// </summary>
-	public abstract class StrDocValues : FunctionValues
-	{
-	  protected internal readonly ValueSource vs;
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// Abstract <seealso cref="FunctionValues"/> implementation which supports retrieving String values.
+    /// Implementations can control how the String values are loaded through <seealso cref="#StrVal(int)"/>}
+    /// </summary>
+    public abstract class StrDocValues : FunctionValues
+    {
+        protected internal readonly ValueSource vs;
 
-	  public StrDocValues(ValueSource vs)
-	  {
-		this.vs = vs;
-	  }
+        public StrDocValues(ValueSource vs)
+        {
+            this.vs = vs;
+        }
 
-	  public override abstract string strVal(int doc);
+        public override abstract string StrVal(int doc);
 
-	  public override object objectVal(int doc)
-	  {
-		return exists(doc) ? strVal(doc) : null;
-	  }
+        public override object ObjectVal(int doc)
+        {
+            return Exists(doc) ? StrVal(doc) : null;
+        }
 
-	  public override bool boolVal(int doc)
-	  {
-		return exists(doc);
-	  }
+        public override bool BoolVal(int doc)
+        {
+            return Exists(doc);
+        }
 
-	  public override string ToString(int doc)
-	  {
-		return vs.description() + "='" + strVal(doc) + "'";
-	  }
+        public override string ToString(int doc)
+        {
+            return vs.Description + "='" + StrVal(doc) + "'";
+        }
 
-	  public override ValueFiller ValueFiller
-	  {
-		  get
-		  {
-			return new ValueFillerAnonymousInnerClassHelper(this);
-		  }
-	  }
+        public override AbstractValueFiller ValueFiller
+        {
+            get
+            {
+                return new ValueFillerAnonymousInnerClassHelper(this);
+            }
+        }
 
-	  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-	  {
-		  private readonly StrDocValues outerInstance;
+        private class ValueFillerAnonymousInnerClassHelper : AbstractValueFiller
+        {
+            private readonly StrDocValues outerInstance;
 
-		  public ValueFillerAnonymousInnerClassHelper(StrDocValues outerInstance)
-		  {
-			  this.outerInstance = outerInstance;
-			  mval = new MutableValueStr();
-		  }
+            public ValueFillerAnonymousInnerClassHelper(StrDocValues outerInstance)
+            {
+                this.outerInstance = outerInstance;
+                mval = new MutableValueStr();
+            }
 
-		  private readonly MutableValueStr mval;
+            private readonly MutableValueStr mval;
 
-		  public override MutableValue Value
-		  {
-			  get
-			  {
-				return mval;
-			  }
-		  }
+            public override MutableValue Value
+            {
+                get
+                {
+                    return mval;
+                }
+            }
 
-		  public override void fillValue(int doc)
-		  {
-			mval.exists = outerInstance.bytesVal(doc, mval.value);
-		  }
-	  }
-	}
+            public override void FillValue(int doc)
+            {
+                mval.Exists = outerInstance.BytesVal(doc, mval.Value);
+            }
+        }
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/FunctionQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/FunctionQuery.cs b/src/Lucene.Net.Queries/Function/FunctionQuery.cs
index e0642f1..13044b3 100644
--- a/src/Lucene.Net.Queries/Function/FunctionQuery.cs
+++ b/src/Lucene.Net.Queries/Function/FunctionQuery.cs
@@ -1,270 +1,255 @@
 using System.Collections;
 using System.Collections.Generic;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
+using Lucene.Net.Util;
+using org.apache.lucene.queries.function;
 
-namespace org.apache.lucene.queries.function
+namespace Lucene.Net.Queries.Function
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using Term = org.apache.lucene.index.Term;
-	using org.apache.lucene.search;
-	using MultiFields = org.apache.lucene.index.MultiFields;
-	using Bits = org.apache.lucene.util.Bits;
-
-
-
-	/// <summary>
-	/// Returns a score for each document based on a ValueSource,
-	/// often some function of the value of a field.
-	/// 
-	/// <b>Note: This API is experimental and may change in non backward-compatible ways in the future</b>
-	/// 
-	/// 
-	/// </summary>
-	public class FunctionQuery : Query
-	{
-	  internal readonly ValueSource func;
-
-	  /// <param name="func"> defines the function to be used for scoring </param>
-	  public FunctionQuery(ValueSource func)
-	  {
-		this.func = func;
-	  }
-
-	  /// <returns> The associated ValueSource </returns>
-	  public virtual ValueSource ValueSource
-	  {
-		  get
-		  {
-			return func;
-		  }
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public Query rewrite(org.apache.lucene.index.IndexReader reader) throws java.io.IOException
-	  public override Query rewrite(IndexReader reader)
-	  {
-		return this;
-	  }
-
-	  public override void extractTerms(HashSet<Term> terms)
-	  {
-	  }
-
-	  protected internal class FunctionWeight : Weight
-	  {
-		  private readonly FunctionQuery outerInstance;
-
-		protected internal readonly IndexSearcher searcher;
-		protected internal float queryNorm;
-		protected internal float queryWeight;
-		protected internal readonly IDictionary context;
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public FunctionWeight(IndexSearcher searcher) throws java.io.IOException
-		public FunctionWeight(FunctionQuery outerInstance, IndexSearcher searcher)
-		{
-			this.outerInstance = outerInstance;
-		  this.searcher = searcher;
-		  this.context = ValueSource.newContext(searcher);
-		  outerInstance.func.createWeight(context, searcher);
-		}
-
-		public override Query Query
-		{
-			get
-			{
-			  return outerInstance;
-			}
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public float getValueForNormalization() throws java.io.IOException
-		public override float ValueForNormalization
-		{
-			get
-			{
-			  queryWeight = Boost;
-			  return queryWeight * queryWeight;
-			}
-		}
-
-		public override void normalize(float norm, float topLevelBoost)
-		{
-		  this.queryNorm = norm * topLevelBoost;
-		  queryWeight *= this.queryNorm;
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public Scorer scorer(org.apache.lucene.index.AtomicReaderContext context, org.apache.lucene.util.Bits acceptDocs) throws java.io.IOException
-		public override Scorer scorer(AtomicReaderContext context, Bits acceptDocs)
-		{
-		  return new AllScorer(outerInstance, context, acceptDocs, this, queryWeight);
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public Explanation explain(org.apache.lucene.index.AtomicReaderContext context, int doc) throws java.io.IOException
-		public override Explanation explain(AtomicReaderContext context, int doc)
-		{
-		  return ((AllScorer)scorer(context, context.reader().LiveDocs)).explain(doc);
-		}
-	  }
-
-	  protected internal class AllScorer : Scorer
-	  {
-		  private readonly FunctionQuery outerInstance;
-
-		internal readonly IndexReader reader;
-		internal readonly FunctionWeight weight;
-		internal readonly int maxDoc;
-		internal readonly float qWeight;
-		internal int doc = -1;
-		internal readonly FunctionValues vals;
-		internal readonly Bits acceptDocs;
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public AllScorer(org.apache.lucene.index.AtomicReaderContext context, org.apache.lucene.util.Bits acceptDocs, FunctionWeight w, float qWeight) throws java.io.IOException
-		public AllScorer(FunctionQuery outerInstance, AtomicReaderContext context, Bits acceptDocs, FunctionWeight w, float qWeight) : base(w)
-		{
-			this.outerInstance = outerInstance;
-		  this.weight = w;
-		  this.qWeight = qWeight;
-		  this.reader = context.reader();
-		  this.maxDoc = reader.maxDoc();
-		  this.acceptDocs = acceptDocs;
-		  vals = outerInstance.func.getValues(weight.context, context);
-		}
-
-		public override int docID()
-		{
-		  return doc;
-		}
-
-		// instead of matching all docs, we could also embed a query.
-		// the score could either ignore the subscore, or boost it.
-		// Containment:  floatline(foo:myTerm, "myFloatField", 1.0, 0.0f)
-		// Boost:        foo:myTerm^floatline("myFloatField",1.0,0.0f)
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public int nextDoc() throws java.io.IOException
-		public override int nextDoc()
-		{
-		  for (;;)
-		  {
-			++doc;
-			if (doc >= maxDoc)
-			{
-			  return doc = NO_MORE_DOCS;
-			}
-			if (acceptDocs != null && !acceptDocs.get(doc))
-			{
-				continue;
-			}
-			return doc;
-		  }
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public int advance(int target) throws java.io.IOException
-		public override int advance(int target)
-		{
-		  // this will work even if target==NO_MORE_DOCS
-		  doc = target - 1;
-		  return nextDoc();
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public float score() throws java.io.IOException
-		public override float score()
-		{
-		  float score = qWeight * vals.floatVal(doc);
-
-		  // Current Lucene priority queues can't handle NaN and -Infinity, so
-		  // map to -Float.MAX_VALUE. This conditional handles both -infinity
-		  // and NaN since comparisons with NaN are always false.
-		  return score > float.NegativeInfinity ? score : -float.MaxValue;
-		}
-
-		public override long cost()
-		{
-		  return maxDoc;
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public int freq() throws java.io.IOException
-		public override int freq()
-		{
-		  return 1;
-		}
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public Explanation explain(int doc) throws java.io.IOException
-		public virtual Explanation explain(int doc)
-		{
-		  float sc = qWeight * vals.floatVal(doc);
-
-		  Explanation result = new ComplexExplanation(true, sc, "FunctionQuery(" + outerInstance.func + "), product of:");
-
-		  result.addDetail(vals.explain(doc));
-		  result.addDetail(new Explanation(Boost, "boost"));
-		  result.addDetail(new Explanation(weight.queryNorm,"queryNorm"));
-		  return result;
-		}
-	  }
-
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public Weight createWeight(IndexSearcher searcher) throws java.io.IOException
-	  public override Weight createWeight(IndexSearcher searcher)
-	  {
-		return new FunctionQuery.FunctionWeight(this, searcher);
-	  }
-
-
-	  /// <summary>
-	  /// Prints a user-readable version of this query. </summary>
-	  public override string ToString(string field)
-	  {
-		float boost = Boost;
-		return (boost != 1.0?"(":"") + func.ToString() + (boost == 1.0 ? "" : ")^" + boost);
-	  }
-
-
-	  /// <summary>
-	  /// Returns true if <code>o</code> is equal to this. </summary>
-	  public override bool Equals(object o)
-	  {
-		if (!typeof(FunctionQuery).IsInstanceOfType(o))
-		{
-			return false;
-		}
-		FunctionQuery other = (FunctionQuery)o;
-		return this.Boost == other.Boost && this.func.Equals(other.func);
-	  }
-
-	  /// <summary>
-	  /// Returns a hash code value for this object. </summary>
-	  public override int GetHashCode()
-	  {
-		return func.GetHashCode() * 31 + float.floatToIntBits(Boost);
-	  }
-
-	}
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+    /// <summary>
+    /// Returns a score for each document based on a ValueSource,
+    /// often some function of the value of a field.
+    /// 
+    /// <b>Note: This API is experimental and may change in non backward-compatible ways in the future</b>
+    /// 
+    /// 
+    /// </summary>
+    public class FunctionQuery : Query
+    {
+        internal readonly ValueSource func;
+
+        /// <param name="func"> defines the function to be used for scoring </param>
+        public FunctionQuery(ValueSource func)
+        {
+            this.func = func;
+        }
+
+        /// <returns> The associated ValueSource </returns>
+        public virtual ValueSource ValueSource
+        {
+            get
+            {
+                return func;
+            }
+        }
+
+        public override Query Rewrite(IndexReader reader)
+        {
+            return this;
+        }
+
+        public override void ExtractTerms(HashSet<Term> terms)
+        {
+        }
+
+        protected internal class FunctionWeight : Weight
+        {
+            private readonly FunctionQuery outerInstance;
+
+            protected internal readonly IndexSearcher searcher;
+            protected internal float queryNorm;
+            protected internal float queryWeight;
+            protected internal readonly IDictionary context;
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: public FunctionWeight(IndexSearcher searcher) throws java.io.IOException
+            public FunctionWeight(FunctionQuery outerInstance, IndexSearcher searcher)
+            {
+                this.outerInstance = outerInstance;
+                this.searcher = searcher;
+                this.context = ValueSource.newContext(searcher);
+                outerInstance.func.CreateWeight(context, searcher);
+            }
+
+            public override Query Query
+            {
+                get
+                {
+                    return outerInstance;
+                }
+            }
+
+            public override float ValueForNormalization
+            {
+                get
+                {
+                    queryWeight = Boost;
+                    return queryWeight * queryWeight;
+                }
+            }
+
+            public override void Normalize(float norm, float topLevelBoost)
+            {
+                this.queryNorm = norm * topLevelBoost;
+                queryWeight *= this.queryNorm;
+            }
+
+            public override Scorer Scorer(AtomicReaderContext context, Bits acceptDocs)
+            {
+                return new AllScorer(outerInstance, context, acceptDocs, this, queryWeight);
+            }
+
+            public override Explanation Explain(AtomicReaderContext context, int doc)
+            {
+                return ((AllScorer)Scorer(context, context.reader().LiveDocs)).Explain(doc);
+            }
+        }
+
+        protected internal class AllScorer : Scorer
+        {
+            private readonly FunctionQuery outerInstance;
+
+            internal readonly IndexReader reader;
+            internal readonly FunctionWeight weight;
+            internal readonly int maxDoc;
+            internal readonly float qWeight;
+            internal int doc = -1;
+            internal readonly FunctionValues vals;
+            internal readonly Bits acceptDocs;
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: public AllScorer(org.apache.lucene.index.AtomicReaderContext context, org.apache.lucene.util.Bits acceptDocs, FunctionWeight w, float qWeight) throws java.io.IOException
+            public AllScorer(FunctionQuery outerInstance, AtomicReaderContext context, Bits acceptDocs, FunctionWeight w, float qWeight)
+                : base(w)
+            {
+                this.outerInstance = outerInstance;
+                this.weight = w;
+                this.qWeight = qWeight;
+                this.reader = context.Reader;
+                this.maxDoc = reader.MaxDoc;
+                this.acceptDocs = acceptDocs;
+                vals = outerInstance.func.GetValues(weight.context, context);
+            }
+
+            public override int DocID()
+            {
+                return doc;
+            }
+
+            // instead of matching all docs, we could also embed a query.
+            // the score could either ignore the subscore, or boost it.
+            // Containment:  floatline(foo:myTerm, "myFloatField", 1.0, 0.0f)
+            // Boost:        foo:myTerm^floatline("myFloatField",1.0,0.0f)
+            public override int NextDoc()
+            {
+                for (; ; )
+                {
+                    ++doc;
+                    if (doc >= maxDoc)
+                    {
+                        return doc = NO_MORE_DOCS;
+                    }
+                    if (acceptDocs != null && !acceptDocs.Get(doc))
+                    {
+                        continue;
+                    }
+                    return doc;
+                }
+            }
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: @Override public int advance(int target) throws java.io.IOException
+            public override int Advance(int target)
+            {
+                // this will work even if target==NO_MORE_DOCS
+                doc = target - 1;
+                return NextDoc();
+            }
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: @Override public float score() throws java.io.IOException
+            public override float Score()
+            {
+                float score = qWeight * vals.FloatVal(doc);
+
+                // Current Lucene priority queues can't handle NaN and -Infinity, so
+                // map to -Float.MAX_VALUE. This conditional handles both -infinity
+                // and NaN since comparisons with NaN are always false.
+                return score > float.NegativeInfinity ? score : -float.MaxValue;
+            }
+
+            public override long Cost()
+            {
+                return maxDoc;
+            }
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: @Override public int freq() throws java.io.IOException
+            public override int Freq()
+            {
+                return 1;
+            }
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: public Explanation explain(int doc) throws java.io.IOException
+            public virtual Explanation Explain(int doc)
+            {
+                float sc = qWeight * vals.FloatVal(doc);
+
+                Explanation result = new ComplexExplanation(true, sc, "FunctionQuery(" + outerInstance.func + "), product of:");
+
+                result.AddDetail(vals.Explain(doc));
+                result.AddDetail(new Explanation(Boost, "boost"));
+                result.AddDetail(new Explanation(weight.queryNorm, "queryNorm"));
+                return result;
+            }
+        }
+
+
+        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+        //ORIGINAL LINE: @Override public Weight CreateWeight(IndexSearcher searcher) throws java.io.IOException
+        public override Weight CreateWeight(IndexSearcher searcher)
+        {
+            return new FunctionQuery.FunctionWeight(this, searcher);
+        }
+
+
+        /// <summary>
+        /// Prints a user-readable version of this query. </summary>
+        public override string ToString(string field)
+        {
+            float boost = Boost;
+            return (boost != 1.0 ? "(" : "") + func.ToString() + (boost == 1.0 ? "" : ")^" + boost);
+        }
+
+
+        /// <summary>
+        /// Returns true if <code>o</code> is equal to this. </summary>
+        public override bool Equals(object o)
+        {
+            if (!typeof(FunctionQuery).IsInstanceOfType(o))
+            {
+                return false;
+            }
+            FunctionQuery other = (FunctionQuery)o;
+            return this.Boost == other.Boost && this.func.Equals(other.func);
+        }
+
+        /// <summary>
+        /// Returns a hash code value for this object. </summary>
+        public override int GetHashCode()
+        {
+            return func.GetHashCode() * 31 + Number.FloatToIntBits(Boost);
+        }
+
+    }
 
 }
\ No newline at end of file


[21/21] git commit: Cleanup

Posted by sy...@apache.org.
Cleanup


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/433a340a
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/433a340a
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/433a340a

Branch: refs/heads/master
Commit: 433a340a40be8f1a563c41f2249210dc39a4751b
Parents: ba0f3c7
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Fri Sep 19 17:18:28 2014 +0300
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Fri Sep 19 17:18:28 2014 +0300

----------------------------------------------------------------------
 src/Lucene.Net.Core/Search/FieldCache.cs         |  6 ++----
 src/Lucene.Net.Core/Search/Filter.cs             |  3 ++-
 src/Lucene.Net.Core/Search/Weight.cs             |  2 ++
 src/Lucene.Net.Core/Util/Mutable/MutableValue.cs | 19 +------------------
 4 files changed, 7 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/433a340a/src/Lucene.Net.Core/Search/FieldCache.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldCache.cs b/src/Lucene.Net.Core/Search/FieldCache.cs
index fa9a75b..187e0c7 100644
--- a/src/Lucene.Net.Core/Search/FieldCache.cs
+++ b/src/Lucene.Net.Core/Search/FieldCache.cs
@@ -49,9 +49,7 @@ namespace Lucene.Net.Search
     /// <p>Created: May 19, 2004 11:13:14 AM
     ///
     /// @since   lucene 1.4 </summary>
-    /// <seealso cref= Lucene.Net.Util.FieldCacheSanityChecker
-    ///
-    /// @lucene.internal </seealso>
+    /// <seealso cref=Lucene.Net.Util.FieldCacheSanityChecker</seealso>
     public interface FieldCache
     {
         /// <summary>
@@ -121,7 +119,7 @@ namespace Lucene.Net.Search
         FieldCache_Fields.Shorts GetShorts(AtomicReader reader, string field, FieldCache_Fields.IShortParser parser, bool setDocsWithField);
 
         /// <summary>
-        /// Returns an <seealso cref="Ints"/> over the values found in documents in the given
+        /// Returns an <seealso cref="FieldCache_Fields.Ints"/> over the values found in documents in the given
         /// field.
         /// </summary>
         /// <seealso cref= #getInts(AtomicReader, String, IntParser, boolean) </seealso>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/433a340a/src/Lucene.Net.Core/Search/Filter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Filter.cs b/src/Lucene.Net.Core/Search/Filter.cs
index 145d6fb..2057f5e 100644
--- a/src/Lucene.Net.Core/Search/Filter.cs
+++ b/src/Lucene.Net.Core/Search/Filter.cs
@@ -1,3 +1,5 @@
+using Lucene.Net.Index;
+
 namespace Lucene.Net.Search
 {
     /*
@@ -17,7 +19,6 @@ namespace Lucene.Net.Search
      * limitations under the License.
      */
 
-    // javadocs
     using AtomicReaderContext = Lucene.Net.Index.AtomicReaderContext;
     using Bits = Lucene.Net.Util.Bits;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/433a340a/src/Lucene.Net.Core/Search/Weight.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Weight.cs b/src/Lucene.Net.Core/Search/Weight.cs
index 79a3cbb..7f69e52 100644
--- a/src/Lucene.Net.Core/Search/Weight.cs
+++ b/src/Lucene.Net.Core/Search/Weight.cs
@@ -1,3 +1,5 @@
+using System.IO;
+
 namespace Lucene.Net.Search
 {
     /*

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/433a340a/src/Lucene.Net.Core/Util/Mutable/MutableValue.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Mutable/MutableValue.cs b/src/Lucene.Net.Core/Util/Mutable/MutableValue.cs
index 63e402c..328a080 100644
--- a/src/Lucene.Net.Core/Util/Mutable/MutableValue.cs
+++ b/src/Lucene.Net.Core/Util/Mutable/MutableValue.cs
@@ -26,19 +26,7 @@ namespace Lucene.Net.Util.Mutable
     /// </summary>
     public abstract class MutableValue : IComparable<MutableValue>
     {
-        private bool exists = true;
-
-        public bool Exists
-        {
-            get
-            {
-                return exists;
-            }
-            set
-            {
-                exists = value;
-            }
-        }
+        public bool Exists { get; set; }
 
         public abstract void Copy(MutableValue source);
 
@@ -50,11 +38,6 @@ namespace Lucene.Net.Util.Mutable
 
         public abstract object ToObject();
 
-        /*public virtual bool Exists()
-        {
-          return exists;
-        }*/
-
         public virtual int CompareTo(MutableValue other)
         {
             Type c1 = this.GetType();


[04/21] git commit: Fixed TestIOUtils.TestSuppressedExceptions

Posted by sy...@apache.org.
Fixed TestIOUtils.TestSuppressedExceptions

Rewrote the tests and some of the tested code to work around C# not
having Java's Exception.addSuppressed.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/021236d6
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/021236d6
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/021236d6

Branch: refs/heads/master
Commit: 021236d6614c55ca2acac7a6c993b060ca2c5ee6
Parents: 9b9b4a2
Author: Prad Nelluru <pr...@microsoft.com>
Authored: Tue Sep 16 14:25:20 2014 -0700
Committer: Prad Nelluru <pr...@microsoft.com>
Committed: Tue Sep 16 14:25:20 2014 -0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/IOUtils.cs           | 20 ++++++++---
 src/Lucene.Net.Tests/core/Util/TestIOUtils.cs | 42 ++++++----------------
 2 files changed, 25 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/021236d6/src/Lucene.Net.Core/Util/IOUtils.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/IOUtils.cs b/src/Lucene.Net.Core/Util/IOUtils.cs
index 9f1d1fb..78236e4 100644
--- a/src/Lucene.Net.Core/Util/IOUtils.cs
+++ b/src/Lucene.Net.Core/Util/IOUtils.cs
@@ -252,16 +252,26 @@ namespace Lucene.Net.Util
         }
 
         /// <summary>
-        /// adds a Throwable to the list of suppressed Exceptions of the first Throwable </summary>
+        /// Since there's no C# equivalent of Java's Exception.AddSuppressed, we add the
+        /// suppressed exceptions to a data field. </summary>
         /// <param name="exception"> this exception should get the suppressed one added </param>
         /// <param name="suppressed"> the suppressed exception </param>
         private static void AddSuppressed(Exception exception, Exception suppressed)
         {
-            //LUCENE TO-DO I don't think there is a .NET equivalent
-            /*if (exception != null && suppressed != null)
+            if (exception != null && suppressed != null)
             {
-              exception.AddSuppressed(suppressed);
-            }*/
+                List<Exception> suppressedExceptions;
+                if (!exception.Data.Contains("SuppressedExceptions"))
+                {
+                    suppressedExceptions = new List<Exception>();
+                    exception.Data.Add("SuppressedExceptions", suppressedExceptions);
+                }
+                else
+                {
+                    suppressedExceptions = (List<Exception>) exception.Data["SuppressedExceptions"];
+                }
+                suppressedExceptions.Add(suppressed);
+            }
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/021236d6/src/Lucene.Net.Tests/core/Util/TestIOUtils.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestIOUtils.cs b/src/Lucene.Net.Tests/core/Util/TestIOUtils.cs
index 3665c31..2682431 100644
--- a/src/Lucene.Net.Tests/core/Util/TestIOUtils.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestIOUtils.cs
@@ -1,3 +1,4 @@
+using System.Collections.Generic;
 using NUnit.Framework;
 using System;
 using System.IO;
@@ -59,24 +60,12 @@ namespace Lucene.Net.Util
             }
             catch (TestException e1)
             {
-                Assert.AreEqual("BASE-EXCEPTION", e1.Message);
-                StringBuilder sb = new StringBuilder();
-                //StreamWriter pw = new StreamWriter(sw);
-                //e1.printStackTrace(pw);
-                sb.Append(e1.StackTrace);
-                //pw.Flush();
-                string trace = sb.ToString();
-                if (VERBOSE)
-                {
-                    Console.WriteLine("TestIOUtils.testSuppressedExceptions: Thrown Exception stack trace:");
-                    Console.WriteLine(trace);
-                }
-                Assert.IsTrue(trace.Contains("IOException: TEST-IO-EXCEPTION-1"), "Stack trace does not contain first suppressed Exception: " + trace);
-                Assert.IsTrue(trace.Contains("IOException: TEST-IO-EXCEPTION-2"), "Stack trace does not contain second suppressed Exception: " + trace);
+                Assert.IsTrue(e1.Data.Contains("SuppressedExceptions"));
+                Assert.IsTrue(((List<Exception>) e1.Data["SuppressedExceptions"]).Count == 2);
             }
-            catch (IOException e2)
+            catch (Exception e2)
             {
-                Assert.Fail("IOException should not be thrown here");
+                Assert.Fail("Exception should not be thrown here");
             }
 
             // test without prior exception
@@ -84,25 +73,14 @@ namespace Lucene.Net.Util
             {
                 IOUtils.CloseWhileHandlingException((TestException)null, new BrokenIDisposable(1), new BrokenIDisposable(2));
             }
-            catch (TestException e1)
+            catch (IOException e1)
             {
-                Assert.Fail("TestException should not be thrown here");
+                Assert.IsTrue(e1.Data.Contains("SuppressedExceptions"));
+                Assert.IsTrue(((List<Exception>)e1.Data["SuppressedExceptions"]).Count == 1);
             }
-            catch (IOException e2)
+            catch (Exception e2)
             {
-                Assert.AreEqual("TEST-IO-EXCEPTION-1", e2.Message);
-                StringBuilder sb = new StringBuilder();
-                sb.Append(e2.StackTrace);
-                //StreamWriter pw = new StreamWriter(sw);
-                //e2.printStackTrace(pw);
-                //pw.Flush();
-                string trace = sb.ToString();
-                if (VERBOSE)
-                {
-                    Console.WriteLine("TestIOUtils.TestSuppressedExceptions: Thrown Exception stack trace:");
-                    Console.WriteLine(trace);
-                }
-                Assert.IsTrue(trace.Contains("IOException: TEST-IO-EXCEPTION-2"), "Stack trace does not contain suppressed Exception: " + trace);
+                Assert.Fail("Exception should not be thrown here");
             }
         }
     }


[13/21] git commit: Moving ValueSource -> ValueSources to avoid name conflicts

Posted by sy...@apache.org.
Moving ValueSource -> ValueSources to avoid name conflicts


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/2b55e53c
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/2b55e53c
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/2b55e53c

Branch: refs/heads/master
Commit: 2b55e53c47beb47458abe54e1d4bfd2ab4736141
Parents: 7b2da40
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Fri Sep 19 10:44:49 2014 +0300
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Fri Sep 19 10:44:49 2014 +0300

----------------------------------------------------------------------
 .../Function/ValueSource/BoolFunction.cs        |  30 --
 .../Function/ValueSource/ByteFieldSource.cs     | 142 --------
 .../Function/ValueSource/BytesRefFieldSource.cs | 140 --------
 .../Function/ValueSource/ConstNumberSource.cs   |  34 --
 .../Function/ValueSource/ConstValueSource.cs    | 156 ---------
 .../Function/ValueSource/DefFunction.cs         | 153 ---------
 .../Function/ValueSource/DivFloatFunction.cs    |  44 ---
 .../Function/ValueSource/DocFreqValueSource.cs  | 186 ----------
 .../ValueSource/DoubleConstValueSource.cs       | 166 ---------
 .../Function/ValueSource/DoubleFieldSource.cs   | 149 --------
 .../Function/ValueSource/DualFloatFunction.cs   | 121 -------
 .../Function/ValueSource/EnumFieldSource.cs     | 343 -------------------
 .../Function/ValueSource/FieldCacheSource.cs    |  77 -----
 .../Function/ValueSource/FloatFieldSource.cs    | 152 --------
 .../Function/ValueSource/IDFValueSource.cs      |  85 -----
 .../Function/ValueSource/IfFunction.cs          | 186 ----------
 .../Function/ValueSource/IntFieldSource.cs      | 183 ----------
 .../ValueSource/JoinDocFreqValueSource.cs       | 134 --------
 .../Function/ValueSource/LinearFloatFunction.cs | 113 ------
 .../Function/ValueSource/LiteralValueSource.cs  | 117 -------
 .../Function/ValueSource/LongFieldSource.cs     | 184 ----------
 .../Function/ValueSource/MaxDocValueSource.cs   |  70 ----
 .../Function/ValueSource/MaxFloatFunction.cs    |  53 ---
 .../Function/ValueSource/MinFloatFunction.cs    |  53 ---
 .../Function/ValueSource/MultiBoolFunction.cs   | 148 --------
 .../Function/ValueSource/MultiFloatFunction.cs  | 146 --------
 .../Function/ValueSource/MultiFunction.cs       | 161 ---------
 .../Function/ValueSource/MultiValueSource.cs    |  32 --
 .../Function/ValueSource/NormValueSource.cs     | 125 -------
 .../Function/ValueSource/NumDocsValueSource.cs  |  63 ----
 .../Function/ValueSource/OrdFieldSource.cs      | 175 ----------
 .../Function/ValueSource/PowFloatFunction.cs    |  48 ---
 .../ValueSource/ProductFloatFunction.cs         |  47 ---
 .../Function/ValueSource/QueryValueSource.cs    | 328 ------------------
 .../ValueSource/RangeMapFloatFunction.cs        | 138 --------
 .../ValueSource/ReciprocalFloatFunction.cs      | 130 -------
 .../ValueSource/ReverseOrdFieldSource.cs        | 135 --------
 .../Function/ValueSource/ScaleFloatFunction.cs  | 200 -----------
 .../Function/ValueSource/ShortFieldSource.cs    | 137 --------
 .../Function/ValueSource/SimpleBoolFunction.cs  | 108 ------
 .../Function/ValueSource/SimpleFloatFunction.cs |  71 ----
 .../Function/ValueSource/SingleFunction.cs      |  67 ----
 .../Function/ValueSource/SumFloatFunction.cs    |  46 ---
 .../ValueSource/SumTotalTermFreqValueSource.cs  | 132 -------
 .../Function/ValueSource/TFValueSource.cs       | 197 -----------
 .../Function/ValueSource/TermFreqValueSource.cs | 186 ----------
 .../ValueSource/TotalTermFreqValueSource.cs     | 127 -------
 .../Function/ValueSource/VectorValueSource.cs   | 293 ----------------
 .../Function/ValueSources/BoolFunction.cs       |  30 ++
 .../Function/ValueSources/ByteFieldSource.cs    | 138 ++++++++
 .../ValueSources/BytesRefFieldSource.cs         | 131 +++++++
 .../Function/ValueSources/ConstNumberSource.cs  |  34 ++
 .../Function/ValueSources/ConstValueSource.cs   | 152 ++++++++
 .../Function/ValueSources/DefFunction.cs        | 148 ++++++++
 .../Function/ValueSources/DivFloatFunction.cs   |  46 +++
 .../Function/ValueSources/DocFreqValueSource.cs | 177 ++++++++++
 .../ValueSources/DoubleConstValueSource.cs      | 162 +++++++++
 .../Function/ValueSources/DoubleFieldSource.cs  | 140 ++++++++
 .../Function/ValueSources/DualFloatFunction.cs  | 116 +++++++
 .../Function/ValueSources/EnumFieldSource.cs    | 335 ++++++++++++++++++
 .../Function/ValueSources/FieldCacheSource.cs   |  74 ++++
 .../Function/ValueSources/FloatFieldSource.cs   | 144 ++++++++
 .../Function/ValueSources/IDFValueSource.cs     |  76 ++++
 .../Function/ValueSources/IfFunction.cs         | 177 ++++++++++
 .../Function/ValueSources/IntFieldSource.cs     | 174 ++++++++++
 .../ValueSources/JoinDocFreqValueSource.cs      | 122 +++++++
 .../ValueSources/LinearFloatFunction.cs         | 108 ++++++
 .../Function/ValueSources/LiteralValueSource.cs | 112 ++++++
 .../Function/ValueSources/LongFieldSource.cs    | 175 ++++++++++
 .../Function/ValueSources/MaxDocValueSource.cs  |  68 ++++
 .../Function/ValueSources/MaxFloatFunction.cs   |  53 +++
 .../Function/ValueSources/MinFloatFunction.cs   |  53 +++
 .../Function/ValueSources/MultiBoolFunction.cs  | 143 ++++++++
 .../Function/ValueSources/MultiFloatFunction.cs | 141 ++++++++
 .../Function/ValueSources/MultiFunction.cs      | 156 +++++++++
 .../Function/ValueSources/MultiValueSource.cs   |  32 ++
 .../Function/ValueSources/NormValueSource.cs    | 118 +++++++
 .../Function/ValueSources/NumDocsValueSource.cs |  59 ++++
 .../Function/ValueSources/OrdFieldSource.cs     | 162 +++++++++
 .../Function/ValueSources/PowFloatFunction.cs   |  48 +++
 .../ValueSources/ProductFloatFunction.cs        |  49 +++
 .../Function/ValueSources/QueryValueSource.cs   | 319 +++++++++++++++++
 .../ValueSources/RangeMapFloatFunction.cs       | 133 +++++++
 .../ValueSources/ReciprocalFloatFunction.cs     | 125 +++++++
 .../ValueSources/ReverseOrdFieldSource.cs       | 124 +++++++
 .../Function/ValueSources/ScaleFloatFunction.cs | 195 +++++++++++
 .../Function/ValueSources/ShortFieldSource.cs   | 132 +++++++
 .../Function/ValueSources/SimpleBoolFunction.cs | 103 ++++++
 .../ValueSources/SimpleFloatFunction.cs         |  64 ++++
 .../Function/ValueSources/SingleFunction.cs     |  62 ++++
 .../Function/ValueSources/SumFloatFunction.cs   |  48 +++
 .../ValueSources/SumTotalTermFreqValueSource.cs | 124 +++++++
 .../Function/ValueSources/TFValueSource.cs      | 190 ++++++++++
 .../ValueSources/TermFreqValueSource.cs         | 180 ++++++++++
 .../ValueSources/TotalTermFreqValueSource.cs    | 120 +++++++
 .../Function/ValueSources/VectorValueSource.cs  | 288 ++++++++++++++++
 .../Lucene.Net.Queries.csproj                   |  96 +++---
 97 files changed, 6108 insertions(+), 6359 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/BoolFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/BoolFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/BoolFunction.cs
deleted file mode 100644
index 85399df..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/BoolFunction.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	/// <summary>
-	/// Abstract parent class for those <seealso cref="ValueSource"/> implementations which
-	/// apply boolean logic to their values
-	/// </summary>
-	public abstract class BoolFunction : ValueSource
-	{
-	  // TODO: placeholder to return type, among other common future functionality
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/ByteFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/ByteFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/ByteFieldSource.cs
deleted file mode 100644
index 0e2ffc6..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/ByteFieldSource.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-using System;
-using System.Collections;
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using FieldCache = org.apache.lucene.search.FieldCache;
-
-	/// <summary>
-	/// Obtains int field values from the <seealso cref="org.apache.lucene.search.FieldCache"/>
-	/// using <code>getInts()</code>
-	/// and makes those values available as other numeric types, casting as needed. *
-	/// 
-	/// 
-	/// </summary>
-	[Obsolete]
-	public class ByteFieldSource : FieldCacheSource
-	{
-
-	  private readonly FieldCache.ByteParser parser;
-
-	  public ByteFieldSource(string field) : this(field, null)
-	  {
-	  }
-
-	  public ByteFieldSource(string field, FieldCache.ByteParser parser) : base(field)
-	  {
-		this.parser = parser;
-	  }
-
-	  public override string description()
-	  {
-		return "byte(" + field + ')';
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Bytes arr = cache.getBytes(readerContext.reader(), field, parser, false);
-		FieldCache.Bytes arr = cache.getBytes(readerContext.reader(), field, parser, false);
-
-		return new FunctionValuesAnonymousInnerClassHelper(this, arr);
-	  }
-
-	  private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
-	  {
-		  private readonly ByteFieldSource outerInstance;
-
-		  private FieldCache.Bytes arr;
-
-		  public FunctionValuesAnonymousInnerClassHelper(ByteFieldSource outerInstance, FieldCache.Bytes arr)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.arr = arr;
-		  }
-
-		  public override sbyte byteVal(int doc)
-		  {
-			return arr.get(doc);
-		  }
-
-		  public override short shortVal(int doc)
-		  {
-			return (short) arr.get(doc);
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return (float) arr.get(doc);
-		  }
-
-		  public override int intVal(int doc)
-		  {
-			return (int) arr.get(doc);
-		  }
-
-		  public override long longVal(int doc)
-		  {
-			return (long) arr.get(doc);
-		  }
-
-		  public override double doubleVal(int doc)
-		  {
-			return (double) arr.get(doc);
-		  }
-
-		  public override string strVal(int doc)
-		  {
-			return Convert.ToString(arr.get(doc));
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.description() + '=' + byteVal(doc);
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return arr.get(doc); // TODO: valid?
-		  }
-
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (o.GetType() != typeof(ByteFieldSource))
-		{
-			return false;
-		}
-		ByteFieldSource other = (ByteFieldSource) o;
-		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = parser == null ? typeof(sbyte?).GetHashCode() : parser.GetType().GetHashCode();
-		h += base.GetHashCode();
-		return h;
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/BytesRefFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/BytesRefFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/BytesRefFieldSource.cs
deleted file mode 100644
index f091aee..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/BytesRefFieldSource.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-using System.Collections;
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using BinaryDocValues = org.apache.lucene.index.BinaryDocValues;
-	using FieldInfo = org.apache.lucene.index.FieldInfo;
-	using DocValuesType = org.apache.lucene.index.FieldInfo.DocValuesType;
-	using DocTermsIndexDocValues = org.apache.lucene.queries.function.docvalues.DocTermsIndexDocValues;
-	using FieldCache = org.apache.lucene.search.FieldCache;
-	using Bits = org.apache.lucene.util.Bits;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-
-	/// <summary>
-	/// An implementation for retrieving <seealso cref="FunctionValues"/> instances for string based fields.
-	/// </summary>
-	public class BytesRefFieldSource : FieldCacheSource
-	{
-
-	  public BytesRefFieldSource(string field) : base(field)
-	  {
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.FieldInfo fieldInfo = readerContext.reader().getFieldInfos().fieldInfo(field);
-		FieldInfo fieldInfo = readerContext.reader().FieldInfos.fieldInfo(field);
-		// To be sorted or not to be sorted, that is the question
-		// TODO: do it cleaner?
-		if (fieldInfo != null && fieldInfo.DocValuesType == FieldInfo.DocValuesType.BINARY)
-		{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.BinaryDocValues binaryValues = org.apache.lucene.search.FieldCache.DEFAULT.getTerms(readerContext.reader(), field, true);
-		  BinaryDocValues binaryValues = FieldCache.DEFAULT.getTerms(readerContext.reader(), field, true);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.Bits docsWithField = org.apache.lucene.search.FieldCache.DEFAULT.getDocsWithField(readerContext.reader(), field);
-		  Bits docsWithField = FieldCache.DEFAULT.getDocsWithField(readerContext.reader(), field);
-		  return new FunctionValuesAnonymousInnerClassHelper(this, binaryValues, docsWithField);
-		}
-		else
-		{
-		  return new DocTermsIndexDocValuesAnonymousInnerClassHelper(this, this, readerContext, field);
-		}
-	  }
-
-	  private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
-	  {
-		  private readonly BytesRefFieldSource outerInstance;
-
-		  private BinaryDocValues binaryValues;
-		  private Bits docsWithField;
-
-		  public FunctionValuesAnonymousInnerClassHelper(BytesRefFieldSource outerInstance, BinaryDocValues binaryValues, Bits docsWithField)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.binaryValues = binaryValues;
-			  this.docsWithField = docsWithField;
-		  }
-
-
-		  public override bool exists(int doc)
-		  {
-			return docsWithField.get(doc);
-		  }
-
-		  public override bool bytesVal(int doc, BytesRef target)
-		  {
-			binaryValues.get(doc, target);
-			return target.length > 0;
-		  }
-
-		  public override string strVal(int doc)
-		  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.BytesRef bytes = new org.apache.lucene.util.BytesRef();
-			BytesRef bytes = new BytesRef();
-			return bytesVal(doc, bytes) ? bytes.utf8ToString() : null;
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return strVal(doc);
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.description() + '=' + strVal(doc);
-		  }
-	  }
-
-	  private class DocTermsIndexDocValuesAnonymousInnerClassHelper : DocTermsIndexDocValues
-	  {
-		  private readonly BytesRefFieldSource outerInstance;
-
-		  public DocTermsIndexDocValuesAnonymousInnerClassHelper(BytesRefFieldSource outerInstance, org.apache.lucene.queries.function.valuesource.BytesRefFieldSource this, AtomicReaderContext readerContext, string field) : base(this, readerContext, field)
-		  {
-			  this.outerInstance = outerInstance;
-		  }
-
-
-		  protected internal override string toTerm(string readableValue)
-		  {
-			return readableValue;
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return strVal(doc);
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.description() + '=' + strVal(doc);
-		  }
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/ConstNumberSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/ConstNumberSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/ConstNumberSource.cs
deleted file mode 100644
index 33a0aa0..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/ConstNumberSource.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	/// <summary>
-	/// <code>ConstNumberSource</code> is the base class for all constant numbers
-	/// </summary>
-	public abstract class ConstNumberSource : ValueSource
-	{
-	  public abstract int Int {get;}
-	  public abstract long Long {get;}
-	  public abstract float Float {get;}
-	  public abstract double Double {get;}
-	  public abstract Number Number {get;}
-	  public abstract bool Bool {get;}
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/ConstValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/ConstValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/ConstValueSource.cs
deleted file mode 100644
index 9933f13..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/ConstValueSource.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using FloatDocValues = org.apache.lucene.queries.function.docvalues.FloatDocValues;
-
-
-	/// <summary>
-	/// <code>ConstValueSource</code> returns a constant for all documents
-	/// </summary>
-	public class ConstValueSource : ConstNumberSource
-	{
-	  internal readonly float constant;
-	  private readonly double dv;
-
-	  public ConstValueSource(float constant)
-	  {
-		this.constant = constant;
-		this.dv = constant;
-	  }
-
-	  public override string description()
-	  {
-		return "const(" + constant + ")";
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly ConstValueSource outerInstance;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(ConstValueSource outerInstance, org.apache.lucene.queries.function.valuesource.ConstValueSource this) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return outerInstance.constant;
-		  }
-		  public override int intVal(int doc)
-		  {
-			return (int)outerInstance.constant;
-		  }
-		  public override long longVal(int doc)
-		  {
-			return (long)outerInstance.constant;
-		  }
-		  public override double doubleVal(int doc)
-		  {
-			return outerInstance.dv;
-		  }
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.description();
-		  }
-		  public override object objectVal(int doc)
-		  {
-			return outerInstance.constant;
-		  }
-		  public override bool boolVal(int doc)
-		  {
-			return outerInstance.constant != 0.0f;
-		  }
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return float.floatToIntBits(constant) * 31;
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (!(o is ConstValueSource))
-		{
-			return false;
-		}
-		ConstValueSource other = (ConstValueSource)o;
-		return this.constant == other.constant;
-	  }
-
-	  public override int Int
-	  {
-		  get
-		  {
-			return (int)constant;
-		  }
-	  }
-
-	  public override long Long
-	  {
-		  get
-		  {
-			return (long)constant;
-		  }
-	  }
-
-	  public override float Float
-	  {
-		  get
-		  {
-			return constant;
-		  }
-	  }
-
-	  public override double Double
-	  {
-		  get
-		  {
-			return dv;
-		  }
-	  }
-
-	  public override Number Number
-	  {
-		  get
-		  {
-			return constant;
-		  }
-	  }
-
-	  public override bool Bool
-	  {
-		  get
-		  {
-			return constant != 0.0f;
-		  }
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/DefFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/DefFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/DefFunction.cs
deleted file mode 100644
index 48a67d4..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/DefFunction.cs
+++ /dev/null
@@ -1,153 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-
-
-	/// <summary>
-	/// <seealso cref="ValueSource"/> implementation which only returns the values from the provided
-	/// ValueSources which are available for a particular docId.  Consequently, when combined
-	/// with a <seealso cref="ConstValueSource"/>, this function serves as a way to return a default
-	/// value when the values for a field are unavailable.
-	/// </summary>
-	public class DefFunction : MultiFunction
-	{
-	  public DefFunction(IList<ValueSource> sources) : base(sources)
-	  {
-	  }
-
-	  protected internal override string name()
-	  {
-		return "def";
-	  }
-
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map fcontext, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary fcontext, AtomicReaderContext readerContext)
-	  {
-
-
-		return new ValuesAnonymousInnerClassHelper(this, valsArr(sources, fcontext, readerContext));
-	  }
-
-	  private class ValuesAnonymousInnerClassHelper : Values
-	  {
-		  private readonly DefFunction outerInstance;
-
-		  public ValuesAnonymousInnerClassHelper(DefFunction outerInstance, FunctionValues[] valsArr) : base(outerInstance, valsArr)
-		  {
-			  this.outerInstance = outerInstance;
-			  upto = valsArr.Length - 1;
-		  }
-
-		  internal readonly int upto;
-
-		  private FunctionValues get(int doc)
-		  {
-			for (int i = 0; i < upto; i++)
-			{
-			  FunctionValues vals = valsArr[i];
-			  if (vals.exists(doc))
-			  {
-				return vals;
-			  }
-			}
-			return valsArr[upto];
-		  }
-
-		  public override sbyte byteVal(int doc)
-		  {
-			return get(doc).byteVal(doc);
-		  }
-
-		  public override short shortVal(int doc)
-		  {
-			return get(doc).shortVal(doc);
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return get(doc).floatVal(doc);
-		  }
-
-		  public override int intVal(int doc)
-		  {
-			return get(doc).intVal(doc);
-		  }
-
-		  public override long longVal(int doc)
-		  {
-			return get(doc).longVal(doc);
-		  }
-
-		  public override double doubleVal(int doc)
-		  {
-			return get(doc).doubleVal(doc);
-		  }
-
-		  public override string strVal(int doc)
-		  {
-			return get(doc).strVal(doc);
-		  }
-
-		  public override bool boolVal(int doc)
-		  {
-			return get(doc).boolVal(doc);
-		  }
-
-		  public override bool bytesVal(int doc, BytesRef target)
-		  {
-			return get(doc).bytesVal(doc, target);
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return get(doc).objectVal(doc);
-		  }
-
-		  public override bool exists(int doc)
-		  {
-			// return true if any source is exists?
-			foreach (FunctionValues vals in valsArr)
-			{
-			  if (vals.exists(doc))
-			  {
-				return true;
-			  }
-			}
-			return false;
-		  }
-
-		  public override ValueFiller ValueFiller
-		  {
-			  get
-			  {
-				// TODO: need ValueSource.type() to determine correct type
-				return base.ValueFiller;
-			  }
-		  }
-	  }
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/DivFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/DivFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/DivFloatFunction.cs
deleted file mode 100644
index 08912e5..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/DivFloatFunction.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	/// <summary>
-	/// Function to divide "a" by "b"
-	/// </summary>
-	public class DivFloatFunction : DualFloatFunction
-	{
-	 /// <param name="a">  the numerator. </param>
-	 /// <param name="b">  the denominator. </param>
-	  public DivFloatFunction(ValueSource a, ValueSource b) : base(a,b)
-	  {
-	  }
-
-	  protected internal override string name()
-	  {
-		return "div";
-	  }
-
-	  protected internal override float func(int doc, FunctionValues aVals, FunctionValues bVals)
-	  {
-		return aVals.floatVal(doc) / bVals.floatVal(doc);
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/DocFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/DocFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/DocFreqValueSource.cs
deleted file mode 100644
index 56ea07d..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/DocFreqValueSource.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-using System;
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using Term = org.apache.lucene.index.Term;
-	using DoubleDocValues = org.apache.lucene.queries.function.docvalues.DoubleDocValues;
-	using IntDocValues = org.apache.lucene.queries.function.docvalues.IntDocValues;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-
-
-
-	internal class ConstIntDocValues : IntDocValues
-	{
-	  internal readonly int ival;
-	  internal readonly float fval;
-	  internal readonly double dval;
-	  internal readonly long lval;
-	  internal readonly string sval;
-	  internal readonly ValueSource parent;
-
-	  internal ConstIntDocValues(int val, ValueSource parent) : base(parent)
-	  {
-		ival = val;
-		fval = val;
-		dval = val;
-		lval = val;
-		sval = Convert.ToString(val);
-		this.parent = parent;
-	  }
-
-	  public override float floatVal(int doc)
-	  {
-		return fval;
-	  }
-	  public override int intVal(int doc)
-	  {
-		return ival;
-	  }
-	  public override long longVal(int doc)
-	  {
-		return lval;
-	  }
-	  public override double doubleVal(int doc)
-	  {
-		return dval;
-	  }
-	  public override string strVal(int doc)
-	  {
-		return sval;
-	  }
-	  public override string ToString(int doc)
-	  {
-		return parent.description() + '=' + sval;
-	  }
-	}
-
-	internal class ConstDoubleDocValues : DoubleDocValues
-	{
-	  internal readonly int ival;
-	  internal readonly float fval;
-	  internal readonly double dval;
-	  internal readonly long lval;
-	  internal readonly string sval;
-	  internal readonly ValueSource parent;
-
-	  internal ConstDoubleDocValues(double val, ValueSource parent) : base(parent)
-	  {
-		ival = (int)val;
-		fval = (float)val;
-		dval = val;
-		lval = (long)val;
-		sval = Convert.ToString(val);
-		this.parent = parent;
-	  }
-
-	  public override float floatVal(int doc)
-	  {
-		return fval;
-	  }
-	  public override int intVal(int doc)
-	  {
-		return ival;
-	  }
-	  public override long longVal(int doc)
-	  {
-		return lval;
-	  }
-	  public override double doubleVal(int doc)
-	  {
-		return dval;
-	  }
-	  public override string strVal(int doc)
-	  {
-		return sval;
-	  }
-	  public override string ToString(int doc)
-	  {
-		return parent.description() + '=' + sval;
-	  }
-	}
-
-
-	/// <summary>
-	/// <code>DocFreqValueSource</code> returns the number of documents containing the term.
-	/// @lucene.internal
-	/// </summary>
-	public class DocFreqValueSource : ValueSource
-	{
-	  protected internal readonly string field;
-	  protected internal readonly string indexedField;
-	  protected internal readonly string val;
-	  protected internal readonly BytesRef indexedBytes;
-
-	  public DocFreqValueSource(string field, string val, string indexedField, BytesRef indexedBytes)
-	  {
-		this.field = field;
-		this.val = val;
-		this.indexedField = indexedField;
-		this.indexedBytes = indexedBytes;
-	  }
-
-	  public virtual string name()
-	  {
-		return "docfreq";
-	  }
-
-	  public override string description()
-	  {
-		return name() + '(' + field + ',' + val + ')';
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		IndexSearcher searcher = (IndexSearcher)context["searcher"];
-		int docfreq = searcher.IndexReader.docFreq(new Term(indexedField, indexedBytes));
-		return new ConstIntDocValues(docfreq, this);
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		context["searcher"] = searcher;
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return this.GetType().GetHashCode() + indexedField.GetHashCode() * 29 + indexedBytes.GetHashCode();
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		DocFreqValueSource other = (DocFreqValueSource)o;
-		return this.indexedField.Equals(other.indexedField) && this.indexedBytes.Equals(other.indexedBytes);
-	  }
-	}
-
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/DoubleConstValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/DoubleConstValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/DoubleConstValueSource.cs
deleted file mode 100644
index e21be0c..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/DoubleConstValueSource.cs
+++ /dev/null
@@ -1,166 +0,0 @@
-using System;
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using DoubleDocValues = org.apache.lucene.queries.function.docvalues.DoubleDocValues;
-
-
-	/// <summary>
-	/// Function that returns a constant double value for every document.
-	/// </summary>
-	public class DoubleConstValueSource : ConstNumberSource
-	{
-	  internal readonly double constant;
-	  private readonly float fv;
-	  private readonly long lv;
-
-	  public DoubleConstValueSource(double constant)
-	  {
-		this.constant = constant;
-		this.fv = (float)constant;
-		this.lv = (long)constant;
-	  }
-
-	  public override string description()
-	  {
-		return "const(" + constant + ")";
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		return new DoubleDocValuesAnonymousInnerClassHelper(this, this);
-	  }
-
-	  private class DoubleDocValuesAnonymousInnerClassHelper : DoubleDocValues
-	  {
-		  private readonly DoubleConstValueSource outerInstance;
-
-		  public DoubleDocValuesAnonymousInnerClassHelper(DoubleConstValueSource outerInstance, org.apache.lucene.queries.function.valuesource.DoubleConstValueSource this) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return outerInstance.fv;
-		  }
-
-		  public override int intVal(int doc)
-		  {
-			return (int) outerInstance.lv;
-		  }
-
-		  public override long longVal(int doc)
-		  {
-			return outerInstance.lv;
-		  }
-
-		  public override double doubleVal(int doc)
-		  {
-			return outerInstance.constant;
-		  }
-
-		  public override string strVal(int doc)
-		  {
-			return Convert.ToString(outerInstance.constant);
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return outerInstance.constant;
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.description();
-		  }
-	  }
-
-	  public override int GetHashCode()
-	  {
-		long bits = double.doubleToRawLongBits(constant);
-		return (int)(bits ^ ((long)((ulong)bits >> 32)));
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (!(o is DoubleConstValueSource))
-		{
-			return false;
-		}
-		DoubleConstValueSource other = (DoubleConstValueSource) o;
-		return this.constant == other.constant;
-	  }
-
-	  public override int Int
-	  {
-		  get
-		  {
-			return (int)lv;
-		  }
-	  }
-
-	  public override long Long
-	  {
-		  get
-		  {
-			return lv;
-		  }
-	  }
-
-	  public override float Float
-	  {
-		  get
-		  {
-			return fv;
-		  }
-	  }
-
-	  public override double Double
-	  {
-		  get
-		  {
-			return constant;
-		  }
-	  }
-
-	  public override Number Number
-	  {
-		  get
-		  {
-			return constant;
-		  }
-	  }
-
-	  public override bool Bool
-	  {
-		  get
-		  {
-			return constant != 0;
-		  }
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/DoubleFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/DoubleFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/DoubleFieldSource.cs
deleted file mode 100644
index 188974f..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/DoubleFieldSource.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using DoubleDocValues = org.apache.lucene.queries.function.docvalues.DoubleDocValues;
-	using FieldCache = org.apache.lucene.search.FieldCache;
-	using Bits = org.apache.lucene.util.Bits;
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueDouble = org.apache.lucene.util.mutable.MutableValueDouble;
-
-	/// <summary>
-	/// Obtains double field values from <seealso cref="FieldCache#getDoubles"/> and makes
-	/// those values available as other numeric types, casting as needed.
-	/// </summary>
-	public class DoubleFieldSource : FieldCacheSource
-	{
-
-	  protected internal readonly FieldCache.DoubleParser parser;
-
-	  public DoubleFieldSource(string field) : this(field, null)
-	  {
-	  }
-
-	  public DoubleFieldSource(string field, FieldCache.DoubleParser parser) : base(field)
-	  {
-		this.parser = parser;
-	  }
-
-	  public override string description()
-	  {
-		return "double(" + field + ')';
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Doubles arr = cache.getDoubles(readerContext.reader(), field, parser, true);
-		FieldCache.Doubles arr = cache.getDoubles(readerContext.reader(), field, parser, true);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.Bits valid = cache.getDocsWithField(readerContext.reader(), field);
-		Bits valid = cache.getDocsWithField(readerContext.reader(), field);
-		return new DoubleDocValuesAnonymousInnerClassHelper(this, this, arr, valid);
-
-	  }
-
-	  private class DoubleDocValuesAnonymousInnerClassHelper : DoubleDocValues
-	  {
-		  private readonly DoubleFieldSource outerInstance;
-
-		  private FieldCache.Doubles arr;
-		  private Bits valid;
-
-		  public DoubleDocValuesAnonymousInnerClassHelper(DoubleFieldSource outerInstance, org.apache.lucene.queries.function.valuesource.DoubleFieldSource this, FieldCache.Doubles arr, Bits valid) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.arr = arr;
-			  this.valid = valid;
-		  }
-
-		  public override double doubleVal(int doc)
-		  {
-			return arr.get(doc);
-		  }
-
-		  public override bool exists(int doc)
-		  {
-			return arr.get(doc) != 0 || valid.get(doc);
-		  }
-
-		  public override ValueFiller ValueFiller
-		  {
-			  get
-			  {
-				return new ValueFillerAnonymousInnerClassHelper(this);
-			  }
-		  }
-
-		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-		  {
-			  private readonly DoubleDocValuesAnonymousInnerClassHelper outerInstance;
-
-			  public ValueFillerAnonymousInnerClassHelper(DoubleDocValuesAnonymousInnerClassHelper outerInstance)
-			  {
-				  this.outerInstance = outerInstance;
-				  mval = new MutableValueDouble();
-			  }
-
-			  private readonly MutableValueDouble mval;
-
-			  public override MutableValue Value
-			  {
-				  get
-				  {
-					return mval;
-				  }
-			  }
-
-			  public override void fillValue(int doc)
-			  {
-				mval.value = outerInstance.arr.get(doc);
-				mval.exists = mval.value != 0 || outerInstance.valid.get(doc);
-			  }
-		  }
-
-
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (o.GetType() != typeof(DoubleFieldSource))
-		{
-			return false;
-		}
-		DoubleFieldSource other = (DoubleFieldSource) o;
-		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = parser == null ? typeof(double?).GetHashCode() : parser.GetType().GetHashCode();
-		h += base.GetHashCode();
-		return h;
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/DualFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/DualFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/DualFloatFunction.cs
deleted file mode 100644
index 9a9c069..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/DualFloatFunction.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using FloatDocValues = org.apache.lucene.queries.function.docvalues.FloatDocValues;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-
-
-	/// <summary>
-	/// Abstract <seealso cref="ValueSource"/> implementation which wraps two ValueSources
-	/// and applies an extendible float function to their values.
-	/// 
-	/// </summary>
-	public abstract class DualFloatFunction : ValueSource
-	{
-	  protected internal readonly ValueSource a;
-	  protected internal readonly ValueSource b;
-
-	 /// <param name="a">  the base. </param>
-	 /// <param name="b">  the exponent. </param>
-	  public DualFloatFunction(ValueSource a, ValueSource b)
-	  {
-		this.a = a;
-		this.b = b;
-	  }
-
-	  protected internal abstract string name();
-	  protected internal abstract float func(int doc, FunctionValues aVals, FunctionValues bVals);
-
-	  public override string description()
-	  {
-		return name() + "(" + a.description() + "," + b.description() + ")";
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues aVals = a.getValues(context, readerContext);
-		FunctionValues aVals = a.getValues(context, readerContext);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues bVals = b.getValues(context, readerContext);
-		FunctionValues bVals = b.getValues(context, readerContext);
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, aVals, bVals);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly DualFloatFunction outerInstance;
-
-		  private FunctionValues aVals;
-		  private FunctionValues bVals;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(DualFloatFunction outerInstance, org.apache.lucene.queries.function.valuesource.DualFloatFunction this, FunctionValues aVals, FunctionValues bVals) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.aVals = aVals;
-			  this.bVals = bVals;
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return outerInstance.func(doc, aVals, bVals);
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.name() + '(' + aVals.ToString(doc) + ',' + bVals.ToString(doc) + ')';
-		  }
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		a.createWeight(context,searcher);
-		b.createWeight(context,searcher);
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = a.GetHashCode();
-		h ^= (h << 13) | ((int)((uint)h >> 20));
-		h += b.GetHashCode();
-		h ^= (h << 23) | ((int)((uint)h >> 10));
-		h += name().GetHashCode();
-		return h;
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		DualFloatFunction other = (DualFloatFunction)o;
-		return this.a.Equals(other.a) && this.b.Equals(other.b);
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/EnumFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/EnumFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/EnumFieldSource.cs
deleted file mode 100644
index cbdf2cb..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/EnumFieldSource.cs
+++ /dev/null
@@ -1,343 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using IntDocValues = org.apache.lucene.queries.function.docvalues.IntDocValues;
-	using FieldCache = org.apache.lucene.search.FieldCache;
-	using Bits = org.apache.lucene.util.Bits;
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueInt = org.apache.lucene.util.mutable.MutableValueInt;
-
-	/// <summary>
-	/// Obtains int field values from <seealso cref="FieldCache#getInts"/> and makes
-	/// those values available as other numeric types, casting as needed.
-	/// strVal of the value is not the int value, but its string (displayed) value
-	/// </summary>
-	public class EnumFieldSource : FieldCacheSource
-	{
-	  internal const int? DEFAULT_VALUE = -1;
-
-	  internal readonly FieldCache.IntParser parser;
-	  internal readonly IDictionary<int?, string> enumIntToStringMap;
-	  internal readonly IDictionary<string, int?> enumStringToIntMap;
-
-	  public EnumFieldSource(string field, FieldCache.IntParser parser, IDictionary<int?, string> enumIntToStringMap, IDictionary<string, int?> enumStringToIntMap) : base(field)
-	  {
-		this.parser = parser;
-		this.enumIntToStringMap = enumIntToStringMap;
-		this.enumStringToIntMap = enumStringToIntMap;
-	  }
-
-	  private static int? tryParseInt(string valueStr)
-	  {
-		int? intValue = null;
-		try
-		{
-		  intValue = Convert.ToInt32(valueStr);
-		}
-		catch (NumberFormatException)
-		{
-		}
-		return intValue;
-	  }
-
-	  private string intValueToStringValue(int? intVal)
-	  {
-		if (intVal == null)
-		{
-		  return null;
-		}
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final String enumString = enumIntToStringMap.get(intVal);
-		string enumString = enumIntToStringMap[intVal];
-		if (enumString != null)
-		{
-		  return enumString;
-		}
-		// can't find matching enum name - return DEFAULT_VALUE.toString()
-		return DEFAULT_VALUE.ToString();
-	  }
-
-	  private int? stringValueToIntValue(string stringVal)
-	  {
-		if (stringVal == null)
-		{
-		  return null;
-		}
-
-		int? intValue;
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final Integer enumInt = enumStringToIntMap.get(stringVal);
-		int? enumInt = enumStringToIntMap[stringVal];
-		if (enumInt != null) //enum int found for string
-		{
-		  return enumInt;
-		}
-
-		//enum int not found for string
-		intValue = tryParseInt(stringVal);
-		if (intValue == null) //not Integer
-		{
-		  intValue = DEFAULT_VALUE;
-		}
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final String enumString = enumIntToStringMap.get(intValue);
-		string enumString = enumIntToStringMap[intValue];
-		if (enumString != null) //has matching string
-		{
-		  return intValue;
-		}
-
-		return DEFAULT_VALUE;
-	  }
-
-	  public override string description()
-	  {
-		return "enum(" + field + ')';
-	  }
-
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Ints arr = cache.getInts(readerContext.reader(), field, parser, true);
-		FieldCache.Ints arr = cache.getInts(readerContext.reader(), field, parser, true);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.Bits valid = cache.getDocsWithField(readerContext.reader(), field);
-		Bits valid = cache.getDocsWithField(readerContext.reader(), field);
-
-		return new IntDocValuesAnonymousInnerClassHelper(this, this, arr, valid);
-	  }
-
-	  private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
-	  {
-		  private readonly EnumFieldSource outerInstance;
-
-		  private FieldCache.Ints arr;
-		  private Bits valid;
-
-		  public IntDocValuesAnonymousInnerClassHelper(EnumFieldSource outerInstance, org.apache.lucene.queries.function.valuesource.EnumFieldSource this, FieldCache.Ints arr, Bits valid) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.arr = arr;
-			  this.valid = valid;
-			  val = new MutableValueInt();
-		  }
-
-		  internal readonly MutableValueInt val;
-
-		  public override float floatVal(int doc)
-		  {
-			return (float) arr.get(doc);
-		  }
-
-		  public override int intVal(int doc)
-		  {
-			return arr.get(doc);
-		  }
-
-		  public override long longVal(int doc)
-		  {
-			return (long) arr.get(doc);
-		  }
-
-		  public override double doubleVal(int doc)
-		  {
-			return (double) arr.get(doc);
-		  }
-
-		  public override string strVal(int doc)
-		  {
-			int? intValue = arr.get(doc);
-			return outerInstance.intValueToStringValue(intValue);
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return valid.get(doc) ? arr.get(doc) : null;
-		  }
-
-		  public override bool exists(int doc)
-		  {
-			return valid.get(doc);
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.description() + '=' + strVal(doc);
-		  }
-
-
-		  public override ValueSourceScorer getRangeScorer(IndexReader reader, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
-		  {
-			int? lower = outerInstance.stringValueToIntValue(lowerVal);
-			int? upper = outerInstance.stringValueToIntValue(upperVal);
-
-			// instead of using separate comparison functions, adjust the endpoints.
-
-			if (lower == null)
-			{
-			  lower = int.MinValue;
-			}
-			else
-			{
-			  if (!includeLower && lower < int.MaxValue)
-			  {
-				  lower++;
-			  }
-			}
-
-			if (upper == null)
-			{
-			  upper = int.MaxValue;
-			}
-			else
-			{
-			  if (!includeUpper && upper > int.MinValue)
-			  {
-				  upper--;
-			  }
-			}
-
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int ll = lower;
-			int ll = lower.Value;
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int uu = upper;
-			int uu = upper.Value;
-
-			return new ValueSourceScorerAnonymousInnerClassHelper(this, reader, this, ll, uu);
-		  }
-
-		  private class ValueSourceScorerAnonymousInnerClassHelper : ValueSourceScorer
-		  {
-			  private readonly IntDocValuesAnonymousInnerClassHelper outerInstance;
-
-			  private int ll;
-			  private int uu;
-
-			  public ValueSourceScorerAnonymousInnerClassHelper(IntDocValuesAnonymousInnerClassHelper outerInstance, IndexReader reader, org.apache.lucene.queries.function.valuesource.EnumFieldSource this, int ll, int uu) : base(reader, this)
-			  {
-				  this.outerInstance = outerInstance;
-				  this.ll = ll;
-				  this.uu = uu;
-			  }
-
-			  public override bool matchesValue(int doc)
-			  {
-				int val = outerInstance.arr.get(doc);
-				// only check for deleted if it's the default value
-				// if (val==0 && reader.isDeleted(doc)) return false;
-				return val >= ll && val <= uu;
-			  }
-		  }
-
-		  public override ValueFiller ValueFiller
-		  {
-			  get
-			  {
-				return new ValueFillerAnonymousInnerClassHelper(this);
-			  }
-		  }
-
-		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-		  {
-			  private readonly IntDocValuesAnonymousInnerClassHelper outerInstance;
-
-			  public ValueFillerAnonymousInnerClassHelper(IntDocValuesAnonymousInnerClassHelper outerInstance)
-			  {
-				  this.outerInstance = outerInstance;
-				  mval = new MutableValueInt();
-			  }
-
-			  private readonly MutableValueInt mval;
-
-			  public override MutableValue Value
-			  {
-				  get
-				  {
-					return mval;
-				  }
-			  }
-
-			  public override void fillValue(int doc)
-			  {
-				mval.value = outerInstance.arr.get(doc);
-				mval.exists = outerInstance.valid.get(doc);
-			  }
-		  }
-
-
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (this == o)
-		{
-			return true;
-		}
-		if (o == null || this.GetType() != o.GetType())
-		{
-			return false;
-		}
-		if (!base.Equals(o))
-		{
-			return false;
-		}
-
-		EnumFieldSource that = (EnumFieldSource) o;
-
-		if (!enumIntToStringMap.Equals(that.enumIntToStringMap))
-		{
-			return false;
-		}
-		if (!enumStringToIntMap.Equals(that.enumStringToIntMap))
-		{
-			return false;
-		}
-		if (!parser.Equals(that.parser))
-		{
-			return false;
-		}
-
-		return true;
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int result = base.GetHashCode();
-		result = 31 * result + parser.GetHashCode();
-		result = 31 * result + enumIntToStringMap.GetHashCode();
-		result = 31 * result + enumStringToIntMap.GetHashCode();
-		return result;
-	  }
-	}
-
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/FieldCacheSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/FieldCacheSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/FieldCacheSource.cs
deleted file mode 100644
index 92c2cb4..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/FieldCacheSource.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using FieldCache = org.apache.lucene.search.FieldCache;
-
-	/// <summary>
-	/// A base class for ValueSource implementations that retrieve values for
-	/// a single field from the <seealso cref="org.apache.lucene.search.FieldCache"/>.
-	/// 
-	/// 
-	/// </summary>
-	public abstract class FieldCacheSource : ValueSource
-	{
-	  protected internal readonly string field;
-	  protected internal readonly FieldCache cache = FieldCache.DEFAULT;
-
-	  public FieldCacheSource(string field)
-	  {
-		this.field = field;
-	  }
-
-	  public virtual FieldCache FieldCache
-	  {
-		  get
-		  {
-			return cache;
-		  }
-	  }
-
-	  public virtual string Field
-	  {
-		  get
-		  {
-			return field;
-		  }
-	  }
-
-	  public override string description()
-	  {
-		return field;
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (!(o is FieldCacheSource))
-		{
-			return false;
-		}
-		FieldCacheSource other = (FieldCacheSource)o;
-		return this.field.Equals(other.field) && this.cache == other.cache;
-	  }
-
-	  public override int GetHashCode()
-	  {
-		return cache.GetHashCode() + field.GetHashCode();
-	  }
-
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/FloatFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/FloatFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/FloatFieldSource.cs
deleted file mode 100644
index c60d99f..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/FloatFieldSource.cs
+++ /dev/null
@@ -1,152 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using FloatDocValues = org.apache.lucene.queries.function.docvalues.FloatDocValues;
-	using FieldCache = org.apache.lucene.search.FieldCache;
-	using Bits = org.apache.lucene.util.Bits;
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueFloat = org.apache.lucene.util.mutable.MutableValueFloat;
-
-	/// <summary>
-	/// Obtains float field values from <seealso cref="FieldCache#getFloats"/> and makes those
-	/// values available as other numeric types, casting as needed.
-	/// </summary>
-	public class FloatFieldSource : FieldCacheSource
-	{
-
-	  protected internal readonly FieldCache.FloatParser parser;
-
-	  public FloatFieldSource(string field) : this(field, null)
-	  {
-	  }
-
-	  public FloatFieldSource(string field, FieldCache.FloatParser parser) : base(field)
-	  {
-		this.parser = parser;
-	  }
-
-	  public override string description()
-	  {
-		return "float(" + field + ')';
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Floats arr = cache.getFloats(readerContext.reader(), field, parser, true);
-		FieldCache.Floats arr = cache.getFloats(readerContext.reader(), field, parser, true);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.Bits valid = cache.getDocsWithField(readerContext.reader(), field);
-		Bits valid = cache.getDocsWithField(readerContext.reader(), field);
-
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, arr, valid);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly FloatFieldSource outerInstance;
-
-		  private FieldCache.Floats arr;
-		  private Bits valid;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(FloatFieldSource outerInstance, org.apache.lucene.queries.function.valuesource.FloatFieldSource this, FieldCache.Floats arr, Bits valid) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.arr = arr;
-			  this.valid = valid;
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return arr.get(doc);
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return valid.get(doc) ? arr.get(doc) : null;
-		  }
-
-		  public override bool exists(int doc)
-		  {
-			return arr.get(doc) != 0 || valid.get(doc);
-		  }
-
-		  public override ValueFiller ValueFiller
-		  {
-			  get
-			  {
-				return new ValueFillerAnonymousInnerClassHelper(this);
-			  }
-		  }
-
-		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-		  {
-			  private readonly FloatDocValuesAnonymousInnerClassHelper outerInstance;
-
-			  public ValueFillerAnonymousInnerClassHelper(FloatDocValuesAnonymousInnerClassHelper outerInstance)
-			  {
-				  this.outerInstance = outerInstance;
-				  mval = new MutableValueFloat();
-			  }
-
-			  private readonly MutableValueFloat mval;
-
-			  public override MutableValue Value
-			  {
-				  get
-				  {
-					return mval;
-				  }
-			  }
-
-			  public override void fillValue(int doc)
-			  {
-				mval.value = outerInstance.arr.get(doc);
-				mval.exists = mval.value != 0 || outerInstance.valid.get(doc);
-			  }
-		  }
-
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (o.GetType() != typeof(FloatFieldSource))
-		{
-			return false;
-		}
-		FloatFieldSource other = (FloatFieldSource)o;
-		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = parser == null ? typeof(float?).GetHashCode() : parser.GetType().GetHashCode();
-		h += base.GetHashCode();
-		return h;
-	  }
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/IDFValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/IDFValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/IDFValueSource.cs
deleted file mode 100644
index 13456ff..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/IDFValueSource.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using org.apache.lucene.index;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-	using PerFieldSimilarityWrapper = org.apache.lucene.search.similarities.PerFieldSimilarityWrapper;
-	using Similarity = org.apache.lucene.search.similarities.Similarity;
-	using TFIDFSimilarity = org.apache.lucene.search.similarities.TFIDFSimilarity;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-
-
-	/// <summary>
-	/// Function that returns <seealso cref="TFIDFSimilarity #idf(long, long)"/>
-	/// for every document.
-	/// <para>
-	/// Note that the configured Similarity for the field must be
-	/// a subclass of <seealso cref="TFIDFSimilarity"/>
-	/// @lucene.internal 
-	/// </para>
-	/// </summary>
-	public class IDFValueSource : DocFreqValueSource
-	{
-	  public IDFValueSource(string field, string val, string indexedField, BytesRef indexedBytes) : base(field, val, indexedField, indexedBytes)
-	  {
-	  }
-
-	  public override string name()
-	  {
-		return "idf";
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		IndexSearcher searcher = (IndexSearcher)context["searcher"];
-		TFIDFSimilarity sim = asTFIDF(searcher.Similarity, field);
-		if (sim == null)
-		{
-		  throw new System.NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)");
-		}
-		int docfreq = searcher.IndexReader.docFreq(new Term(indexedField, indexedBytes));
-		float idf = sim.idf(docfreq, searcher.IndexReader.maxDoc());
-		return new ConstDoubleDocValues(idf, this);
-	  }
-
-	  // tries extra hard to cast the sim to TFIDFSimilarity
-	  internal static TFIDFSimilarity asTFIDF(Similarity sim, string field)
-	  {
-		while (sim is PerFieldSimilarityWrapper)
-		{
-		  sim = ((PerFieldSimilarityWrapper)sim).get(field);
-		}
-		if (sim is TFIDFSimilarity)
-		{
-		  return (TFIDFSimilarity)sim;
-		}
-		else
-		{
-		  return null;
-		}
-	  }
-	}
-
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/IfFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/IfFunction.cs b/src/Lucene.Net.Queries/Function/ValueSource/IfFunction.cs
deleted file mode 100644
index a62c801..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/IfFunction.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using Explanation = org.apache.lucene.search.Explanation;
-	using IndexSearcher = org.apache.lucene.search.IndexSearcher;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-
-
-
-	/// <summary>
-	/// Depending on the boolean value of the <code>ifSource</code> function,
-	/// returns the value of the <code>trueSource</code> or <code>falseSource</code> function.
-	/// </summary>
-	public class IfFunction : BoolFunction
-	{
-	  private readonly ValueSource ifSource;
-	  private readonly ValueSource trueSource;
-	  private readonly ValueSource falseSource;
-
-
-	  public IfFunction(ValueSource ifSource, ValueSource trueSource, ValueSource falseSource)
-	  {
-		this.ifSource = ifSource;
-		this.trueSource = trueSource;
-		this.falseSource = falseSource;
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues ifVals = ifSource.getValues(context, readerContext);
-		FunctionValues ifVals = ifSource.getValues(context, readerContext);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues trueVals = trueSource.getValues(context, readerContext);
-		FunctionValues trueVals = trueSource.getValues(context, readerContext);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues falseVals = falseSource.getValues(context, readerContext);
-		FunctionValues falseVals = falseSource.getValues(context, readerContext);
-
-		return new FunctionValuesAnonymousInnerClassHelper(this, ifVals, trueVals, falseVals);
-
-	  }
-
-	  private class FunctionValuesAnonymousInnerClassHelper : FunctionValues
-	  {
-		  private readonly IfFunction outerInstance;
-
-		  private FunctionValues ifVals;
-		  private FunctionValues trueVals;
-		  private FunctionValues falseVals;
-
-		  public FunctionValuesAnonymousInnerClassHelper(IfFunction outerInstance, FunctionValues ifVals, FunctionValues trueVals, FunctionValues falseVals)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.ifVals = ifVals;
-			  this.trueVals = trueVals;
-			  this.falseVals = falseVals;
-		  }
-
-		  public override sbyte byteVal(int doc)
-		  {
-			return ifVals.boolVal(doc) ? trueVals.byteVal(doc) : falseVals.byteVal(doc);
-		  }
-
-		  public override short shortVal(int doc)
-		  {
-			return ifVals.boolVal(doc) ? trueVals.shortVal(doc) : falseVals.shortVal(doc);
-		  }
-
-		  public override float floatVal(int doc)
-		  {
-			return ifVals.boolVal(doc) ? trueVals.floatVal(doc) : falseVals.floatVal(doc);
-		  }
-
-		  public override int intVal(int doc)
-		  {
-			return ifVals.boolVal(doc) ? trueVals.intVal(doc) : falseVals.intVal(doc);
-		  }
-
-		  public override long longVal(int doc)
-		  {
-			return ifVals.boolVal(doc) ? trueVals.longVal(doc) : falseVals.longVal(doc);
-		  }
-
-		  public override double doubleVal(int doc)
-		  {
-			return ifVals.boolVal(doc) ? trueVals.doubleVal(doc) : falseVals.doubleVal(doc);
-		  }
-
-		  public override string strVal(int doc)
-		  {
-			return ifVals.boolVal(doc) ? trueVals.strVal(doc) : falseVals.strVal(doc);
-		  }
-
-		  public override bool boolVal(int doc)
-		  {
-			return ifVals.boolVal(doc) ? trueVals.boolVal(doc) : falseVals.boolVal(doc);
-		  }
-
-		  public override bool bytesVal(int doc, BytesRef target)
-		  {
-			return ifVals.boolVal(doc) ? trueVals.bytesVal(doc, target) : falseVals.bytesVal(doc, target);
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return ifVals.boolVal(doc) ? trueVals.objectVal(doc) : falseVals.objectVal(doc);
-		  }
-
-		  public override bool exists(int doc)
-		  {
-			return true; // TODO: flow through to any sub-sources?
-		  }
-
-		  public override ValueFiller ValueFiller
-		  {
-			  get
-			  {
-				// TODO: we need types of trueSource / falseSource to handle this
-				// for now, use float.
-				return base.ValueFiller;
-			  }
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return "if(" + ifVals.ToString(doc) + ',' + trueVals.ToString(doc) + ',' + falseVals.ToString(doc) + ')';
-		  }
-	  }
-
-	  public override string description()
-	  {
-		return "if(" + ifSource.description() + ',' + trueSource.description() + ',' + falseSource + ')';
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = ifSource.GetHashCode();
-		h = h * 31 + trueSource.GetHashCode();
-		h = h * 31 + falseSource.GetHashCode();
-		return h;
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (!(o is IfFunction))
-		{
-			return false;
-		}
-		IfFunction other = (IfFunction)o;
-		return ifSource.Equals(other.ifSource) && trueSource.Equals(other.trueSource) && falseSource.Equals(other.falseSource);
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		ifSource.createWeight(context, searcher);
-		trueSource.createWeight(context, searcher);
-		falseSource.createWeight(context, searcher);
-	  }
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b55e53c/src/Lucene.Net.Queries/Function/ValueSource/IntFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource/IntFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSource/IntFieldSource.cs
deleted file mode 100644
index bb6cf35..0000000
--- a/src/Lucene.Net.Queries/Function/ValueSource/IntFieldSource.cs
+++ /dev/null
@@ -1,183 +0,0 @@
-using System;
-using System.Collections;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace org.apache.lucene.queries.function.valuesource
-{
-
-
-	using AtomicReaderContext = org.apache.lucene.index.AtomicReaderContext;
-	using IndexReader = org.apache.lucene.index.IndexReader;
-	using IntDocValues = org.apache.lucene.queries.function.docvalues.IntDocValues;
-	using FieldCache = org.apache.lucene.search.FieldCache;
-	using Bits = org.apache.lucene.util.Bits;
-	using MutableValue = org.apache.lucene.util.mutable.MutableValue;
-	using MutableValueInt = org.apache.lucene.util.mutable.MutableValueInt;
-
-	/// <summary>
-	/// Obtains int field values from <seealso cref="FieldCache#getInts"/> and makes those
-	/// values available as other numeric types, casting as needed.
-	/// </summary>
-	public class IntFieldSource : FieldCacheSource
-	{
-	  internal readonly FieldCache.IntParser parser;
-
-	  public IntFieldSource(string field) : this(field, null)
-	  {
-	  }
-
-	  public IntFieldSource(string field, FieldCache.IntParser parser) : base(field)
-	  {
-		this.parser = parser;
-	  }
-
-	  public override string description()
-	  {
-		return "int(" + field + ')';
-	  }
-
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Ints arr = cache.getInts(readerContext.reader(), field, parser, true);
-		FieldCache.Ints arr = cache.getInts(readerContext.reader(), field, parser, true);
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.Bits valid = cache.getDocsWithField(readerContext.reader(), field);
-		Bits valid = cache.getDocsWithField(readerContext.reader(), field);
-
-		return new IntDocValuesAnonymousInnerClassHelper(this, this, arr, valid);
-	  }
-
-	  private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
-	  {
-		  private readonly IntFieldSource outerInstance;
-
-		  private FieldCache.Ints arr;
-		  private Bits valid;
-
-		  public IntDocValuesAnonymousInnerClassHelper(IntFieldSource outerInstance, org.apache.lucene.queries.function.valuesource.IntFieldSource this, FieldCache.Ints arr, Bits valid) : base(this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.arr = arr;
-			  this.valid = valid;
-			  val = new MutableValueInt();
-		  }
-
-		  internal readonly MutableValueInt val;
-
-		  public override float floatVal(int doc)
-		  {
-			return (float)arr.get(doc);
-		  }
-
-		  public override int intVal(int doc)
-		  {
-			return arr.get(doc);
-		  }
-
-		  public override long longVal(int doc)
-		  {
-			return (long)arr.get(doc);
-		  }
-
-		  public override double doubleVal(int doc)
-		  {
-			return (double)arr.get(doc);
-		  }
-
-		  public override string strVal(int doc)
-		  {
-			return Convert.ToString(arr.get(doc));
-		  }
-
-		  public override object objectVal(int doc)
-		  {
-			return valid.get(doc) ? arr.get(doc) : null;
-		  }
-
-		  public override bool exists(int doc)
-		  {
-			return arr.get(doc) != 0 || valid.get(doc);
-		  }
-
-		  public override string ToString(int doc)
-		  {
-			return outerInstance.description() + '=' + intVal(doc);
-		  }
-
-		  public override ValueFiller ValueFiller
-		  {
-			  get
-			  {
-				return new ValueFillerAnonymousInnerClassHelper(this);
-			  }
-		  }
-
-		  private class ValueFillerAnonymousInnerClassHelper : ValueFiller
-		  {
-			  private readonly IntDocValuesAnonymousInnerClassHelper outerInstance;
-
-			  public ValueFillerAnonymousInnerClassHelper(IntDocValuesAnonymousInnerClassHelper outerInstance)
-			  {
-				  this.outerInstance = outerInstance;
-				  mval = new MutableValueInt();
-			  }
-
-			  private readonly MutableValueInt mval;
-
-			  public override MutableValue Value
-			  {
-				  get
-				  {
-					return mval;
-				  }
-			  }
-
-			  public override void fillValue(int doc)
-			  {
-				mval.value = outerInstance.arr.get(doc);
-				mval.exists = mval.value != 0 || outerInstance.valid.get(doc);
-			  }
-		  }
-
-
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		if (o.GetType() != typeof(IntFieldSource))
-		{
-			return false;
-		}
-		IntFieldSource other = (IntFieldSource)o;
-		return base.Equals(other) && (this.parser == null ? other.parser == null : this.parser.GetType() == other.parser.GetType());
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = parser == null ? typeof(int?).GetHashCode() : parser.GetType().GetHashCode();
-		h += base.GetHashCode();
-		return h;
-	  }
-	}
-
-}
\ No newline at end of file


[15/21] More work on Lucene.Net.Queries

Posted by sy...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs
index 2b2f15c..95bd2d2 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs
@@ -16,9 +16,9 @@
  */
 using System.Collections;
 using System.Collections.Generic;
+using Lucene.Net.Index;
+using Lucene.Net.Queries.Function.DocValues;
 using Lucene.Net.Support;
-using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -48,12 +48,12 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		this.max = max;
 	  }
 
-	  public override string description()
-	  {
-		return "scale(" + source.description() + "," + min + "," + max + ")";
-	  }
+        public override string Description
+        {
+            get { return "scale(" + source.Description() + "," + min + "," + max + ")"; }
+        }
 
-	  private class ScaleInfo
+        private class ScaleInfo
 	  {
 		internal float minVal;
 		internal float maxVal;
@@ -61,11 +61,11 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: private ScaleInfo createScaleInfo(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  private ScaleInfo createScaleInfo(IDictionary context, AtomicReaderContext readerContext)
+	  private ScaleInfo CreateScaleInfo(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final java.util.List<org.apache.lucene.index.AtomicReaderContext> leaves = org.apache.lucene.index.ReaderUtil.getTopLevelContext(readerContext).leaves();
-		IList<AtomicReaderContext> leaves = ReaderUtil.getTopLevelContext(readerContext).leaves();
+		IList<AtomicReaderContext> leaves = ReaderUtil.GetTopLevelContext(readerContext).leaves();
 
 		float minVal = float.PositiveInfinity;
 		float maxVal = float.NegativeInfinity;
@@ -73,11 +73,11 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		foreach (AtomicReaderContext leaf in leaves)
 		{
 		  int maxDoc = leaf.reader().maxDoc();
-		  FunctionValues vals = source.getValues(context, leaf);
+		  FunctionValues vals = source.GetValues(context, leaf);
 		  for (int i = 0; i < maxDoc; i++)
 		  {
 
-		  float val = vals.floatVal(i);
+		  float val = vals.FloatVal(i);
 		  if ((float.floatToRawIntBits(val) & (0xff << 23)) == 0xff << 23)
 		  {
 			// if the exponent in the float is all ones, then this is +Inf, -Inf or NaN
@@ -109,8 +109,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 
 		ScaleInfo scaleInfo = (ScaleInfo)context[ScaleFloatFunction.this];
@@ -130,8 +130,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		float maxSource = scaleInfo.maxVal;
 
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
-		FunctionValues vals = source.getValues(context, readerContext);
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.GetValues(context, readerContext);
+		FunctionValues vals = source.GetValues(context, readerContext);
 
 		return new FloatDocValuesAnonymousInnerClassHelper(this, this, scale, minSource, maxSource, vals);
 	  }
@@ -154,9 +154,9 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.vals = vals;
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
-			return (vals.floatVal(doc) - minSource) * scale + outerInstance.min;
+			return (vals.FloatVal(doc) - minSource) * scale + outerInstance.min;
 		  }
 		  public override string ToString(int doc)
 		  {
@@ -165,10 +165,10 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
-		source.createWeight(context, searcher);
+		source.CreateWeight(context, searcher);
 	  }
 
 	  public override int GetHashCode()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs
index cbb6215..9ed5d2a 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs
@@ -47,8 +47,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final org.apache.lucene.search.FieldCache.Shorts arr = cache.getShorts(readerContext.reader(), field, parser, false);
@@ -69,17 +69,17 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.arr = arr;
 		  }
 
-		  public override sbyte byteVal(int doc)
+		  public override sbyte ByteVal(int doc)
 		  {
 			return (sbyte) arr.get(doc);
 		  }
 
-		  public override short shortVal(int doc)
+		  public override short ShortVal(int doc)
 		  {
 			return arr.get(doc);
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
 			return (float) arr.get(doc);
 		  }
@@ -89,24 +89,24 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			return (int) arr.get(doc);
 		  }
 
-		  public override long longVal(int doc)
+		  public override long LongVal(int doc)
 		  {
 			return (long) arr.get(doc);
 		  }
 
-		  public override double doubleVal(int doc)
+		  public override double DoubleVal(int doc)
 		  {
 			return (double) arr.get(doc);
 		  }
 
-		  public override string strVal(int doc)
+		  public override string StrVal(int doc)
 		  {
 			return Convert.ToString(arr.get(doc));
 		  }
 
 		  public override string ToString(int doc)
 		  {
-			return outerInstance.description() + '=' + shortVal(doc);
+			return outerInstance.description() + '=' + ShortVal(doc);
 		  }
 
 	  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs
index e80fd80..ea31a26 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -41,12 +41,12 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  protected internal abstract bool func(int doc, FunctionValues vals);
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.docvalues.BoolDocValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override BoolDocValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.docvalues.BoolDocValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override BoolDocValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.getValues(context, readerContext);
-		FunctionValues vals = source.getValues(context, readerContext);
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues vals = source.GetValues(context, readerContext);
+		FunctionValues vals = source.GetValues(context, readerContext);
 		return new BoolDocValuesAnonymousInnerClassHelper(this, this, vals);
 	  }
 
@@ -93,10 +93,10 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
-		source.createWeight(context, searcher);
+		source.CreateWeight(context, searcher);
 	  }
 	}
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/SimpleFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SimpleFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/SimpleFloatFunction.cs
index 73739df..31cb1c2 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/SimpleFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SimpleFloatFunction.cs
@@ -16,8 +16,8 @@
  * limitations under the License.
  */
 using Lucene.Net.Index;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -26,7 +26,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	/// </summary>
 	 public abstract class SimpleFloatFunction : SingleFunction
 	 {
-	  public SimpleFloatFunction(org.apache.lucene.queries.function.ValueSource source) : base(source)
+	  public SimpleFloatFunction(ValueSource source) : base(source)
 	  {
 	  }
 
@@ -34,7 +34,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
-		FunctionValues vals = source.getValues(context, readerContext);
+		FunctionValues vals = source.GetValues(context, readerContext);
 		return new FloatDocValuesAnonymousInnerClassHelper(this, this, vals);
 	  }
 
@@ -50,7 +50,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.vals = vals;
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
 			return outerInstance.func(doc, vals);
 		  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs
index b4102fd..51c196d 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs
@@ -53,10 +53,10 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
-		source.createWeight(context, searcher);
+		source.CreateWeight(context, searcher);
 	  }
 	 }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/SumFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SumFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/SumFloatFunction.cs
index bcfd8a8..35a8274 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/SumFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SumFloatFunction.cs
@@ -40,7 +40,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		float val = 0.0f;
 		foreach (FunctionValues vals in valsArr)
 		{
-		  val += vals.floatVal(doc);
+		  val += vals.FloatVal(doc);
 		}
 		return val;
 	  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs
index 1fc9aec..bb5aa41 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -47,15 +47,15 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 		return (FunctionValues)context[this];
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
 		long sumTotalTermFreq = 0;
 		foreach (AtomicReaderContext readerContext in searcher.TopReaderContext.leaves())
@@ -99,7 +99,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.ttf = ttf;
 		  }
 
-		  public override long longVal(int doc)
+		  public override long LongVal(int doc)
 		  {
 			return ttf;
 		  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs
index df6be4c..2240d4d 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs
@@ -1,7 +1,12 @@
 using System;
 using System.Collections;
+using System.IO;
+using Lucene.Net.Index;
+using Lucene.Net.Queries.Function.DocValues;
+using Lucene.Net.Search;
+using Lucene.Net.Search.Similarities;
+using Lucene.Net.Util;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -42,18 +47,12 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		return "tf";
 	  }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
-		Fields fields = readerContext.reader().fields();
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final Terms terms = fields.terms(indexedField);
-		Terms terms = fields.terms(indexedField);
+		Fields fields = readerContext.AtomicReader.Fields;
+		Terms terms = fields.Terms(indexedField);
 		IndexSearcher searcher = (IndexSearcher)context["searcher"];
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.search.similarities.TFIDFSimilarity similarity = IDFValueSource.asTFIDF(searcher.getSimilarity(), indexedField);
-		TFIDFSimilarity similarity = IDFValueSource.asTFIDF(searcher.Similarity, indexedField);
+		TFIDFSimilarity similarity = IDFValueSource.AsTFIDF(searcher.Similarity, indexedField);
 		if (similarity == null)
 		{
 		  throw new System.NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)");
@@ -69,7 +68,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		  private Terms terms;
 		  private TFIDFSimilarity similarity;
 
-		  public FloatDocValuesAnonymousInnerClassHelper(TFValueSource outerInstance, TFValueSource this, Terms terms, TFIDFSimilarity similarity) : base(this)
+		  public FloatDocValuesAnonymousInnerClassHelper(TFValueSource outerInstance, TFValueSource @this, Terms terms, TFIDFSimilarity similarity) : base(@this)
 		  {
 			  this.outerInstance = outerInstance;
 			  this.terms = terms;
@@ -88,7 +87,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: public void reset() throws java.io.IOException
-		  public virtual void reset()
+		  public virtual void Reset()
 		  {
 			// no one should call us for deleted docs?
 
@@ -96,10 +95,10 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			{
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final TermsEnum termsEnum = terms.iterator(null);
-			  TermsEnum termsEnum = terms.iterator(null);
-			  if (termsEnum.seekExact(outerInstance.indexedBytes))
+			  TermsEnum termsEnum = terms.Iterator(null);
+			  if (termsEnum.SeekExact(outerInstance.indexedBytes))
 			  {
-				docs = termsEnum.docs(null, null);
+				docs = termsEnum.Docs(null, null);
 			  }
 			  else
 			  {
@@ -127,57 +126,57 @@ namespace Lucene.Net.Queries.Function.ValueSources
 				  this.outerInstance = outerInstance;
 			  }
 
-			  public override int freq()
+			  public override int Freq()
 			  {
 				return 0;
 			  }
 
-			  public override int docID()
+			  public override int DocID()
 			  {
 				return DocIdSetIterator.NO_MORE_DOCS;
 			  }
 
-			  public override int nextDoc()
+			  public override int NextDoc()
 			  {
 				return DocIdSetIterator.NO_MORE_DOCS;
 			  }
 
-			  public override int advance(int target)
+			  public override int Advance(int target)
 			  {
 				return DocIdSetIterator.NO_MORE_DOCS;
 			  }
 
-			  public override long cost()
+			  public override long Cost()
 			  {
 				return 0;
 			  }
 		  }
 
-		  public override float floatVal(int doc)
+		  public override float FloatVal(int doc)
 		  {
 			try
 			{
 			  if (doc < lastDocRequested)
 			  {
 				// out-of-order access.... reset
-				reset();
+				Reset();
 			  }
 			  lastDocRequested = doc;
 
 			  if (atDoc < doc)
 			  {
-				atDoc = docs.advance(doc);
+				atDoc = docs.Advance(doc);
 			  }
 
 			  if (atDoc > doc)
 			  {
 				// term doesn't match this document... either because we hit the
 				// end, or because the next doc is after this doc.
-				return similarity.tf(0);
+				return similarity.Tf(0);
 			  }
 
 			  // a match!
-			  return similarity.tf(docs.freq());
+			  return similarity.Tf(docs.Freq());
 			}
 			catch (IOException e)
 			{

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/TermFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/TermFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/TermFreqValueSource.cs
index 3a70309..5634e0d 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/TermFreqValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/TermFreqValueSource.cs
@@ -16,8 +16,8 @@
  */
 using System;
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -41,8 +41,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 		Fields fields = readerContext.reader().fields();
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs
index 24a5684..dce8177 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 using System.Collections;
+using Lucene.Net.Queries.Function.DocValues;
 using org.apache.lucene.queries.function;
-using org.apache.lucene.queries.function.docvalues;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -53,15 +53,15 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 		return (FunctionValues)context[this];
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
+//ORIGINAL LINE: @Override public void CreateWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
+	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
 	  {
 		long totalTermFreq = 0;
 		foreach (AtomicReaderContext readerContext in searcher.TopReaderContext.leaves())
@@ -95,7 +95,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.ttf = ttf;
 		  }
 
-		  public override long longVal(int doc)
+		  public override long LongVal(int doc)
 		  {
 			return ttf;
 		  }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ba0f3c7d/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs
index 683e5df..e859263 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs
@@ -1,6 +1,8 @@
 using System.Collections;
 using System.Collections.Generic;
 using System.Text;
+using Lucene.Net.Index;
+using Lucene.Net.Search;
 using org.apache.lucene.queries.function;
 
 namespace Lucene.Net.Queries.Function.ValueSources
@@ -23,7 +25,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	 */
     /// <summary>
 	/// Converts individual ValueSource instances to leverage the FunctionValues *Val functions that work with multiple values,
-	/// i.e. <seealso cref="org.apache.lucene.queries.function.FunctionValues#doubleVal(int, double[])"/>
+	/// i.e. <seealso cref="FunctionValues#DoubleVal(int, double[])"/>
 	/// </summary>
 	//Not crazy about the name, but...
 	public class VectorValueSource : MultiValueSource
@@ -55,8 +57,8 @@ namespace Lucene.Net.Queries.Function.ValueSources
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues getValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
-	  public override FunctionValues getValues(IDictionary context, AtomicReaderContext readerContext)
+//ORIGINAL LINE: @Override public org.apache.lucene.queries.function.FunctionValues GetValues(java.util.Map context, org.apache.lucene.index.AtomicReaderContext readerContext) throws java.io.IOException
+	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
 	  {
 		int size = sources.Count;
 
@@ -64,11 +66,11 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		if (size == 2)
 		{
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues x = sources.get(0).getValues(context, readerContext);
-		  FunctionValues x = sources[0].getValues(context, readerContext);
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues x = sources.get(0).GetValues(context, readerContext);
+		  FunctionValues x = sources[0].GetValues(context, readerContext);
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues y = sources.get(1).getValues(context, readerContext);
-		  FunctionValues y = sources[1].getValues(context, readerContext);
+//ORIGINAL LINE: final org.apache.lucene.queries.function.FunctionValues y = sources.get(1).GetValues(context, readerContext);
+		  FunctionValues y = sources[1].GetValues(context, readerContext);
 		  return new FunctionValuesAnonymousInnerClassHelper(this, x, y);
 		}
 
@@ -78,7 +80,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		FunctionValues[] valsArr = new FunctionValues[size];
 		for (int i = 0; i < size; i++)
 		{
-		  valsArr[i] = sources[i].getValues(context, readerContext);
+		  valsArr[i] = sources[i].GetValues(context, readerContext);
 		}
 
 		return new FunctionValuesAnonymousInnerClassHelper2(this, valsArr);
@@ -98,41 +100,41 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.y = y;
 		  }
 
-		  public override void byteVal(int doc, sbyte[] vals)
+		  public override void ByteVal(int doc, sbyte[] vals)
 		  {
-			vals[0] = x.byteVal(doc);
-			vals[1] = y.byteVal(doc);
+			vals[0] = x.ByteVal(doc);
+			vals[1] = y.ByteVal(doc);
 		  }
 
-		  public override void shortVal(int doc, short[] vals)
+		  public override void ShortVal(int doc, short[] vals)
 		  {
-			vals[0] = x.shortVal(doc);
-			vals[1] = y.shortVal(doc);
+			vals[0] = x.ShortVal(doc);
+			vals[1] = y.ShortVal(doc);
 		  }
-		  public override void intVal(int doc, int[] vals)
+		  public override void IntVal(int doc, int[] vals)
 		  {
-			vals[0] = x.intVal(doc);
-			vals[1] = y.intVal(doc);
+			vals[0] = x.IntVal(doc);
+			vals[1] = y.IntVal(doc);
 		  }
-		  public override void longVal(int doc, long[] vals)
+		  public override void LongVal(int doc, long[] vals)
 		  {
-			vals[0] = x.longVal(doc);
-			vals[1] = y.longVal(doc);
+			vals[0] = x.LongVal(doc);
+			vals[1] = y.LongVal(doc);
 		  }
-		  public override void floatVal(int doc, float[] vals)
+		  public override void FloatVal(int doc, float[] vals)
 		  {
-			vals[0] = x.floatVal(doc);
-			vals[1] = y.floatVal(doc);
+			vals[0] = x.FloatVal(doc);
+			vals[1] = y.FloatVal(doc);
 		  }
-		  public override void doubleVal(int doc, double[] vals)
+		  public override void DoubleVal(int doc, double[] vals)
 		  {
-			vals[0] = x.doubleVal(doc);
-			vals[1] = y.doubleVal(doc);
+			vals[0] = x.DoubleVal(doc);
+			vals[1] = y.DoubleVal(doc);
 		  }
-		  public override void strVal(int doc, string[] vals)
+		  public override void StrVal(int doc, string[] vals)
 		  {
-			vals[0] = x.strVal(doc);
-			vals[1] = y.strVal(doc);
+			vals[0] = x.StrVal(doc);
+			vals[1] = y.StrVal(doc);
 		  }
 		  public override string ToString(int doc)
 		  {
@@ -152,59 +154,59 @@ namespace Lucene.Net.Queries.Function.ValueSources
 			  this.valsArr = valsArr;
 		  }
 
-		  public override void byteVal(int doc, sbyte[] vals)
+		  public override void ByteVal(int doc, sbyte[] vals)
 		  {
 			for (int i = 0; i < valsArr.Length; i++)
 			{
-			  vals[i] = valsArr[i].byteVal(doc);
+			  vals[i] = valsArr[i].ByteVal(doc);
 			}
 		  }
 
-		  public override void shortVal(int doc, short[] vals)
+		  public override void ShortVal(int doc, short[] vals)
 		  {
 			for (int i = 0; i < valsArr.Length; i++)
 			{
-			  vals[i] = valsArr[i].shortVal(doc);
+			  vals[i] = valsArr[i].ShortVal(doc);
 			}
 		  }
 
-		  public override void floatVal(int doc, float[] vals)
+		  public override void FloatVal(int doc, float[] vals)
 		  {
 			for (int i = 0; i < valsArr.Length; i++)
 			{
-			  vals[i] = valsArr[i].floatVal(doc);
+			  vals[i] = valsArr[i].FloatVal(doc);
 			}
 		  }
 
-		  public override void intVal(int doc, int[] vals)
+		  public override void IntVal(int doc, int[] vals)
 		  {
 			for (int i = 0; i < valsArr.Length; i++)
 			{
-			  vals[i] = valsArr[i].intVal(doc);
+			  vals[i] = valsArr[i].IntVal(doc);
 			}
 		  }
 
-		  public override void longVal(int doc, long[] vals)
+		  public override void LongVal(int doc, long[] vals)
 		  {
 			for (int i = 0; i < valsArr.Length; i++)
 			{
-			  vals[i] = valsArr[i].longVal(doc);
+			  vals[i] = valsArr[i].LongVal(doc);
 			}
 		  }
 
-		  public override void doubleVal(int doc, double[] vals)
+		  public override void DoubleVal(int doc, double[] vals)
 		  {
 			for (int i = 0; i < valsArr.Length; i++)
 			{
-			  vals[i] = valsArr[i].doubleVal(doc);
+			  vals[i] = valsArr[i].DoubleVal(doc);
 			}
 		  }
 
-		  public override void strVal(int doc, string[] vals)
+		  public override void StrVal(int doc, string[] vals)
 		  {
 			for (int i = 0; i < valsArr.Length; i++)
 			{
-			  vals[i] = valsArr[i].strVal(doc);
+			  vals[i] = valsArr[i].StrVal(doc);
 			}
 		  }
 
@@ -230,18 +232,16 @@ namespace Lucene.Net.Queries.Function.ValueSources
 		  }
 	  }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void createWeight(java.util.Map context, org.apache.lucene.search.IndexSearcher searcher) throws java.io.IOException
-	  public override void createWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		foreach (ValueSource source in sources)
-		{
-		  source.createWeight(context, searcher);
-		}
-	  }
+        public override void CreateWeight(IDictionary context, IndexSearcher searcher)
+        {
+            foreach (ValueSource source in sources)
+            {
+                source.CreateWeight(context, searcher);
+            }
+        }
 
 
-	  public override string description()
+        public override string description()
 	  {
 		StringBuilder sb = new StringBuilder();
 		sb.Append(name()).Append('(');