Index: solr/common-build.xml
===================================================================
--- solr/common-build.xml	(revision 1104714)
+++ solr/common-build.xml	(working copy)
@@ -188,6 +188,7 @@
     <pathelement location="${common-solr.dir}/../lucene/build/classes/java" />
     <pathelement location="${common-solr.dir}/../modules/analysis/build/common/classes/java" />
     <pathelement location="${common-solr.dir}/../modules/analysis/build/phonetic/classes/java" />
+    <pathelement location="${common-solr.dir}/../modules/queries/build/classes/java" />
     <pathelement location="${common-solr.dir}/../lucene/build/contrib/highlighter/classes/java" />
     <pathelement location="${common-solr.dir}/../lucene/build/contrib/memory/classes/java" />
     <pathelement location="${common-solr.dir}/../lucene/build/contrib/misc/classes/java" />
@@ -204,6 +205,7 @@
       <subant target="jar" inheritall="false" failonerror="true">
         <fileset dir="../modules/analysis/common" includes="build.xml" />
         <fileset dir="../modules/analysis/phonetic" includes="build.xml" />
+        <fileset dir="../modules/queries" includes="build.xml"/>
         <fileset dir="../lucene/contrib/highlighter" includes="build.xml" />
         <fileset dir="../lucene/contrib/memory" includes="build.xml" />
         <fileset dir="../lucene/contrib/misc" includes="build.xml" />
@@ -252,6 +254,7 @@
     <subant target="default">
       <fileset dir="../modules/analysis/common" includes="build.xml"/>
       <fileset dir="../modules/analysis/phonetic" includes="build.xml"/>
+      <fileset dir="../modules/queries" includes="build.xml"/>
       <fileset dir="../lucene/contrib/highlighter" includes="build.xml"/>
       <fileset dir="../lucene/contrib/memory" includes="build.xml"/>
       <fileset dir="../lucene/contrib/misc" includes="build.xml"/>
Index: solr/src/test/org/apache/solr/core/DummyValueSourceParser.java
===================================================================
--- solr/src/test/org/apache/solr/core/DummyValueSourceParser.java	(revision 1104714)
+++ solr/src/test/org/apache/solr/core/DummyValueSourceParser.java	(working copy)
@@ -16,13 +16,13 @@
  * limitations under the License.
  */
 
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.search.FunctionQParser;
 import org.apache.solr.search.ValueSourceParser;
-import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.SimpleFloatFunction;
-import org.apache.solr.search.function.ValueSource;
 
 
 /**
Index: solr/src/test/org/apache/solr/schema/PolyFieldTest.java
===================================================================
--- solr/src/test/org/apache/solr/schema/PolyFieldTest.java	(revision 1104714)
+++ solr/src/test/org/apache/solr/schema/PolyFieldTest.java	(working copy)
@@ -17,13 +17,13 @@
  */
 
 import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.BooleanClause;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.Query;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.common.SolrException;
-import org.apache.solr.search.function.ValueSource;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
Index: solr/src/test/org/apache/solr/search/function/NvlValueSourceParser.java
===================================================================
--- solr/src/test/org/apache/solr/search/function/NvlValueSourceParser.java	(revision 1104714)
+++ solr/src/test/org/apache/solr/search/function/NvlValueSourceParser.java	(working copy)
@@ -17,6 +17,8 @@
 
 package org.apache.solr.search.function;
 
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.search.FunctionQParser;
Index: solr/src/test/org/apache/solr/search/TestIndexSearcher.java
===================================================================
--- solr/src/test/org/apache/solr/search/TestIndexSearcher.java	(revision 1104714)
+++ solr/src/test/org/apache/solr/search/TestIndexSearcher.java	(working copy)
@@ -18,12 +18,12 @@
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.index.IndexReader.ReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.util.ReaderUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.schema.SchemaField;
-import org.apache.solr.search.function.ValueSource;
-import org.apache.solr.search.function.DocValues;
 import org.junit.BeforeClass;
 
 import java.util.Map;
Index: solr/src/java/org/apache/solr/schema/BoolField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/BoolField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/BoolField.java	(working copy)
@@ -17,11 +17,11 @@
 
 package org.apache.solr.schema;
 
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.OrdFieldSource;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.Tokenizer;
Index: solr/src/java/org/apache/solr/schema/TrieDateField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/TrieDateField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/TrieDateField.java	(working copy)
@@ -17,8 +17,8 @@
 
 package org.apache.solr.schema;
 
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.noggit.CharArr;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.QParser;
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.lucene.document.Fieldable;
Index: solr/src/java/org/apache/solr/schema/BCDIntField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/BCDIntField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/BCDIntField.java	(working copy)
@@ -17,9 +17,9 @@
 
 package org.apache.solr.schema;
 
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.lucene.document.Fieldable;
 import org.apache.solr.util.BCDUtils;
 import org.apache.solr.response.TextResponseWriter;
Index: solr/src/java/org/apache/solr/schema/TrieField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/TrieField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/TrieField.java	(working copy)
@@ -19,6 +19,7 @@
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.NumericField;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.*;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 import org.apache.lucene.search.cache.DoubleValuesCreator;
Index: solr/src/java/org/apache/solr/schema/SortableDoubleField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/SortableDoubleField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/SortableDoubleField.java	(working copy)
@@ -17,15 +17,15 @@
 
 package org.apache.solr.schema;
 
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
 import org.apache.solr.search.MutableValueDouble;
-import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.FieldCacheSource;
-import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.StringIndexDocValues;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
Index: solr/src/java/org/apache/solr/schema/StrField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/StrField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/StrField.java	(working copy)
@@ -17,11 +17,11 @@
 
 package org.apache.solr.schema;
 
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.util.BytesRef;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.QParser;
 import org.apache.solr.util.ByteUtils;
 
Index: solr/src/java/org/apache/solr/schema/DoubleField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/DoubleField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/DoubleField.java	(working copy)
@@ -18,13 +18,13 @@
 package org.apache.solr.schema;
 
 import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 import org.apache.lucene.search.cache.DoubleValuesCreator;
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.DoubleFieldSource;
-import org.apache.solr.search.function.ValueSource;
 
 import java.io.IOException;
 import java.util.Map;
Index: solr/src/java/org/apache/solr/schema/DateField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/DateField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/DateField.java	(working copy)
@@ -19,6 +19,8 @@
 
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.TermRangeQuery;
Index: solr/src/java/org/apache/solr/schema/ExternalFileField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/ExternalFileField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/ExternalFileField.java	(working copy)
@@ -16,9 +16,9 @@
  */
 package org.apache.solr.schema;
 
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.document.Fieldable;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.FileFloatSource;
 import org.apache.solr.search.QParser;
 import org.apache.solr.response.TextResponseWriter;
Index: solr/src/java/org/apache/solr/schema/PointType.java
===================================================================
--- solr/src/java/org/apache/solr/schema/PointType.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/PointType.java	(working copy)
@@ -19,6 +19,7 @@
 
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.BooleanClause;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.Query;
@@ -32,7 +33,6 @@
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.SpatialOptions;
 import org.apache.solr.search.function.VectorValueSource;
-import org.apache.solr.search.function.ValueSource;
 
 import java.io.IOException;
 import java.util.Map;
Index: solr/src/java/org/apache/solr/schema/LatLonType.java
===================================================================
--- solr/src/java/org/apache/solr/schema/LatLonType.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/LatLonType.java	(working copy)
@@ -20,6 +20,8 @@
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.*;
 import org.apache.lucene.spatial.DistanceUtils;
 import org.apache.lucene.spatial.tier.InvalidGeoException;
@@ -28,8 +30,6 @@
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.SpatialOptions;
-import org.apache.solr.search.function.DocValues;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.VectorValueSource;
 
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/schema/RandomSortField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/RandomSortField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/RandomSortField.java	(working copy)
@@ -23,13 +23,13 @@
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.*;
 import org.apache.lucene.util.ReaderUtil;
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.IntDocValues;
-import org.apache.solr.search.function.ValueSource;
 
 /**
  * Utility Field used for random sorting.  It should not be passed a value.
Index: solr/src/java/org/apache/solr/schema/SortableLongField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/SortableLongField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/SortableLongField.java	(working copy)
@@ -17,15 +17,15 @@
 
 package org.apache.solr.schema;
 
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
 import org.apache.solr.search.MutableValueLong;
-import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.FieldCacheSource;
-import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.StringIndexDocValues;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
Index: solr/src/java/org/apache/solr/schema/ShortField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/ShortField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/ShortField.java	(working copy)
@@ -17,13 +17,13 @@
  */
 
 import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 import org.apache.lucene.search.cache.ShortValuesCreator;
 
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.ShortFieldSource;
 
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/schema/LongField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/LongField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/LongField.java	(working copy)
@@ -18,12 +18,12 @@
 package org.apache.solr.schema;
 
 import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 import org.apache.lucene.search.cache.LongValuesCreator;
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.LongFieldSource;
 
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/schema/SortableFloatField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/SortableFloatField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/SortableFloatField.java	(working copy)
@@ -17,15 +17,15 @@
 
 package org.apache.solr.schema;
 
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.MutableValueFloat;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
-import org.apache.solr.search.MutableValueFloat;
-import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.FieldCacheSource;
-import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.StringIndexDocValues;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
Index: solr/src/java/org/apache/solr/schema/ByteField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/ByteField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/ByteField.java	(working copy)
@@ -17,13 +17,13 @@
  */
 
 import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.cache.ByteValuesCreator;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.ByteFieldSource;
 
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/schema/FloatField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/FloatField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/FloatField.java	(working copy)
@@ -17,11 +17,11 @@
 
 package org.apache.solr.schema;
 
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 import org.apache.lucene.search.cache.FloatValuesCreator;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.FloatFieldSource;
 import org.apache.lucene.document.Fieldable;
 import org.apache.solr.response.TextResponseWriter;
Index: solr/src/java/org/apache/solr/schema/GeoHashField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/GeoHashField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/GeoHashField.java	(working copy)
@@ -18,6 +18,7 @@
 package org.apache.solr.schema;
 
 import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.spatial.geohash.GeoHashUtils;
@@ -29,7 +30,6 @@
 import org.apache.solr.search.SolrConstantScoreQuery;
 import org.apache.solr.search.SpatialOptions;
 import org.apache.solr.search.function.LiteralValueSource;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.ValueSourceRangeFilter;
 import org.apache.solr.search.function.distance.GeohashHaversineFunction;
 
Index: solr/src/java/org/apache/solr/schema/FieldType.java
===================================================================
--- solr/src/java/org/apache/solr/schema/FieldType.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/FieldType.java	(working copy)
@@ -24,6 +24,7 @@
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Similarity;
 import org.apache.lucene.search.SortField;
@@ -38,7 +39,6 @@
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.Sorting;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.util.ByteUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
Index: solr/src/java/org/apache/solr/schema/SortableIntField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/SortableIntField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/SortableIntField.java	(working copy)
@@ -17,15 +17,15 @@
 
 package org.apache.solr.schema;
 
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
 import org.apache.solr.search.MutableValueInt;
-import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.FieldCacheSource;
-import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.StringIndexDocValues;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
Index: solr/src/java/org/apache/solr/schema/StrFieldSource.java
===================================================================
--- solr/src/java/org/apache/solr/schema/StrFieldSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/StrFieldSource.java	(working copy)
@@ -18,9 +18,9 @@
 package org.apache.solr.schema;
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
 import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
-import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.FieldCacheSource;
 import org.apache.solr.search.function.StringIndexDocValues;
 import org.apache.solr.util.ByteUtils;
Index: solr/src/java/org/apache/solr/schema/IntField.java
===================================================================
--- solr/src/java/org/apache/solr/schema/IntField.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/schema/IntField.java	(working copy)
@@ -17,11 +17,11 @@
 
 package org.apache.solr.schema;
 
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 import org.apache.lucene.search.cache.IntValuesCreator;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.IntFieldSource;
 import org.apache.lucene.document.Fieldable;
 import org.apache.solr.response.TextResponseWriter;
Index: solr/src/java/org/apache/solr/search/BoostQParserPlugin.java
===================================================================
--- solr/src/java/org/apache/solr/search/BoostQParserPlugin.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/BoostQParserPlugin.java	(working copy)
@@ -16,15 +16,15 @@
  */
 package org.apache.solr.search;
 
+import org.apache.lucene.queries.function.FunctionQuery;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.Query;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.search.function.BoostedQuery;
-import org.apache.solr.search.function.FunctionQuery;
 import org.apache.solr.search.function.QueryValueSource;
-import org.apache.solr.search.function.ValueSource;
 
 /**
  * Create a boosted query from the input value.  The main value is the query to be boosted.
Index: solr/src/java/org/apache/solr/search/function/DoubleConstValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/DoubleConstValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/DoubleConstValueSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,9 +17,8 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
 
 import java.io.IOException;
 import java.util.Map;
Index: solr/src/java/org/apache/solr/search/function/DoubleFieldSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/DoubleFieldSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/DoubleFieldSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,14 +17,14 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSourceScorer;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.search.cache.DoubleValuesCreator;
 import org.apache.lucene.search.cache.CachedArray.DoubleValues;
-import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.MutableValueDouble;
 
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/search/function/IntDocValues.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/IntDocValues.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/IntDocValues.java	(working copy)
@@ -1,6 +1,25 @@
 package org.apache.solr.search.function;
 
-import org.apache.solr.search.MutableValue;
+/*
+ * 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.
+ */
+
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.solr.search.MutableValueInt;
 
 public abstract class IntDocValues extends DocValues {
Index: solr/src/java/org/apache/solr/search/function/DocFreqValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/DocFreqValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/DocFreqValueSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,10 +17,10 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.util.BytesRef;
 import org.apache.solr.search.*;
Index: solr/src/java/org/apache/solr/search/function/LinearFloatFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/LinearFloatFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/LinearFloatFunction.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,9 +17,9 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 
 import java.io.IOException;
@@ -27,7 +29,7 @@
  * <code>LinearFloatFunction</code> implements a linear function over
  * another {@link ValueSource}.
  * <br>
- * Normally Used as an argument to a {@link FunctionQuery}
+ * Normally Used as an argument to a {@link org.apache.lucene.queries.function.FunctionQuery}
  *
  * @version $Id$
  */
Index: solr/src/java/org/apache/solr/search/function/MultiValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/MultiValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/MultiValueSource.java	(working copy)
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-import org.apache.solr.search.function.ValueSource;
+import org.apache.lucene.queries.function.ValueSource;
 
 
 /**
Index: solr/src/java/org/apache/solr/search/function/LiteralValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/LiteralValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/LiteralValueSource.java	(working copy)
@@ -17,6 +17,8 @@
  */
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.util.BytesRef;
 
 import java.util.Map;
Index: solr/src/java/org/apache/solr/search/function/NumericFieldCacheSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/NumericFieldCacheSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/NumericFieldCacheSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,8 +17,6 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.search.cache.CachedArray;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 
Index: solr/src/java/org/apache/solr/search/function/ProductFloatFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/ProductFloatFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/ProductFloatFunction.java	(working copy)
@@ -1,4 +1,9 @@
-/**
+package org.apache.solr.search.function;
+
+import org.apache.lucene.queries.function.DocValues;
+import 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.
@@ -15,8 +20,6 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 /**
  * <code>ProductFloatFunction</code> returns the product of it's components.
  */
Index: solr/src/java/org/apache/solr/search/function/DivFloatFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/DivFloatFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/DivFloatFunction.java	(working copy)
@@ -1,4 +1,9 @@
-/**
+package org.apache.solr.search.function;
+
+import org.apache.lucene.queries.function.DocValues;
+import 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.
@@ -15,8 +20,6 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 /** Function to divide "a" by "b"
  */
 public class DivFloatFunction extends DualFloatFunction {
Index: solr/src/java/org/apache/solr/search/function/StrDocValues.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/StrDocValues.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/StrDocValues.java	(working copy)
@@ -1,9 +1,27 @@
 package org.apache.solr.search.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.
+ */
+
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
-import org.apache.solr.search.MutableValue;
-import org.apache.solr.search.MutableValueFloat;
 import org.apache.solr.search.MutableValueStr;
 
 public abstract class StrDocValues extends DocValues {
Index: solr/src/java/org/apache/solr/search/function/DoubleDocValues.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/DoubleDocValues.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/DoubleDocValues.java	(working copy)
@@ -1,6 +1,25 @@
 package org.apache.solr.search.function;
 
-import org.apache.solr.search.MutableValue;
+/*
+ * 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.
+ */
+
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.solr.search.MutableValueDouble;
 
 public abstract class DoubleDocValues extends DocValues {
Index: solr/src/java/org/apache/solr/search/function/VectorValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/VectorValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/VectorValueSource.java	(working copy)
@@ -17,10 +17,10 @@
  */
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.solr.search.function.MultiValueSource;
-import org.apache.solr.search.function.DocValues;
-import org.apache.solr.search.function.ValueSource;
 
 import java.io.IOException;
 import java.util.List;
@@ -29,7 +29,7 @@
 
 /**
  * Converts individual ValueSource instances to leverage the DocValues *Val functions that work with multiple values,
- * i.e. {@link org.apache.solr.search.function.DocValues#doubleVal(int, double[])}
+ * i.e. {@link org.apache.lucene.queries.function.DocValues#doubleVal(int, double[])}
  */
 //Not crazy about the name, but...
 public class VectorValueSource extends MultiValueSource {
Index: solr/src/java/org/apache/solr/search/function/QueryValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/QueryValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/QueryValueSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,16 +17,16 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.MutableValueFloat;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.*;
 import org.apache.lucene.search.Weight.ScorerContext;
 import org.apache.lucene.util.ReaderUtil;
 import org.apache.solr.common.SolrException;
-import org.apache.solr.search.MutableValue;
-import org.apache.solr.search.MutableValueFloat;
 
 import java.io.IOException;
 import java.util.Map;
Index: solr/src/java/org/apache/solr/search/function/ScaleFloatFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/ScaleFloatFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/ScaleFloatFunction.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,9 +17,9 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.util.ReaderUtil;
 
Index: solr/src/java/org/apache/solr/search/function/ShortFieldSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/ShortFieldSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/ShortFieldSource.java	(working copy)
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+import org.apache.lucene.queries.function.DocValues;
 import org.apache.lucene.search.cache.ShortValuesCreator;
 import org.apache.lucene.search.cache.CachedArray.ShortValues;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
Index: solr/src/java/org/apache/solr/search/function/LongFieldSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/LongFieldSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/LongFieldSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,14 +17,14 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSourceScorer;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.search.cache.LongValuesCreator;
 import org.apache.lucene.search.cache.CachedArray.LongValues;
-import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.MutableValueLong;
 
 
Index: solr/src/java/org/apache/solr/search/function/DocValues.java (deleted)
===================================================================
Index: solr/src/java/org/apache/solr/search/function/RangeMapFloatFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/RangeMapFloatFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/RangeMapFloatFunction.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,9 +17,9 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 
 import java.io.IOException;
@@ -25,9 +27,9 @@
 
 /**
  * <code>LinearFloatFunction</code> implements a linear function over
- * another {@link org.apache.solr.search.function.ValueSource}.
+ * another {@link org.apache.lucene.queries.function.ValueSource}.
  * <br>
- * Normally Used as an argument to a {@link org.apache.solr.search.function.FunctionQuery}
+ * Normally Used as an argument to a {@link org.apache.lucene.queries.function.FunctionQuery}
  *
  * @version $Id$
  */
Index: solr/src/java/org/apache/solr/search/function/FileFloatSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/FileFloatSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/FileFloatSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -14,7 +16,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.solr.search.function;
 
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.DocsEnum;
@@ -22,6 +23,8 @@
 import org.apache.lucene.index.IndexReader.ReaderContext;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.util.ReaderUtil;
 import org.apache.lucene.util.StringHelper;
 import org.apache.lucene.util.BytesRef;
Index: solr/src/java/org/apache/solr/search/function/NumDocsValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/NumDocsValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/NumDocsValueSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -14,9 +16,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.solr.search.function;
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.util.ReaderUtil;
 
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/search/function/ByteFieldSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/ByteFieldSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/ByteFieldSource.java	(working copy)
@@ -17,6 +17,7 @@
  */
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
 import org.apache.lucene.search.cache.ByteValuesCreator;
 import org.apache.lucene.search.cache.CachedArray.ByteValues;
 
Index: solr/src/java/org/apache/solr/search/function/MaxDocValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/MaxDocValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/MaxDocValueSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -14,9 +16,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.solr.search.function;
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/search/function/FloatFieldSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/FloatFieldSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/FloatFieldSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,17 +17,16 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import java.io.IOException;
 import java.util.Map;
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.MutableValueFloat;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.search.cache.FloatValuesCreator;
 import org.apache.lucene.search.cache.CachedArray.FloatValues;
-import org.apache.solr.search.MutableValue;
-import org.apache.solr.search.MutableValueFloat;
 
 /**
  * Obtains float field values from the {@link org.apache.lucene.search.FieldCache}
Index: solr/src/java/org/apache/solr/search/function/ValueSource.java (deleted)
===================================================================
Index: solr/src/java/org/apache/solr/search/function/SumFloatFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/SumFloatFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/SumFloatFunction.java	(working copy)
@@ -1,4 +1,9 @@
-/**
+package org.apache.solr.search.function;
+
+import org.apache.lucene.queries.function.DocValues;
+import 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.
@@ -15,8 +20,6 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 /**
  * <code>SumFloatFunction</code> returns the sum of it's components.
  */
Index: solr/src/java/org/apache/solr/search/function/PowFloatFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/PowFloatFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/PowFloatFunction.java	(working copy)
@@ -1,4 +1,9 @@
-/**
+package org.apache.solr.search.function;
+
+import org.apache.lucene.queries.function.DocValues;
+import 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.
@@ -15,8 +20,6 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 /** Function to raise the base "a" to the power "b"
  */
 public class PowFloatFunction extends DualFloatFunction {
Index: solr/src/java/org/apache/solr/search/function/TermFreqValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/TermFreqValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/TermFreqValueSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,10 +17,9 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.*;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.util.BytesRef;
 import org.apache.solr.common.SolrException;
Index: solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/StringIndexDocValues.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,14 +17,15 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSource;
+import org.apache.lucene.queries.function.ValueSourceScorer;
 import org.apache.lucene.search.FieldCache;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
-import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.MutableValueStr;
 import org.apache.solr.util.ByteUtils;
 
Index: solr/src/java/org/apache/solr/search/function/ConstValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/ConstValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/ConstValueSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,9 +17,8 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
 
 import java.io.IOException;
 import java.util.Map;
Index: solr/src/java/org/apache/solr/search/function/LongDocValues.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/LongDocValues.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/LongDocValues.java	(working copy)
@@ -1,6 +1,25 @@
 package org.apache.solr.search.function;
 
-import org.apache.solr.search.MutableValue;
+/*
+ * 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.
+ */
+
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.solr.search.MutableValueLong;
 
 public abstract class LongDocValues extends DocValues {
Index: solr/src/java/org/apache/solr/search/function/ReverseOrdFieldSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/ReverseOrdFieldSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/ReverseOrdFieldSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,10 +17,10 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.FieldCache;
 import org.apache.lucene.util.ReaderUtil;
 
Index: solr/src/java/org/apache/solr/search/function/OrdFieldSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/OrdFieldSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/OrdFieldSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,13 +17,13 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.FieldCache;
 import org.apache.lucene.util.ReaderUtil;
-import org.apache.solr.search.MutableValue;
 import org.apache.solr.search.MutableValueInt;
 
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/search/function/distance/HaversineConstFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/distance/HaversineConstFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/distance/HaversineConstFunction.java	(working copy)
@@ -17,6 +17,8 @@
  */
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.spatial.DistanceUtils;
Index: solr/src/java/org/apache/solr/search/function/distance/VectorDistanceFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/distance/VectorDistanceFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/distance/VectorDistanceFunction.java	(working copy)
@@ -17,13 +17,13 @@
  */
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.spatial.DistanceUtils;
 import org.apache.solr.common.SolrException;
-import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.DoubleDocValues;
 import org.apache.solr.search.function.MultiValueSource;
-import org.apache.solr.search.function.ValueSource;
 
 import java.io.IOException;
 import java.util.Map;
Index: solr/src/java/org/apache/solr/search/function/distance/GeohashFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/distance/GeohashFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/distance/GeohashFunction.java	(working copy)
@@ -16,8 +16,8 @@
  * limitations under the License.
  */
 
-import org.apache.solr.search.function.ValueSource;
-import org.apache.solr.search.function.DocValues;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.spatial.geohash.GeoHashUtils;
 
Index: solr/src/java/org/apache/solr/search/function/distance/SquaredEuclideanFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/distance/SquaredEuclideanFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/distance/SquaredEuclideanFunction.java	(working copy)
@@ -16,8 +16,8 @@
  * limitations under the License.
  */
 
+import org.apache.lucene.queries.function.DocValues;
 import org.apache.lucene.spatial.DistanceUtils;
-import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.MultiValueSource;
 
 
Index: solr/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java	(working copy)
@@ -18,10 +18,10 @@
  */
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.spell.StringDistance;
-import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.FloatDocValues;
-import org.apache.solr.search.function.ValueSource;
 
 import java.io.IOException;
 import java.util.Map;
Index: solr/src/java/org/apache/solr/search/function/distance/GeohashHaversineFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/distance/GeohashHaversineFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/distance/GeohashHaversineFunction.java	(working copy)
@@ -17,10 +17,10 @@
  */
 
 
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.spatial.DistanceUtils;
 import org.apache.solr.search.function.DoubleDocValues;
-import org.apache.solr.search.function.ValueSource;
-import org.apache.solr.search.function.DocValues;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.spatial.geohash.GeoHashUtils;
Index: solr/src/java/org/apache/solr/search/function/distance/HaversineFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/distance/HaversineFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/distance/HaversineFunction.java	(working copy)
@@ -17,13 +17,13 @@
  */
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.spatial.DistanceUtils;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.search.function.DoubleDocValues;
 import org.apache.solr.search.function.MultiValueSource;
-import org.apache.solr.search.function.DocValues;
-import org.apache.solr.search.function.ValueSource;
 
 import java.io.IOException;
 import java.util.Map;
Index: solr/src/java/org/apache/solr/search/function/FunctionQuery.java (deleted)
===================================================================
Index: solr/src/java/org/apache/solr/search/function/FloatDocValues.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/FloatDocValues.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/FloatDocValues.java	(working copy)
@@ -1,8 +1,27 @@
 package org.apache.solr.search.function;
 
-import org.apache.solr.search.MutableValue;
-import org.apache.solr.search.MutableValueFloat;
+/*
+ * 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.
+ */
 
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.MutableValueFloat;
+import org.apache.lucene.queries.function.ValueSource;
+
 public abstract class FloatDocValues extends DocValues {
   protected final ValueSource vs;
 
Index: solr/src/java/org/apache/solr/search/function/IntFieldSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/IntFieldSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/IntFieldSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,13 +17,13 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSourceScorer;
 import org.apache.lucene.util.Bits;
 import org.apache.solr.search.MutableValueInt;
-import org.apache.solr.search.MutableValue;
 import org.apache.lucene.search.cache.IntValuesCreator;
 import org.apache.lucene.search.cache.CachedArray.IntValues;
 
Index: solr/src/java/org/apache/solr/search/function/ReciprocalFloatFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/ReciprocalFloatFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/ReciprocalFloatFunction.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,9 +17,9 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 
 import java.io.IOException;
@@ -25,7 +27,7 @@
 
 /**
  * <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 {@link org.apache.solr.search.function.ValueSource}.
+ * the float value of a field or function as exported by {@link 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.
@@ -37,7 +39,7 @@
  * 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.
  *
- * @see FunctionQuery
+ * @see org.apache.lucene.queries.function.FunctionQuery
  *
  * @version $Id$
  */
Index: solr/src/java/org/apache/solr/search/function/IDFValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/IDFValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/IDFValueSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,10 +17,9 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.*;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Similarity;
 import org.apache.lucene.util.BytesRef;
Index: solr/src/java/org/apache/solr/search/function/ConstNumberSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/ConstNumberSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/ConstNumberSource.java	(working copy)
@@ -1,4 +1,8 @@
-/**
+package org.apache.solr.search.function;
+
+import 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.
@@ -15,8 +19,6 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 /**
  * <code>ConstNumberSource</code> is the base class for all constant numbers
  */
Index: solr/src/java/org/apache/solr/search/function/ValueSourceRangeFilter.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/ValueSourceRangeFilter.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/ValueSourceRangeFilter.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,8 +17,7 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.DocIdSet;
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.IndexSearcher;
Index: solr/src/java/org/apache/solr/search/function/JoinDocFreqValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/JoinDocFreqValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/JoinDocFreqValueSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,13 +17,12 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import java.io.IOException;
 import java.util.Map;
 
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
 import org.apache.lucene.search.FieldCache.DocTerms;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.ReaderUtil;
Index: solr/src/java/org/apache/solr/search/function/DualFloatFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/DualFloatFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/DualFloatFunction.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,9 +17,9 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/search/function/BoostedQuery.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/BoostedQuery.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/BoostedQuery.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,8 +17,8 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.*;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
Index: solr/src/java/org/apache/solr/search/function/SimpleFloatFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/SimpleFloatFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/SimpleFloatFunction.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,9 +17,9 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 
 import java.io.IOException;
 import java.util.Map;
Index: solr/src/java/org/apache/solr/search/function/MultiFloatFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/MultiFloatFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/MultiFloatFunction.java	(working copy)
@@ -17,6 +17,8 @@
  */
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 
 import java.util.Map;
Index: solr/src/java/org/apache/solr/search/function/SingleFunction.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/SingleFunction.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/SingleFunction.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,8 +17,7 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/search/function/TFValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/TFValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/TFValueSource.java	(working copy)
@@ -19,6 +19,7 @@
 
 import org.apache.lucene.index.*;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Similarity;
Index: solr/src/java/org/apache/solr/search/function/FieldCacheSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/FieldCacheSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/FieldCacheSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,8 +17,7 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.FieldCache;
 
 /**
Index: solr/src/java/org/apache/solr/search/function/NormValueSource.java
===================================================================
--- solr/src/java/org/apache/solr/search/function/NormValueSource.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/function/NormValueSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search.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.
@@ -15,9 +17,9 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Similarity;
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/search/MutableValueLong.java
===================================================================
--- solr/src/java/org/apache/solr/search/MutableValueLong.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/MutableValueLong.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search;
+
+/*
  * 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.
@@ -14,8 +16,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.solr.search;
 
+import org.apache.lucene.queries.function.MutableValue;
+
 public class MutableValueLong extends MutableValue {
   public long value;
 
Index: solr/src/java/org/apache/solr/search/ValueSourceParser.java
===================================================================
--- solr/src/java/org/apache/solr/search/ValueSourceParser.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/ValueSourceParser.java	(working copy)
@@ -18,6 +18,8 @@
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.IndexSearcher;
Index: solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java
===================================================================
--- solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java	(working copy)
@@ -1,9 +1,9 @@
 package org.apache.solr.search;
 
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.*;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.common.SolrException;
 
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/search/FunctionRangeQParserPlugin.java
===================================================================
--- solr/src/java/org/apache/solr/search/FunctionRangeQParserPlugin.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/FunctionRangeQParserPlugin.java	(working copy)
@@ -16,6 +16,8 @@
  */
 package org.apache.solr.search;
 
+import org.apache.lucene.queries.function.FunctionQuery;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.Query;
 import org.apache.solr.common.params.SolrParams;
Index: solr/src/java/org/apache/solr/search/MutableValueDouble.java
===================================================================
--- solr/src/java/org/apache/solr/search/MutableValueDouble.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/MutableValueDouble.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search;
+
+/*
  * 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.
@@ -14,8 +16,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.solr.search;
 
+import org.apache.lucene.queries.function.MutableValue;
+
 public class MutableValueDouble extends MutableValue {
   public double value;
 
Index: solr/src/java/org/apache/solr/search/FunctionQParser.java
===================================================================
--- solr/src/java/org/apache/solr/search/FunctionQParser.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/FunctionQParser.java	(working copy)
@@ -16,6 +16,8 @@
  */
 package org.apache.solr.search;
 
+import org.apache.lucene.queries.function.FunctionQuery;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.Query;
 import org.apache.solr.common.params.SolrParams;
Index: solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java
===================================================================
--- solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java	(working copy)
@@ -22,6 +22,8 @@
 
 package org.apache.solr.search;
 
+import org.apache.lucene.queries.function.FunctionQuery;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.queryParser.QueryParser;
 import org.apache.lucene.search.*;
@@ -35,10 +37,8 @@
 import org.apache.solr.schema.FieldType;
 import org.apache.solr.search.QueryUtils;
 import org.apache.solr.search.function.BoostedQuery;
-import org.apache.solr.search.function.FunctionQuery;
 import org.apache.solr.search.function.ProductFloatFunction;
 import org.apache.solr.search.function.QueryValueSource;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.util.SolrPluginUtils;
 import org.apache.solr.analysis.*;
 
Index: solr/src/java/org/apache/solr/search/QueryParsing.java
===================================================================
--- solr/src/java/org/apache/solr/search/QueryParsing.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/QueryParsing.java	(working copy)
@@ -18,6 +18,7 @@
 package org.apache.solr.search;
 
 import org.apache.lucene.index.Term;
+import org.apache.lucene.queries.function.FunctionQuery;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.queryParser.QueryParser.Operator;
 import org.apache.lucene.search.BooleanClause;
@@ -41,7 +42,6 @@
 import org.apache.solr.schema.FieldType;
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.SchemaField;
-import org.apache.solr.search.function.FunctionQuery;
 import org.apache.solr.search.function.QueryValueSource;
 import java.io.IOException;
 import java.util.ArrayList;
Index: solr/src/java/org/apache/solr/search/NestedQParserPlugin.java
===================================================================
--- solr/src/java/org/apache/solr/search/NestedQParserPlugin.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/NestedQParserPlugin.java	(working copy)
@@ -16,12 +16,12 @@
  */
 package org.apache.solr.search;
 
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.Query;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.search.function.ValueSource;
 
 /**
  * Create a nested query, with the ability of that query to redefine it's type via
Index: solr/src/java/org/apache/solr/search/MutableValueInt.java
===================================================================
--- solr/src/java/org/apache/solr/search/MutableValueInt.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/MutableValueInt.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search;
+
+/*
  * 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.
@@ -14,8 +16,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.solr.search;
 
+import org.apache.lucene.queries.function.MutableValue;
+
 public class MutableValueInt extends MutableValue {
   public int value;
   
Index: solr/src/java/org/apache/solr/search/ReturnFields.java
===================================================================
--- solr/src/java/org/apache/solr/search/ReturnFields.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/ReturnFields.java	(working copy)
@@ -23,6 +23,8 @@
 import java.util.Set;
 
 import org.apache.commons.io.FilenameUtils;
+import org.apache.lucene.queries.function.FunctionQuery;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.Query;
 import org.apache.solr.common.SolrException;
@@ -37,9 +39,7 @@
 import org.apache.solr.response.transform.ScoreAugmenter;
 import org.apache.solr.response.transform.TransformerFactory;
 import org.apache.solr.response.transform.ValueSourceAugmenter;
-import org.apache.solr.search.function.FunctionQuery;
 import org.apache.solr.search.function.QueryValueSource;
-import org.apache.solr.search.function.ValueSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
Index: solr/src/java/org/apache/solr/search/MutableValueFloat.java (deleted)
===================================================================
Index: solr/src/java/org/apache/solr/search/MutableValueStr.java
===================================================================
--- solr/src/java/org/apache/solr/search/MutableValueStr.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/MutableValueStr.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search;
+
+/*
  * 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.
@@ -14,8 +16,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.solr.search;
 
+import org.apache.lucene.queries.function.MutableValue;
 import org.apache.lucene.util.BytesRef;
 import org.apache.solr.util.ByteUtils;
 
Index: solr/src/java/org/apache/solr/search/MutableValueDate.java
===================================================================
--- solr/src/java/org/apache/solr/search/MutableValueDate.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/MutableValueDate.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package org.apache.solr.search;
+
+/*
  * 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.
@@ -14,8 +16,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.solr.search;
 
+import org.apache.lucene.queries.function.MutableValue;
+
 import java.util.Date;
 
 public class MutableValueDate extends MutableValueLong {
Index: solr/src/java/org/apache/solr/search/MutableValue.java (deleted)
===================================================================
Index: solr/src/java/org/apache/solr/search/Grouping.java
===================================================================
--- solr/src/java/org/apache/solr/search/Grouping.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/search/Grouping.java	(working copy)
@@ -18,14 +18,15 @@
 package org.apache.solr.search;
 
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.MutableValue;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.*;
 import org.apache.lucene.util.BytesRef;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.SimpleOrderedMap;
 import org.apache.solr.schema.StrFieldSource;
-import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.StringIndexDocValues;
-import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.util.SentinelIntSet;
 
 import java.io.IOException;
Index: solr/src/java/org/apache/solr/handler/component/QueryComponent.java
===================================================================
--- solr/src/java/org/apache/solr/handler/component/QueryComponent.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/handler/component/QueryComponent.java	(working copy)
@@ -21,6 +21,7 @@
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.index.IndexReader.ReaderContext;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.queries.function.FunctionQuery;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.*;
 import org.apache.lucene.util.BytesRef;
@@ -44,7 +45,6 @@
 import org.apache.solr.schema.FieldType;
 import org.apache.solr.schema.SchemaField;
 import org.apache.solr.search.*;
-import org.apache.solr.search.function.FunctionQuery;
 import org.apache.solr.search.function.QueryValueSource;
 import org.apache.solr.util.SolrPluginUtils;
 
Index: solr/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java
===================================================================
--- solr/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java	(revision 1104714)
+++ solr/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java	(working copy)
@@ -17,14 +17,14 @@
 package org.apache.solr.response.transform;
 
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.queries.function.DocValues;
+import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.util.ReaderUtil;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.SolrIndexSearcher;
-import org.apache.solr.search.function.DocValues;
-import org.apache.solr.search.function.ValueSource;
 
 import java.io.IOException;
 import java.util.Map;
Index: modules/queries/src/java/org/apache/lucene/queries/function/DocValues.java
===================================================================
--- modules/queries/src/java/org/apache/lucene/queries/function/DocValues.java	(revision 0)
+++ modules/queries/src/java/org/apache/lucene/queries/function/DocValues.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package 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.
@@ -15,13 +17,9 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.search.*;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.util.BytesRef;
-import org.apache.solr.search.MutableValue;
-import org.apache.solr.search.MutableValueFloat;
 
 /**
  * Represents field values as different types.
Index: modules/queries/src/java/org/apache/lucene/queries/function/MutableValue.java
===================================================================
--- modules/queries/src/java/org/apache/lucene/queries/function/MutableValue.java	(revision 0)
+++ modules/queries/src/java/org/apache/lucene/queries/function/MutableValue.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package 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.
@@ -14,7 +16,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.solr.search;
 
 /** @lucene.internal */
 public abstract class MutableValue implements Comparable {
Index: modules/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java
===================================================================
--- modules/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java	(revision 0)
+++ modules/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package 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.
@@ -15,8 +17,6 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.search.*;
Index: modules/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java
===================================================================
--- modules/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java	(revision 0)
+++ modules/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java	(revision 0)
@@ -0,0 +1,86 @@
+package 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.
+ */
+
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.MultiFields;
+import org.apache.lucene.search.Scorer;
+import org.apache.lucene.util.Bits;
+
+import java.io.IOException;
+
+public class ValueSourceScorer extends Scorer {
+
+  protected IndexReader reader;
+  private int doc = -1;
+  protected final int maxDoc;
+  protected final DocValues values;
+  protected boolean checkDeletes;
+  private final Bits delDocs;
+
+  protected ValueSourceScorer(IndexReader reader, DocValues values) {
+    super(null);
+    this.reader = reader;
+    this.maxDoc = reader.maxDoc();
+    this.values = values;
+    setCheckDeletes(true);
+    this.delDocs = MultiFields.getDeletedDocs(reader);
+  }
+
+  public IndexReader getReader() {
+    return reader;
+  }
+
+  public void setCheckDeletes(boolean checkDeletes) {
+    this.checkDeletes = checkDeletes && reader.hasDeletions();
+  }
+
+  public boolean matches(int doc) {
+    return (!checkDeletes || !delDocs.get(doc)) && matchesValue(doc);
+  }
+
+  public boolean matchesValue(int doc) {
+    return true;
+  }
+
+  @Override
+  public int docID() {
+    return doc;
+  }
+
+  @Override
+  public int nextDoc() throws IOException {
+    for (; ;) {
+      doc++;
+      if (doc >= maxDoc) return doc = NO_MORE_DOCS;
+      if (matches(doc)) return doc;
+    }
+  }
+
+  @Override
+  public int advance(int target) throws IOException {
+    // also works fine when target==NO_MORE_DOCS
+    doc = target - 1;
+    return nextDoc();
+  }
+
+  @Override
+  public float score() throws IOException {
+    return values.floatVal(doc);
+  }
+}
Index: modules/queries/src/java/org/apache/lucene/queries/function/MutableValueFloat.java
===================================================================
--- modules/queries/src/java/org/apache/lucene/queries/function/MutableValueFloat.java	(revision 0)
+++ modules/queries/src/java/org/apache/lucene/queries/function/MutableValueFloat.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package 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.
@@ -14,7 +16,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.solr.search;
 
 public class MutableValueFloat extends MutableValue {
   public float value;
Index: modules/queries/src/java/org/apache/lucene/queries/function/ValueSource.java
===================================================================
--- modules/queries/src/java/org/apache/lucene/queries/function/ValueSource.java	(revision 0)
+++ modules/queries/src/java/org/apache/lucene/queries/function/ValueSource.java	(working copy)
@@ -1,4 +1,6 @@
-/**
+package 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.
@@ -15,8 +17,6 @@
  * limitations under the License.
  */
 
-package org.apache.solr.search.function;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.search.FieldComparator;
@@ -26,8 +26,6 @@
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.index.MultiFields;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.search.SolrSortField;
 
 import java.io.IOException;
 import java.io.Serializable;
@@ -35,7 +33,7 @@
 import java.util.Map;
 
 /**
- * Instantiates {@link org.apache.solr.search.function.DocValues} for a particular reader.
+ * Instantiates {@link org.apache.lucene.queries.function.DocValues} for a particular reader.
  * <br>
  * Often used when creating a {@link FunctionQuery}.
  *
@@ -99,46 +97,47 @@
    * @throws IOException if there was a problem reading the values.
    */
   public SortField getSortField(boolean reverse) throws IOException {
-    return new ValueSourceSortField(reverse);
+//    return new ValueSourceSortField(reverse); // nocommit Decide what to return here
+      return null;
   }
 
-  private static FieldComparatorSource dummyComparator = new FieldComparatorSource() {
-    @Override
-    public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
-      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unweighted use of sort " + fieldname);
-    }
-  };
+//  private static FieldComparatorSource dummyComparator = new FieldComparatorSource() {
+//    @Override
+//    public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
+//      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unweighted use of sort " + fieldname);
+//    }
+//  };
+//
+//  class ValueSourceSortField extends SortField implements SolrSortField { // nocommit Decide how to handle SolrSortField
+//    public ValueSourceSortField(boolean reverse) {
+//      super(description(), dummyComparator, reverse);
+//    }
+//
+//    @Override
+//    public SortField weight(IndexSearcher searcher) throws IOException {
+//      Map context = newContext(searcher);
+//      createWeight(context, searcher);
+//      return new SortField(getField(), new ValueSourceComparatorSource(context), getReverse());
+//    }
+//  }
+//
+//  class ValueSourceComparatorSource extends FieldComparatorSource {
+//    private final Map context;
+//
+//    public ValueSourceComparatorSource(Map context) {
+//      this.context = context;
+//    }
+//
+//    @Override
+//    public FieldComparator newComparator(String fieldname, int numHits,
+//                                         int sortPos, boolean reversed) throws IOException {
+//      return new ValueSourceComparator(context, numHits);
+//    }
+//  }
 
-  class ValueSourceSortField extends SortField implements SolrSortField {
-    public ValueSourceSortField(boolean reverse) {
-      super(description(), dummyComparator, reverse);
-    }
-
-    @Override
-    public SortField weight(IndexSearcher searcher) throws IOException {
-      Map context = newContext(searcher);
-      createWeight(context, searcher);
-      return new SortField(getField(), new ValueSourceComparatorSource(context), getReverse());
-    }
-  }
-
-  class ValueSourceComparatorSource extends FieldComparatorSource {
-    private final Map context;
-
-    public ValueSourceComparatorSource(Map context) {
-      this.context = context;
-    }
-
-    @Override
-    public FieldComparator newComparator(String fieldname, int numHits,
-                                         int sortPos, boolean reversed) throws IOException {
-      return new ValueSourceComparator(context, numHits);
-    }
-  }
-
   /**
    * Implement a {@link org.apache.lucene.search.FieldComparator} that works
-   * off of the {@link org.apache.solr.search.function.DocValues} for a ValueSource
+   * off of the {@link org.apache.lucene.queries.function.DocValues} for a ValueSource
    * instead of the normal Lucene FieldComparator that works off of a FieldCache.
    */
   class ValueSourceComparator extends FieldComparator {
@@ -202,64 +201,3 @@
 }
 
 
-class ValueSourceScorer extends Scorer {
-  protected IndexReader reader;
-  private int doc = -1;
-  protected final int maxDoc;
-  protected final DocValues values;
-  protected boolean checkDeletes;
-  private final Bits delDocs;
-
-  protected ValueSourceScorer(IndexReader reader, DocValues values) {
-    super(null);
-    this.reader = reader;
-    this.maxDoc = reader.maxDoc();
-    this.values = values;
-    setCheckDeletes(true);
-    this.delDocs = MultiFields.getDeletedDocs(reader);
-  }
-
-  public IndexReader getReader() {
-    return reader;
-  }
-
-  public void setCheckDeletes(boolean checkDeletes) {
-    this.checkDeletes = checkDeletes && reader.hasDeletions();
-  }
-
-  public boolean matches(int doc) {
-    return (!checkDeletes || !delDocs.get(doc)) && matchesValue(doc);
-  }
-
-  public boolean matchesValue(int doc) {
-    return true;
-  }
-
-  @Override
-  public int docID() {
-    return doc;
-  }
-
-  @Override
-  public int nextDoc() throws IOException {
-    for (; ;) {
-      doc++;
-      if (doc >= maxDoc) return doc = NO_MORE_DOCS;
-      if (matches(doc)) return doc;
-    }
-  }
-
-  @Override
-  public int advance(int target) throws IOException {
-    // also works fine when target==NO_MORE_DOCS
-    doc = target - 1;
-    return nextDoc();
-  }
-
-  @Override
-  public float score() throws IOException {
-    return values.floatVal(doc);
-  }
-}
-
-
Index: modules/queries/build.xml
===================================================================
--- modules/queries/build.xml	(revision 0)
+++ modules/queries/build.xml	(revision 0)
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<project name="queries-module" default="default">
+    <description>
+        Useful Queries such as Function Queries
+    </description>
+
+    <property name="build.dir" location="build/" />
+    <property name="dist.dir" location="dist/" />
+    <property name="maven.dist.dir" location="../dist/maven" />
+
+    <import file="../../lucene/contrib/contrib-build.xml"/>
+
+    <target name="dist-maven" depends="jar-core,javadocs,contrib-build.dist-maven" />
+</project>
Index: modules/build.xml
===================================================================
--- modules/build.xml	(revision 1104714)
+++ modules/build.xml	(working copy)
@@ -25,6 +25,7 @@
         <fileset dir="analysis" includes="build.xml" />
         <fileset dir="benchmark" includes="build.xml" />
         <fileset dir="grouping" includes="build.xml" />
+        <fileset dir="queries" includes="build.xml"/>
       </subant>
     </sequential>
   </target>
@@ -35,6 +36,7 @@
         <fileset dir="analysis" includes="build.xml" />
         <fileset dir="benchmark" includes="build.xml" />
         <fileset dir="grouping" includes="build.xml" />
+        <fileset dir="queries" includes="build.xml"/>
       </subant>
     </sequential>
   </target>
@@ -45,6 +47,7 @@
         <fileset dir="analysis" includes="build.xml" />
         <fileset dir="benchmark" includes="build.xml" />
         <fileset dir="grouping" includes="build.xml" />
+        <fileset dir="queries" includes="build.xml"/>
       </subant>
     </sequential>
   </target>
@@ -55,6 +58,7 @@
         <fileset dir="analysis" includes="build.xml" />
         <fileset dir="benchmark" includes="build.xml" />
         <fileset dir="grouping" includes="build.xml" />
+        <fileset dir="queries" includes="build.xml"/>
       </subant>
     </sequential>
   </target>
@@ -96,6 +100,7 @@
         <fileset dir="analysis" includes="build.xml" />
         <fileset dir="benchmark" includes="build.xml" />
         <fileset dir="grouping" includes="build.xml" />
+        <fileset dir="queries" includes="build.xml"/> 
       </subant>
     </sequential>
   </target>
