You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2014/11/07 04:59:48 UTC

[1/5] lucenenet git commit: Various fixes

Repository: lucenenet
Updated Branches:
  refs/heads/master b5afe7645 -> e07d11372


Various fixes


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

Branch: refs/heads/master
Commit: bf7317d282aba8093d56b646b1e622b4ed19e7d5
Parents: b5afe76
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Wed Nov 5 20:10:13 2014 +0200
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Wed Nov 5 20:10:13 2014 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Queries/Function/ValueSource.cs               | 6 +++---
 .../Function/ValueSources/ConstNumberSource.cs               | 2 +-
 .../Function/ValueSources/ConstValueSource.cs                | 8 --------
 .../Function/ValueSources/DoubleConstValueSource.cs          | 8 --------
 .../Function/ValueSources/OrdFieldSource.cs                  | 4 ++--
 .../Function/ValueSources/SimpleBoolFunction.cs              | 2 +-
 6 files changed, 7 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bf7317d2/src/Lucene.Net.Queries/Function/ValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSource.cs
index 0f8ed03..ccfdc59 100644
--- a/src/Lucene.Net.Queries/Function/ValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSource.cs
@@ -123,7 +123,7 @@ namespace Lucene.Net.Queries.Function
                 this.context = context;
             }
 
-            public override FieldComparator<double?> NewComparator(string fieldname, int numHits, int sortPos, bool reversed)
+            public override FieldComparator NewComparator(string fieldname, int numHits, int sortPos, bool reversed)
             {
                 return new ValueSourceComparator(outerInstance, context, numHits);
             }
@@ -180,7 +180,7 @@ namespace Lucene.Net.Queries.Function
                 }
             }
 
-            public override double? TopValue
+            public override object TopValue
             {
                 set
                 {
@@ -188,7 +188,7 @@ namespace Lucene.Net.Queries.Function
                 }
             }
 
-            public override double? Value(int slot)
+            public override IComparable Value(int slot)
             {
                 return values[slot];
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bf7317d2/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs
index d208c92..2f30fc6 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ConstNumberSource.cs
@@ -29,7 +29,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
         public abstract long Long { get; }
         public abstract float Float { get; }
         public abstract double Double { get; }
-        public abstract Number Number { get; }
+        //public abstract Number Number { get; }
         public abstract bool Bool { get; }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bf7317d2/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs
index e27c869..adc2bf0 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs
@@ -132,14 +132,6 @@ namespace Lucene.Net.Queries.Function.ValueSources
             }
         }
 
-        public override Number Number
-        {
-            get
-            {
-                return constant;
-            }
-        }
-
         public override bool Bool
         {
             get

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bf7317d2/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs
index 6e468ec..52cb8ca 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs
@@ -141,14 +141,6 @@ namespace Lucene.Net.Queries.Function.ValueSources
             }
         }
 
-        public override Number Number
-        {
-            get
-            {
-                return constant;
-            }
-        }
-
         public override bool Bool
         {
             get

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bf7317d2/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
index 93eecab..e229479 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
@@ -66,7 +66,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
             return new IntDocValuesAnonymousInnerClassHelper(this, this, off, sindex);
         }
 
-        private class IntDocValuesAnonymousInnerClassHelper : IntDocValues
+        private sealed class IntDocValuesAnonymousInnerClassHelper : IntDocValues
         {
             private readonly OrdFieldSource outerInstance;
 
@@ -81,7 +81,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
                 this.sindex = sindex;
             }
 
-            protected virtual string ToTerm(string readableValue)
+            private string ToTerm(string readableValue)
             {
                 return readableValue;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bf7317d2/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs
index eab3ac6..3e59f6e 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SimpleBoolFunction.cs
@@ -51,7 +51,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
         {
             private readonly SimpleBoolFunction outerInstance;
 
-            private FunctionValues vals;
+            private readonly FunctionValues vals;
 
             public BoolDocValuesAnonymousInnerClassHelper(SimpleBoolFunction outerInstance, SimpleBoolFunction @this, FunctionValues vals)
                 : base(@this)


[3/5] lucenenet git commit: Lucene.NET to target .NET 4.5.1

Posted by sy...@apache.org.
Lucene.NET to target .NET 4.5.1


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

Branch: refs/heads/master
Commit: 42bbbba295a292623b3ff9244021cff6b3184056
Parents: 051b0ef
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Fri Nov 7 05:51:57 2014 +0200
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Fri Nov 7 05:51:57 2014 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Core/Lucene.Net.csproj                       | 9 ++++++---
 src/Lucene.Net.Queries/Lucene.Net.Queries.csproj            | 5 ++++-
 .../Lucene.Net.TestFramework.csproj                         | 4 ++--
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj                | 7 +++++--
 4 files changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/42bbbba2/src/Lucene.Net.Core/Lucene.Net.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.csproj b/src/Lucene.Net.Core/Lucene.Net.csproj
index 23c6695..21b0f92 100644
--- a/src/Lucene.Net.Core/Lucene.Net.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.csproj
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@@ -7,8 +7,9 @@
     <OutputType>Library</OutputType>
     <NoStandardLibraries>false</NoStandardLibraries>
     <AssemblyName>Lucene.Net</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
-    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
     <FileAlignment>512</FileAlignment>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -20,6 +21,7 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <PlatformTarget>AnyCPU</PlatformTarget>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     <DebugType>pdbonly</DebugType>
@@ -29,6 +31,7 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <PlatformTarget>x86</PlatformTarget>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup>
     <RootNamespace>Lucene.Net</RootNamespace>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/42bbbba2/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj b/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
index 9818bc3..4755eab 100644
--- a/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
+++ b/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
@@ -9,8 +9,9 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>Lucene.Net.Queries</RootNamespace>
     <AssemblyName>Lucene.Net.Queries</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -20,6 +21,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
@@ -28,6 +30,7 @@
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/42bbbba2/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
index 8c5de08..7680987 100644
--- a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
+++ b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -9,7 +9,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>Lucene.Net</RootNamespace>
     <AssemblyName>Lucene.Net.TestFramework</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <TargetFrameworkProfile>
     </TargetFrameworkProfile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/42bbbba2/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index ed7da32..5b57114 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -7,8 +7,9 @@
     <OutputType>Library</OutputType>
     <NoStandardLibraries>false</NoStandardLibraries>
     <AssemblyName>Lucene.Net.Tests</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -19,6 +20,7 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <PlatformTarget>AnyCPU</PlatformTarget>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
@@ -27,6 +29,7 @@
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup>
     <RootNamespace>Lucene.Net.Tests</RootNamespace>


[4/5] lucenenet git commit: Various

Posted by sy...@apache.org.
Various


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

Branch: refs/heads/master
Commit: a37fd3810e630560f209175bb5897975c21c57a2
Parents: 42bbbba
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Fri Nov 7 05:56:10 2014 +0200
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Fri Nov 7 05:56:10 2014 +0200

----------------------------------------------------------------------
 .../Codecs/Lucene40/Lucene40FieldInfosReader.cs |  2 +-
 src/Lucene.Net.Core/Index/BufferedUpdates.cs    |  3 +-
 src/Lucene.Net.Core/Search/Query.cs             | 30 +++++++-------------
 src/Lucene.Net.Core/Support/HashMap.cs          |  2 +-
 src/Lucene.Net.Core/Support/Number.cs           | 12 ++++++++
 src/Lucene.Net.Core/Support/WeakDictionary.cs   |  2 +-
 src/Lucene.Net.Core/Util/RamUsageEstimator.cs   |  2 +-
 src/Lucene.Net.Queries/CustomScoreQuery.cs      |  6 ++--
 src/Lucene.Net.Queries/Function/BoostedQuery.cs |  4 +--
 .../Lucene.Net.Queries.csproj                   |  4 ---
 10 files changed, 31 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a37fd381/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40FieldInfosReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40FieldInfosReader.cs b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40FieldInfosReader.cs
index 2941740..d5ac8c3 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40FieldInfosReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40FieldInfosReader.cs
@@ -188,7 +188,7 @@ namespace Lucene.Net.Codecs.Lucene40
                 {"BYTES_VAR_SORTED", BYTES_VAR_SORTED}
             };
 
-            public static readonly IDictionary<string, int> ordinalLookup = new HashMap<string, int>() {
+            public static readonly IDictionary<string, int> ordinalLookup = new HashMap<string, int>(14) {
                 {"NONE", 0},
                 {"VAR_INTS", 1},
                 {"FLOAT_32", 2},

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a37fd381/src/Lucene.Net.Core/Index/BufferedUpdates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/BufferedUpdates.cs b/src/Lucene.Net.Core/Index/BufferedUpdates.cs
index 383b6ff..2d507d3 100644
--- a/src/Lucene.Net.Core/Index/BufferedUpdates.cs
+++ b/src/Lucene.Net.Core/Index/BufferedUpdates.cs
@@ -246,8 +246,7 @@ namespace Lucene.Net.Index
 
         public virtual void AddNumericUpdate(NumericDocValuesUpdate update, int docIDUpto)
         {
-            /*Linked*/
-            HashMap<Term, NumericDocValuesUpdate> fieldUpdates;
+            /*Linked*/HashMap<Term, NumericDocValuesUpdate> fieldUpdates;
             if (!NumericUpdates.TryGetValue(update.Field, out fieldUpdates))
             {
                 fieldUpdates = new /*Linked*/HashMap<Term, NumericDocValuesUpdate>();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a37fd381/src/Lucene.Net.Core/Search/Query.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Query.cs b/src/Lucene.Net.Core/Search/Query.cs
index 6111cba..7ff1367 100644
--- a/src/Lucene.Net.Core/Search/Query.cs
+++ b/src/Lucene.Net.Core/Search/Query.cs
@@ -48,24 +48,17 @@ namespace Lucene.Net.Search
     /// </summary>
     public abstract class Query : ICloneable
     {
-        private float boost = 1.0f; // query boost factor
+        protected Query()
+        {
+            Boost = 1.0f; // query boost factor
+        }
 
         /// <summary>
         /// Sets the boost for this query clause to <code>b</code>.  Documents
         /// matching this clause will (in addition to the normal weightings) have
         /// their score multiplied by <code>b</code>.
         /// </summary>
-        public virtual float Boost
-        {
-            set
-            {
-                boost = value;
-            }
-            get
-            {
-                return boost;
-            }
-        }
+        public float Boost { get; set; }
 
         /// <summary>
         /// Prints a query to a string, with <code>field</code> assumed to be the
@@ -130,7 +123,7 @@ namespace Lucene.Net.Search
         {
             const int prime = 31;
             int result = 1;
-            result = prime * result + Number.FloatToIntBits(boost);
+            result = prime * result + Number.FloatToIntBits(Boost);
             return result;
         }
 
@@ -140,16 +133,13 @@ namespace Lucene.Net.Search
             {
                 return true;
             }
-            if (obj == null)
-            {
-                return false;
-            }
-            if (this.GetType() != obj.GetType())
+            var other = obj as Query;
+            if (other == null)
             {
                 return false;
             }
-            var other = (Query)obj;
-            if (Number.FloatToIntBits(boost) != Number.FloatToIntBits(other.boost))
+           
+            if (Number.FloatToIntBits(Boost) != Number.FloatToIntBits(other.Boost))
             {
                 return false;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a37fd381/src/Lucene.Net.Core/Support/HashMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/HashMap.cs b/src/Lucene.Net.Core/Support/HashMap.cs
index 766447c..addd506 100644
--- a/src/Lucene.Net.Core/Support/HashMap.cs
+++ b/src/Lucene.Net.Core/Support/HashMap.cs
@@ -65,7 +65,7 @@ namespace Lucene.Net.Support
         private TValue _nullValue;
 
         // Indicates the type of key is a non-nullable valuetype
-        private bool _isValueType;
+        private readonly bool _isValueType;
 
         public HashMap()
             : this(0)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a37fd381/src/Lucene.Net.Core/Support/Number.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Number.cs b/src/Lucene.Net.Core/Support/Number.cs
index 2738278..13bf69e 100644
--- a/src/Lucene.Net.Core/Support/Number.cs
+++ b/src/Lucene.Net.Core/Support/Number.cs
@@ -416,8 +416,15 @@ namespace Lucene.Net.Support
             return BitConverter.ToSingle(BitConverter.GetBytes(value), 0);
         }
 
+        public static int FloatToRawIntBits(float value)
+        {
+            // TODO: does this handle NaNs the same?
+            return BitConverter.ToInt32(BitConverter.GetBytes(value), 0);
+        }
+
         public static int FloatToIntBits(float value)
         {
+            // TODO it is claimed that this could be faster
             return BitConverter.ToInt32(BitConverter.GetBytes(value), 0);
         }
 
@@ -426,6 +433,11 @@ namespace Lucene.Net.Support
             return BitConverter.ToInt64(BitConverter.GetBytes(value), 0);
         }
 
+        public static long DoubleToRawLongBits(double value)
+        {
+            return BitConverter.DoubleToInt64Bits(value);
+        }
+
         //Flips the endianness from Little-Endian to Big-Endian
 
         //2 bytes

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a37fd381/src/Lucene.Net.Core/Support/WeakDictionary.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/WeakDictionary.cs b/src/Lucene.Net.Core/Support/WeakDictionary.cs
index a5e78b8..454d4df 100644
--- a/src/Lucene.Net.Core/Support/WeakDictionary.cs
+++ b/src/Lucene.Net.Core/Support/WeakDictionary.cs
@@ -55,7 +55,7 @@ namespace Lucene.Net.Support
         private void Clean()
         {
             if (_hm.Count == 0) return;
-            var newHm = new HashMap<WeakKey<TKey>, TValue>();
+            var newHm = new HashMap<WeakKey<TKey>, TValue>(_hm.Count);
             foreach (var entry in _hm.Where(x => x.Key != null && x.Key.IsAlive))
             {
                 newHm.Add(entry.Key, entry.Value);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a37fd381/src/Lucene.Net.Core/Util/RamUsageEstimator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/RamUsageEstimator.cs b/src/Lucene.Net.Core/Util/RamUsageEstimator.cs
index dae6329..d3f289b 100644
--- a/src/Lucene.Net.Core/Util/RamUsageEstimator.cs
+++ b/src/Lucene.Net.Core/Util/RamUsageEstimator.cs
@@ -93,7 +93,7 @@ namespace Lucene.Net.Util
 
         static RamUsageEstimator()
         {
-            PrimitiveSizes = new HashMap<Type, int>();
+            PrimitiveSizes = new HashMap<Type, int>(8);
             PrimitiveSizes[typeof(bool)] = Convert.ToInt32(NUM_BYTES_BOOLEAN);
             PrimitiveSizes[typeof(sbyte)] = Convert.ToInt32(NUM_BYTES_BYTE);
             PrimitiveSizes[typeof(char)] = Convert.ToInt32(NUM_BYTES_CHAR);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a37fd381/src/Lucene.Net.Queries/CustomScoreQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/CustomScoreQuery.cs b/src/Lucene.Net.Queries/CustomScoreQuery.cs
index 490d351..a408361 100644
--- a/src/Lucene.Net.Queries/CustomScoreQuery.cs
+++ b/src/Lucene.Net.Queries/CustomScoreQuery.cs
@@ -83,7 +83,7 @@ namespace Lucene.Net.Queries
             Query sq = subQuery.Rewrite(reader);
             if (sq != subQuery)
             {
-                clone = Clone();
+                clone = (CustomScoreQuery)Clone();
                 clone.subQuery = sq;
             }
 
@@ -94,7 +94,7 @@ namespace Lucene.Net.Queries
                 {
                     if (clone == null)
                     {
-                        clone = Clone();
+                        clone = (CustomScoreQuery)Clone();
                     }
                     clone.scoringQueries[i] = v;
                 }
@@ -224,7 +224,7 @@ namespace Lucene.Net.Queries
                     {
                         if (qStrict)
                         {
-                            valSrcWeight.ValueForNormalization;
+                            var _ = valSrcWeight.ValueForNormalization;
                                 // do not include ValueSource part in the query normalization
                         }
                         else

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a37fd381/src/Lucene.Net.Queries/Function/BoostedQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/BoostedQuery.cs b/src/Lucene.Net.Queries/Function/BoostedQuery.cs
index 1798987..fc078c7 100644
--- a/src/Lucene.Net.Queries/Function/BoostedQuery.cs
+++ b/src/Lucene.Net.Queries/Function/BoostedQuery.cs
@@ -134,7 +134,7 @@ namespace Lucene.Net.Queries.Function
             public override Explanation Explain(AtomicReaderContext readerContext, int doc)
             {
                 Explanation subQueryExpl = qWeight.Explain(readerContext, doc);
-                if (!subQueryExpl.Match)
+                if (!subQueryExpl.IsMatch)
                 {
                     return subQueryExpl;
                 }
@@ -207,8 +207,6 @@ namespace Lucene.Net.Queries.Function
                 }
             }
 
-            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-            //ORIGINAL LINE: public Explanation explain(int doc) throws java.io.IOException
             public virtual Explanation explain(int doc)
             {
                 Explanation subQueryExpl = weight.qWeight.Explain(readerContext, doc);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a37fd381/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj b/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
index 4755eab..e44d734 100644
--- a/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
+++ b/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
@@ -35,11 +35,7 @@
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="BooleanFilter.cs" />


[5/5] lucenenet git commit: Start bringing in BCL bits to reuse available bits

Posted by sy...@apache.org.
Start bringing in BCL bits to reuse available bits


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

Branch: refs/heads/master
Commit: e07d113722767b141d986ed0c2f73daf2e792198
Parents: a37fd38
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Fri Nov 7 05:59:40 2014 +0200
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Fri Nov 7 05:59:40 2014 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Core/Lucene.Net.csproj                  |  4 ++++
 .../Support/Compatibility/Collections.cs               | 13 +++++++++++++
 src/Lucene.Net.Core/packages.config                    |  1 +
 3 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e07d1137/src/Lucene.Net.Core/Lucene.Net.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.csproj b/src/Lucene.Net.Core/Lucene.Net.csproj
index 21b0f92..58a6c8a 100644
--- a/src/Lucene.Net.Core/Lucene.Net.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.csproj
@@ -45,6 +45,9 @@
     </Reference>
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System" />
+    <Reference Include="System.Collections.Immutable">
+      <HintPath>..\..\packages\Microsoft.Bcl.Immutable.1.0.34\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
+    </Reference>
     <Reference Include="System.configuration" />
     <Reference Include="System.Core" />
     <Reference Include="System.Data" />
@@ -614,6 +617,7 @@
     <Compile Include="Support\ByteBuffer.cs" />
     <Compile Include="Support\Character.cs" />
     <Compile Include="Support\Arrays.cs" />
+    <Compile Include="Support\Compatibility\Collections.cs" />
     <Compile Include="Support\ConcurrentHashMap.cs" />
     <Compile Include="Support\ConcurrentHashMapWrapper.cs" />
     <Compile Include="Support\ConcurrentHashSet.cs" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e07d1137/src/Lucene.Net.Core/Support/Compatibility/Collections.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Compatibility/Collections.cs b/src/Lucene.Net.Core/Support/Compatibility/Collections.cs
new file mode 100644
index 0000000..96511b7
--- /dev/null
+++ b/src/Lucene.Net.Core/Support/Compatibility/Collections.cs
@@ -0,0 +1,13 @@
+using System.Collections.Generic;
+using System.Collections.Immutable;
+
+namespace Lucene.Net
+{
+    public static class Collections
+    {
+        public static ISet<T> Singleton<T>(T o)
+        {
+            return ImmutableHashSet.Create(o);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e07d1137/src/Lucene.Net.Core/packages.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/packages.config b/src/Lucene.Net.Core/packages.config
index a0606b4..40ec27e 100644
--- a/src/Lucene.Net.Core/packages.config
+++ b/src/Lucene.Net.Core/packages.config
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
+  <package id="Microsoft.Bcl.Immutable" version="1.0.34" targetFramework="net451" />
   <package id="SharpZipLib" version="0.86.0" targetFramework="net40-Client" />
 </packages>
\ No newline at end of file


[2/5] lucenenet git commit: Some files cleanup

Posted by sy...@apache.org.
Some files cleanup


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

Branch: refs/heads/master
Commit: 051b0ef091364b0d9d7697759eca69f07391741a
Parents: bf7317d
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Wed Nov 5 20:13:14 2014 +0200
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Wed Nov 5 20:13:14 2014 +0200

----------------------------------------------------------------------
 .../Function/ValueSources/EnumFieldSource.cs    | 603 +++++++++----------
 .../Function/ValueSources/ScaleFloatFunction.cs | 284 ++++-----
 .../Function/ValueSources/TFValueSource.cs      | 346 +++++------
 3 files changed, 619 insertions(+), 614 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/051b0ef0/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs
index b3e69b9..0fc40a8 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 using System.Collections;
+using System.Collections.Generic;
 using Lucene.Net.Index;
 using Lucene.Net.Queries.Function.DocValues;
 using Lucene.Net.Search;
@@ -23,30 +24,30 @@ using Lucene.Net.Support;
 namespace Lucene.Net.Queries.Function.ValueSources
 {
     /// <summary>
-	/// Scales values to be between min and max.
-	/// <para>This implementation currently traverses all of the source values to obtain
-	/// their min and max.
-	/// </para>
-	/// <para>This implementation currently cannot distinguish when documents have been
-	/// deleted or documents that have no value, and 0.0 values will be used for
-	/// these cases.  This means that if values are normally all greater than 0.0, one can
-	/// still end up with 0.0 as the min value to map from.  In these cases, an
-	/// appropriate map() function could be used as a workaround to change 0.0
-	/// to a value in the real range.
-	/// </para>
-	/// </summary>
-	public class ScaleFloatFunction : ValueSource
-	{
-	  protected internal readonly ValueSource source;
-	  protected internal readonly float min;
-	  protected internal readonly float max;
-
-	  public ScaleFloatFunction(ValueSource source, float min, float max)
-	  {
-		this.source = source;
-		this.min = min;
-		this.max = max;
-	  }
+    /// Scales values to be between min and max.
+    /// <para>This implementation currently traverses all of the source values to obtain
+    /// their min and max.
+    /// </para>
+    /// <para>This implementation currently cannot distinguish when documents have been
+    /// deleted or documents that have no value, and 0.0 values will be used for
+    /// these cases.  This means that if values are normally all greater than 0.0, one can
+    /// still end up with 0.0 as the min value to map from.  In these cases, an
+    /// appropriate map() function could be used as a workaround to change 0.0
+    /// to a value in the real range.
+    /// </para>
+    /// </summary>
+    public class ScaleFloatFunction : ValueSource
+    {
+        protected internal readonly ValueSource source;
+        protected internal readonly float min;
+        protected internal readonly float max;
+
+        public ScaleFloatFunction(ValueSource source, float min, float max)
+        {
+            this.source = source;
+            this.min = min;
+            this.max = max;
+        }
 
         public override string Description
         {
@@ -54,122 +55,121 @@ namespace Lucene.Net.Queries.Function.ValueSources
         }
 
         private class ScaleInfo
-	  {
-		internal float minVal;
-		internal float maxVal;
-	  }
-
-	  private ScaleInfo CreateScaleInfo(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		var leaves = ReaderUtil.GetTopLevelContext(readerContext).Leaves;
-
-		float minVal = float.PositiveInfinity;
-		float maxVal = float.NegativeInfinity;
-
-		foreach (AtomicReaderContext leaf in leaves)
-		{
-		  int maxDoc = leaf.Reader.MaxDoc;
-		  FunctionValues vals = source.GetValues(context, leaf);
-		  for (int i = 0; i < maxDoc; i++)
-		  {
-
-		  float val = vals.FloatVal(i);
-		  if ((Number.FloatToRawIntBits(val) & (0xff << 23)) == 0xff << 23)
-		  {
-			// if the exponent in the float is all ones, then this is +Inf, -Inf or NaN
-			// which don't make sense to factor into the scale function
-			continue;
-		  }
-		  if (val < minVal)
-		  {
-			minVal = val;
-		  }
-		  if (val > maxVal)
-		  {
-			maxVal = val;
-		  }
-		  }
-		}
-
-		if (minVal == float.PositiveInfinity)
-		{
-		// must have been an empty index
-		  minVal = maxVal = 0;
-		}
-
-		ScaleInfo scaleInfo = new ScaleInfo();
-		scaleInfo.minVal = minVal;
-		scaleInfo.maxVal = maxVal;
-		context[ScaleFloatFunction.this] = scaleInfo;
-		return scaleInfo;
-	  }
-
-	  public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-
-		var scaleInfo = (ScaleInfo)context[ScaleFloatFunction.this];
-		if (scaleInfo == null)
-		{
-		  scaleInfo = CreateScaleInfo(context, readerContext);
-		}
-
-		float scale = (scaleInfo.maxVal - scaleInfo.minVal == 0) ? 0 : (max - min) / (scaleInfo.maxVal - scaleInfo.minVal);
-		float minSource = scaleInfo.minVal;
-		float maxSource = scaleInfo.maxVal;
-
-		var vals = source.GetValues(context, readerContext);
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, scale, minSource, maxSource, vals);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly ScaleFloatFunction outerInstance;
-
-		  private readonly float scale;
-		  private readonly float minSource;
-		  private readonly float maxSource;
-		  private readonly FunctionValues vals;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(ScaleFloatFunction outerInstance, ScaleFloatFunction @this, float scale, float minSource, float maxSource, FunctionValues vals) : base(@this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.scale = scale;
-			  this.minSource = minSource;
-			  this.maxSource = maxSource;
-			  this.vals = vals;
-		  }
-
-		  public override float FloatVal(int doc)
-		  {
-			return (vals.FloatVal(doc) - minSource) * scale + outerInstance.min;
-		  }
-		  public override string ToString(int doc)
-		  {
-			return "scale(" + vals.ToString(doc) + ",toMin=" + outerInstance.min + ",toMax=" + outerInstance.max + ",fromMin=" + minSource + ",fromMax=" + maxSource + ")";
-		  }
-	  }
-
-	  public override void CreateWeight(IDictionary context, IndexSearcher searcher)
-	  {
-		source.CreateWeight(context, searcher);
-	  }
-
-	  public override int GetHashCode()
-	  {
-		int h = Number.FloatToIntBits(min);
-		h = h * 29;
-		h += Number.FloatToIntBits(max);
-		h = h * 29;
-		h += source.GetHashCode();
-		return h;
-	  }
-
-	  public override bool Equals(object o)
-	  {
-		var other = o as ScaleFloatFunction;
-	      if (other == null)
-	          return false;
-		return this.min == other.min && this.max == other.max && this.source.Equals(other.source);
-	  }
-	}
+        {
+            internal float minVal;
+            internal float maxVal;
+        }
+
+        private ScaleInfo CreateScaleInfo(IDictionary context, AtomicReaderContext readerContext)
+        {
+            var leaves = ReaderUtil.GetTopLevelContext(readerContext).Leaves;
+
+            float minVal = float.PositiveInfinity;
+            float maxVal = float.NegativeInfinity;
+
+            foreach (AtomicReaderContext leaf in leaves)
+            {
+                int maxDoc = leaf.Reader.MaxDoc;
+                FunctionValues vals = source.GetValues(context, leaf);
+                for (int i = 0; i < maxDoc; i++)
+                {
+
+                    float val = vals.FloatVal(i);
+                    if ((Number.FloatToRawIntBits(val) & (0xff << 23)) == 0xff << 23)
+                    {
+                        // if the exponent in the float is all ones, then this is +Inf, -Inf or NaN
+                        // which don't make sense to factor into the scale function
+                        continue;
+                    }
+                    if (val < minVal)
+                    {
+                        minVal = val;
+                    }
+                    if (val > maxVal)
+                    {
+                        maxVal = val;
+                    }
+                }
+            }
+
+            if (minVal == float.PositiveInfinity)
+            {
+                // must have been an empty index
+                minVal = maxVal = 0;
+            }
+
+            var scaleInfo = new ScaleInfo { minVal = minVal, maxVal = maxVal };
+            context[this] = scaleInfo;
+            return scaleInfo;
+        }
+
+        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
+        {
+
+            var scaleInfo = (ScaleInfo)context[this];
+            if (scaleInfo == null)
+            {
+                scaleInfo = CreateScaleInfo(context, readerContext);
+            }
+
+            float scale = (scaleInfo.maxVal - scaleInfo.minVal == 0) ? 0 : (max - min) / (scaleInfo.maxVal - scaleInfo.minVal);
+            float minSource = scaleInfo.minVal;
+            float maxSource = scaleInfo.maxVal;
+
+            var vals = source.GetValues(context, readerContext);
+            return new FloatDocValuesAnonymousInnerClassHelper(this, this, scale, minSource, maxSource, vals);
+        }
+
+        private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+        {
+            private readonly ScaleFloatFunction outerInstance;
+
+            private readonly float scale;
+            private readonly float minSource;
+            private readonly float maxSource;
+            private readonly FunctionValues vals;
+
+            public FloatDocValuesAnonymousInnerClassHelper(ScaleFloatFunction outerInstance, ScaleFloatFunction @this, float scale, float minSource, float maxSource, FunctionValues vals)
+                : base(@this)
+            {
+                this.outerInstance = outerInstance;
+                this.scale = scale;
+                this.minSource = minSource;
+                this.maxSource = maxSource;
+                this.vals = vals;
+            }
+
+            public override float FloatVal(int doc)
+            {
+                return (vals.FloatVal(doc) - minSource) * scale + outerInstance.min;
+            }
+            public override string ToString(int doc)
+            {
+                return "scale(" + vals.ToString(doc) + ",toMin=" + outerInstance.min + ",toMax=" + outerInstance.max + ",fromMin=" + minSource + ",fromMax=" + maxSource + ")";
+            }
+        }
+
+        public override void CreateWeight(IDictionary context, IndexSearcher searcher)
+        {
+            source.CreateWeight(context, searcher);
+        }
+
+        public override int GetHashCode()
+        {
+            int h = Number.FloatToIntBits(min);
+            h = h * 29;
+            h += Number.FloatToIntBits(max);
+            h = h * 29;
+            h += source.GetHashCode();
+            return h;
+        }
+
+        public override bool Equals(object o)
+        {
+            var other = o as ScaleFloatFunction;
+            if (other == null)
+                return false;
+            return this.min == other.min && this.max == other.max && this.source.Equals(other.source);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/051b0ef0/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs
index a4353a8..4e8efb0 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/TFValueSource.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections;
+using System.Collections.Generic;
 using System.IO;
 using Lucene.Net.Index;
 using Lucene.Net.Queries.Function.DocValues;
@@ -10,176 +11,183 @@ using Lucene.Net.Util;
 namespace Lucene.Net.Queries.Function.ValueSources
 {
 
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
     /// <summary>
-	/// Function that returns <seealso cref="TFIDFSimilarity#tf(float)"/>
-	/// for every document.
-	/// <para>
-	/// Note that the configured Similarity for the field must be
-	/// a subclass of <seealso cref="TFIDFSimilarity"/>
-	/// @lucene.internal 
-	/// </para>
-	/// </summary>
-	public class TFValueSource : TermFreqValueSource
-	{
-	  public TFValueSource(string field, string val, string indexedField, BytesRef indexedBytes) : base(field, val, indexedField, indexedBytes)
-	  {
-	  }
-
-	  public override string name()
-	  {
-		return "tf";
-	  }
+    /// Function that returns <seealso cref="TFIDFSimilarity#tf(float)"/>
+    /// for every document.
+    /// <para>
+    /// Note that the configured Similarity for the field must be
+    /// a subclass of <seealso cref="TFIDFSimilarity"/>
+    /// @lucene.internal 
+    /// </para>
+    /// </summary>
+    public class TFValueSource : TermFreqValueSource
+    {
+        public TFValueSource(string field, string val, string indexedField, BytesRef indexedBytes)
+            : base(field, val, indexedField, indexedBytes)
+        {
+        }
+
+        public override string Name
+        {
+            get
+            {
+                {
+                    return "tf";
+                }
+            }
+        }
 
         public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
-	  {
-		Fields fields = readerContext.AtomicReader.Fields;
-		Terms terms = fields.Terms(indexedField);
-		IndexSearcher searcher = (IndexSearcher)context["searcher"];
-		TFIDFSimilarity similarity = IDFValueSource.AsTFIDF(searcher.Similarity, indexedField);
-		if (similarity == null)
-		{
-		  throw new System.NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)");
-		}
-
-		return new FloatDocValuesAnonymousInnerClassHelper(this, this, terms, similarity);
-	  }
-
-	  private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
-	  {
-		  private readonly TFValueSource outerInstance;
-
-		  private readonly Terms terms;
-		  private readonly TFIDFSimilarity similarity;
-
-		  public FloatDocValuesAnonymousInnerClassHelper(TFValueSource outerInstance, TFValueSource @this, Terms terms, TFIDFSimilarity similarity) : base(@this)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.terms = terms;
-			  this.similarity = similarity;
-			  lastDocRequested = -1;
-		  }
-
-	      private DocsEnum docs;
-	      private int atDoc;
-	      private int lastDocRequested;
-
-//JAVA TO C# CONVERTER TODO TASK: Initialization blocks declared within anonymous inner classes are not converted:
-	//	  {
-	//		  reset();
-	//	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public void reset() throws java.io.IOException
-		  public virtual void Reset()
-		  {
-			// no one should call us for deleted docs?
-
-			if (terms != null)
-			{
-			  TermsEnum termsEnum = terms.Iterator(null);
-			  if (termsEnum.SeekExact(outerInstance.indexedBytes))
-			  {
-				docs = termsEnum.Docs(null, null);
-			  }
-			  else
-			  {
-				docs = null;
-			  }
-			}
-			else
-			{
-			  docs = null;
-			}
-
-			if (docs == null)
-			{
-			  docs = new DocsEnumAnonymousInnerClassHelper(this);
-			}
-			atDoc = -1;
-		  }
-
-		  private class DocsEnumAnonymousInnerClassHelper : DocsEnum
-		  {
-			  private readonly FloatDocValuesAnonymousInnerClassHelper outerInstance;
-
-			  public DocsEnumAnonymousInnerClassHelper(FloatDocValuesAnonymousInnerClassHelper outerInstance)
-			  {
-				  this.outerInstance = outerInstance;
-			  }
-
-			  public override int Freq()
-			  {
-				return 0;
-			  }
-
-			  public override int DocID()
-			  {
-				return DocIdSetIterator.NO_MORE_DOCS;
-			  }
-
-			  public override int NextDoc()
-			  {
-				return DocIdSetIterator.NO_MORE_DOCS;
-			  }
-
-			  public override int Advance(int target)
-			  {
-				return DocIdSetIterator.NO_MORE_DOCS;
-			  }
-
-			  public override long Cost()
-			  {
-				return 0;
-			  }
-		  }
-
-		  public override float FloatVal(int doc)
-		  {
-			try
-			{
-			  if (doc < lastDocRequested)
-			  {
-				// out-of-order access.... reset
-				Reset();
-			  }
-			  lastDocRequested = doc;
-
-			  if (atDoc < doc)
-			  {
-				atDoc = docs.Advance(doc);
-			  }
-
-			  if (atDoc > doc)
-			  {
-				// term doesn't match this document... either because we hit the
-				// end, or because the next doc is after this doc.
-				return similarity.Tf(0);
-			  }
-
-			  // a match!
-			  return similarity.Tf(docs.Freq());
-			}
-			catch (IOException e)
-			{
-			  throw new Exception("caught exception in function " + outerInstance.Description + " : doc=" + doc, e);
-			}
-		  }
-	  }
-	}
+        {
+            var fields = readerContext.AtomicReader.Fields;
+            var terms = fields.Terms(indexedField);
+            var searcher = (IndexSearcher)context["searcher"];
+            var similarity = IDFValueSource.AsTFIDF(searcher.Similarity, indexedField);
+            if (similarity == null)
+            {
+                throw new System.NotSupportedException("requires a TFIDFSimilarity (such as DefaultSimilarity)");
+            }
+
+            return new FloatDocValuesAnonymousInnerClassHelper(this, this, terms, similarity);
+        }
+
+        private class FloatDocValuesAnonymousInnerClassHelper : FloatDocValues
+        {
+            private readonly TFValueSource outerInstance;
+
+            private readonly Terms terms;
+            private readonly TFIDFSimilarity similarity;
+
+            public FloatDocValuesAnonymousInnerClassHelper(TFValueSource outerInstance, TFValueSource @this, Terms terms, TFIDFSimilarity similarity)
+                : base(@this)
+            {
+                this.outerInstance = outerInstance;
+                this.terms = terms;
+                this.similarity = similarity;
+                lastDocRequested = -1;
+            }
+
+            private DocsEnum docs;
+            private int atDoc;
+            private int lastDocRequested;
+
+            //JAVA TO C# CONVERTER TODO TASK: Initialization blocks declared within anonymous inner classes are not converted:
+            //	  {
+            //		  reset();
+            //	  }
+
+            //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+            //ORIGINAL LINE: public void reset() throws java.io.IOException
+            public virtual void Reset()
+            {
+                // no one should call us for deleted docs?
+
+                if (terms != null)
+                {
+                    TermsEnum termsEnum = terms.Iterator(null);
+                    if (termsEnum.SeekExact(outerInstance.indexedBytes))
+                    {
+                        docs = termsEnum.Docs(null, null);
+                    }
+                    else
+                    {
+                        docs = null;
+                    }
+                }
+                else
+                {
+                    docs = null;
+                }
+
+                if (docs == null)
+                {
+                    docs = new DocsEnumAnonymousInnerClassHelper(this);
+                }
+                atDoc = -1;
+            }
+
+            private class DocsEnumAnonymousInnerClassHelper : DocsEnum
+            {
+                private readonly FloatDocValuesAnonymousInnerClassHelper outerInstance;
+
+                public DocsEnumAnonymousInnerClassHelper(FloatDocValuesAnonymousInnerClassHelper outerInstance)
+                {
+                    this.outerInstance = outerInstance;
+                }
+
+                public override int Freq()
+                {
+                    return 0;
+                }
+
+                public override int DocID()
+                {
+                    return DocIdSetIterator.NO_MORE_DOCS;
+                }
+
+                public override int NextDoc()
+                {
+                    return DocIdSetIterator.NO_MORE_DOCS;
+                }
+
+                public override int Advance(int target)
+                {
+                    return DocIdSetIterator.NO_MORE_DOCS;
+                }
+
+                public override long Cost()
+                {
+                    return 0;
+                }
+            }
+
+            public override float FloatVal(int doc)
+            {
+                try
+                {
+                    if (doc < lastDocRequested)
+                    {
+                        // out-of-order access.... reset
+                        Reset();
+                    }
+                    lastDocRequested = doc;
+
+                    if (atDoc < doc)
+                    {
+                        atDoc = docs.Advance(doc);
+                    }
+
+                    if (atDoc > doc)
+                    {
+                        // term doesn't match this document... either because we hit the
+                        // end, or because the next doc is after this doc.
+                        return similarity.Tf(0);
+                    }
+
+                    // a match!
+                    return similarity.Tf(docs.Freq());
+                }
+                catch (IOException e)
+                {
+                    throw new Exception("caught exception in function " + outerInstance.Description + " : doc=" + doc, e);
+                }
+            }
+        }
+    }
 }
\ No newline at end of file