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:44 UTC

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

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