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 2015/01/19 12:58:32 UTC
[2/2] lucenenet git commit: Update for SimpleText Codec from changed
to Lucene.Net Core, and updates to Memory codec
Update for SimpleText Codec from changed to Lucene.Net Core, and updates to Memory codec
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/2d850fd7
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/2d850fd7
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/2d850fd7
Branch: refs/heads/master
Commit: 2d850fd710a6068d90fff3ffa62f521b71f342a0
Parents: a836989
Author: Prescott Nasser <pn...@apache.org>
Authored: Sun Jan 18 15:01:19 2015 -0800
Committer: Prescott Nasser <pn...@apache.org>
Committed: Sun Jan 18 15:01:19 2015 -0800
----------------------------------------------------------------------
.gitignore | 1 +
.../Lucene.Net.Codecs.Tests.csproj | 67 +
.../Properties/AssemblyInfo.cs | 36 +
.../blockterms/TestFixedGapPostingsFormat.cs | 43 +
.../bloom/TestBloomPostingsFormat.cs | 40 +
.../diskdv/TestDiskDocValuesFormat.cs | 42 +
.../intblock/TestFixedIntBlockPostingsFormat.cs | 42 +
.../intblock/TestIntBlockCodec.cs | 76 ++
.../TestVariableIntBlockPostingsFormat.cs | 43 +
.../memory/TestDirectDocValuesFormat.cs | 40 +
.../memory/TestDirectPostingsFormat.cs | 42 +
.../memory/TestFSTOrdPostingsFormat.cs | 40 +
.../memory/TestFSTOrdPulsing41PostingsFormat.cs | 40 +
.../memory/TestFSTPostingsFormat.cs | 40 +
.../memory/TestFSTPulsing41PostingsFormat.cs | 40 +
.../memory/TestMemoryDocValuesFormat.cs | 45 +
.../memory/TestMemoryPostingsFormat.cs | 42 +
.../pulsing/Test10KPulsings.cs | 183 +++
.../pulsing/TestPulsingPostingsFormat.cs | 42 +
.../pulsing/TestPulsingReuse.cs | 134 ++
.../sep/TestSepPostingsFormat.cs | 42 +
.../simpletext/TestSimpleTextDocValuesFormat.cs | 39 +
.../simpletext/TestSimpleTextPostingsFormat.cs | 42 +
.../TestSimpleTextStoredFieldsFormat.cs | 35 +
.../TestSimpleTextTermVectorsFormat.cs | 36 +
src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj | 3 +-
.../Memory/DirectDocValuesConsumer.cs | 115 +-
.../Memory/DirectDocValuesProducer.cs | 1264 +++++++++---------
.../Memory/DirectPostingsFormat.cs | 39 +-
.../Memory/MemoryDocValuesConsumer.cs | 184 +--
.../Memory/MemoryDocValuesProducer.cs | 100 +-
.../SimpleText/SimpleTextDocValuesWriter.cs | 16 +-
32 files changed, 2167 insertions(+), 826 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 1e9e614..a1ea325 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@ obj
*.VisualState.xml
*.userprefs
*.pidb
+*.ide
test-results
build/artifacts
build/bin
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/Lucene.Net.Codecs.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/Lucene.Net.Codecs.Tests.csproj b/src/Lucene.Net.Codecs.Tests/Lucene.Net.Codecs.Tests.csproj
new file mode 100644
index 0000000..12eb5c6
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/Lucene.Net.Codecs.Tests.csproj
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<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>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{351B75B1-BBD5-4E32-8036-7BED4E0135A6}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Lucene.Net.Codecs.Tests</RootNamespace>
+ <AssemblyName>Lucene.Net.Codecs.Tests</AssemblyName>
+ <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <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="diskdv\TestDiskDocValuesFormat.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Lucene.Net.Codecs\Lucene.Net.Codecs.csproj">
+ <Project>{3f79b6d4-4359-4f83-b64f-07f4f6262425}</Project>
+ <Name>Lucene.Net.Codecs</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Lucene.Net.Core\Lucene.Net.csproj">
+ <Project>{5d4ad9be-1ffb-41ab-9943-25737971bf57}</Project>
+ <Name>Lucene.Net</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Lucene.Net.Tests\Lucene.Net.Tests.csproj">
+ <Project>{de63db10-975f-460d-af85-572c17a91284}</Project>
+ <Name>Lucene.Net.Tests</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/Properties/AssemblyInfo.cs b/src/Lucene.Net.Codecs.Tests/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..a54794e
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Lucene.Net.Codecs.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Lucene.Net.Codecs.Tests")]
+[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("39e5e0c8-c1d3-4583-b9f7-8fbd695e5601")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/blockterms/TestFixedGapPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/blockterms/TestFixedGapPostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/blockterms/TestFixedGapPostingsFormat.cs
new file mode 100644
index 0000000..11aa1b8
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/blockterms/TestFixedGapPostingsFormat.cs
@@ -0,0 +1,43 @@
+namespace org.apache.lucene.codecs.blockterms
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using Lucene41WithOrds = org.apache.lucene.codecs.lucene41ords.Lucene41WithOrds;
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Basic tests of a PF using FixedGap terms dictionary
+ /// </summary>
+ // TODO: we should add an instantiation for VarGap too to TestFramework, and a test in this package
+ // TODO: ensure both of these are also in rotation in RandomCodec
+ public class TestFixedGapPostingsFormat : BasePostingsFormatTestCase
+ {
+ private readonly Codec codec = TestUtil.alwaysPostingsFormat(new Lucene41WithOrds());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/bloom/TestBloomPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/bloom/TestBloomPostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/bloom/TestBloomPostingsFormat.cs
new file mode 100644
index 0000000..2548f2b
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/bloom/TestBloomPostingsFormat.cs
@@ -0,0 +1,40 @@
+namespace org.apache.lucene.codecs.bloom
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Basic tests for BloomPostingsFormat
+ /// </summary>
+ public class TestBloomPostingsFormat : BasePostingsFormatTestCase
+ {
+ private readonly Codec codec = TestUtil.alwaysPostingsFormat(new TestBloomFilteredLucene41Postings());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/diskdv/TestDiskDocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/diskdv/TestDiskDocValuesFormat.cs b/src/Lucene.Net.Codecs.Tests/diskdv/TestDiskDocValuesFormat.cs
new file mode 100644
index 0000000..01889ae
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/diskdv/TestDiskDocValuesFormat.cs
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using Lucene.Net.Codecs.DiskDV;
+
+namespace Lucene.Net.Codecs.DiskDV
+{
+
+ using BaseCompressingDocValuesFormatTestCase = Lucene.Net.Index.BaseCompressingDocValuesFormatTestCase;
+ using TestUtil = Lucene.Net.Util.TestUtil;
+
+ /// <summary>
+ /// Tests DiskDocValuesFormat
+ /// </summary>
+ public class TestDiskDocValuesFormat : BaseCompressingDocValuesFormatTestCase
+ {
+ private readonly Codec codec = TestUtil.alwaysDocValuesFormat(new DiskDocValuesFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/intblock/TestFixedIntBlockPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/intblock/TestFixedIntBlockPostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/intblock/TestFixedIntBlockPostingsFormat.cs
new file mode 100644
index 0000000..1133c64
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/intblock/TestFixedIntBlockPostingsFormat.cs
@@ -0,0 +1,42 @@
+namespace org.apache.lucene.codecs.intblock
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using MockFixedIntBlockPostingsFormat = org.apache.lucene.codecs.mockintblock.MockFixedIntBlockPostingsFormat;
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Basic tests for FixedIntBlock
+ /// </summary>
+ public class TestFixedIntBlockPostingsFormat : BasePostingsFormatTestCase
+ {
+ // TODO: randomize blocksize
+ private readonly Codec codec = TestUtil.alwaysPostingsFormat(new MockFixedIntBlockPostingsFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/intblock/TestIntBlockCodec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/intblock/TestIntBlockCodec.cs b/src/Lucene.Net.Codecs.Tests/intblock/TestIntBlockCodec.cs
new file mode 100644
index 0000000..1e973dc
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/intblock/TestIntBlockCodec.cs
@@ -0,0 +1,76 @@
+namespace org.apache.lucene.codecs.intblock
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using LuceneTestCase = org.apache.lucene.util.LuceneTestCase;
+ using org.apache.lucene.store;
+ using org.apache.lucene.codecs.mockintblock;
+ using org.apache.lucene.codecs.sep;
+
+ public class TestIntBlockCodec : LuceneTestCase
+ {
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public void testSimpleIntBlocks() throws Exception
+ public virtual void testSimpleIntBlocks()
+ {
+ Directory dir = newDirectory();
+
+ IntStreamFactory f = (new MockFixedIntBlockPostingsFormat(128)).IntFactory;
+
+ IntIndexOutput @out = f.createOutput(dir, "test", newIOContext(random()));
+ for (int i = 0;i < 11777;i++)
+ {
+ @out.write(i);
+ }
+ @out.close();
+
+ IntIndexInput @in = f.openInput(dir, "test", newIOContext(random()));
+ IntIndexInput.Reader r = @in.reader();
+
+ for (int i = 0;i < 11777;i++)
+ {
+ assertEquals(i, r.next());
+ }
+ @in.close();
+
+ dir.close();
+ }
+
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public void testEmptySimpleIntBlocks() throws Exception
+ public virtual void testEmptySimpleIntBlocks()
+ {
+ Directory dir = newDirectory();
+
+ IntStreamFactory f = (new MockFixedIntBlockPostingsFormat(128)).IntFactory;
+ IntIndexOutput @out = f.createOutput(dir, "test", newIOContext(random()));
+
+ // write no ints
+ @out.close();
+
+ IntIndexInput @in = f.openInput(dir, "test", newIOContext(random()));
+ @in.reader();
+ // read no ints
+ @in.close();
+ dir.close();
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/intblock/TestVariableIntBlockPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/intblock/TestVariableIntBlockPostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/intblock/TestVariableIntBlockPostingsFormat.cs
new file mode 100644
index 0000000..0a8a644
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/intblock/TestVariableIntBlockPostingsFormat.cs
@@ -0,0 +1,43 @@
+namespace org.apache.lucene.codecs.intblock
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using MockVariableIntBlockPostingsFormat = org.apache.lucene.codecs.mockintblock.MockVariableIntBlockPostingsFormat;
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Basic tests for VariableIntBlock
+ /// </summary>
+ public class TestVariableIntBlockPostingsFormat : BasePostingsFormatTestCase
+ {
+ // TODO: randomize blocksize
+ private readonly Codec codec = TestUtil.alwaysPostingsFormat(new MockVariableIntBlockPostingsFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/memory/TestDirectDocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/memory/TestDirectDocValuesFormat.cs b/src/Lucene.Net.Codecs.Tests/memory/TestDirectDocValuesFormat.cs
new file mode 100644
index 0000000..e05827e
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/memory/TestDirectDocValuesFormat.cs
@@ -0,0 +1,40 @@
+namespace org.apache.lucene.codecs.memory
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BaseDocValuesFormatTestCase = org.apache.lucene.index.BaseDocValuesFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Tests DirectDocValuesFormat
+ /// </summary>
+ public class TestDirectDocValuesFormat : BaseDocValuesFormatTestCase
+ {
+ private readonly Codec codec = TestUtil.alwaysDocValuesFormat(new DirectDocValuesFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/memory/TestDirectPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/memory/TestDirectPostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/memory/TestDirectPostingsFormat.cs
new file mode 100644
index 0000000..96a04cb
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/memory/TestDirectPostingsFormat.cs
@@ -0,0 +1,42 @@
+namespace org.apache.lucene.codecs.memory
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Tests DirectPostingsFormat
+ /// </summary>
+ public class TestDirectPostingsFormat : BasePostingsFormatTestCase
+ {
+ // TODO: randomize parameters
+ private readonly Codec codec = TestUtil.alwaysPostingsFormat(new DirectPostingsFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/memory/TestFSTOrdPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/memory/TestFSTOrdPostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/memory/TestFSTOrdPostingsFormat.cs
new file mode 100644
index 0000000..cc5afb0
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/memory/TestFSTOrdPostingsFormat.cs
@@ -0,0 +1,40 @@
+namespace org.apache.lucene.codecs.memory
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Tests FSTOrdPostingsFormat
+ /// </summary>
+ public class TestFSTOrdPostingsFormat : BasePostingsFormatTestCase
+ {
+ private readonly Codec codec = TestUtil.alwaysPostingsFormat(new FSTOrdPostingsFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/memory/TestFSTOrdPulsing41PostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/memory/TestFSTOrdPulsing41PostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/memory/TestFSTOrdPulsing41PostingsFormat.cs
new file mode 100644
index 0000000..a963c73
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/memory/TestFSTOrdPulsing41PostingsFormat.cs
@@ -0,0 +1,40 @@
+namespace org.apache.lucene.codecs.memory
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Tests FSTOrdPulsing41PostingsFormat
+ /// </summary>
+ public class TestFSTOrdPulsing41PostingsFormat : BasePostingsFormatTestCase
+ {
+ private readonly Codec codec = TestUtil.alwaysPostingsFormat(new FSTOrdPulsing41PostingsFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/memory/TestFSTPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/memory/TestFSTPostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/memory/TestFSTPostingsFormat.cs
new file mode 100644
index 0000000..261b41f
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/memory/TestFSTPostingsFormat.cs
@@ -0,0 +1,40 @@
+namespace org.apache.lucene.codecs.memory
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Tests FSTPostingsFormat
+ /// </summary>
+ public class TestFSTPostingsFormat : BasePostingsFormatTestCase
+ {
+ private readonly Codec codec = TestUtil.alwaysPostingsFormat(new FSTPostingsFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/memory/TestFSTPulsing41PostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/memory/TestFSTPulsing41PostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/memory/TestFSTPulsing41PostingsFormat.cs
new file mode 100644
index 0000000..f1daa94
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/memory/TestFSTPulsing41PostingsFormat.cs
@@ -0,0 +1,40 @@
+namespace org.apache.lucene.codecs.memory
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Tests FSTPulsing41PostingsFormat
+ /// </summary>
+ public class TestFSTPulsing41PostingsFormat : BasePostingsFormatTestCase
+ {
+ private readonly Codec codec = TestUtil.alwaysPostingsFormat(new FSTPulsing41PostingsFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/memory/TestMemoryDocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/memory/TestMemoryDocValuesFormat.cs b/src/Lucene.Net.Codecs.Tests/memory/TestMemoryDocValuesFormat.cs
new file mode 100644
index 0000000..f1f78c3
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/memory/TestMemoryDocValuesFormat.cs
@@ -0,0 +1,45 @@
+namespace org.apache.lucene.codecs.memory
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BaseCompressingDocValuesFormatTestCase = org.apache.lucene.index.BaseCompressingDocValuesFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Tests MemoryDocValuesFormat
+ /// </summary>
+ public class TestMemoryDocValuesFormat : BaseCompressingDocValuesFormatTestCase
+ {
+ private readonly Codec codec = TestUtil.alwaysDocValuesFormat(new MemoryDocValuesFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+
+ protected internal override bool codecAcceptsHugeBinaryValues(string field)
+ {
+ return false;
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/memory/TestMemoryPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/memory/TestMemoryPostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/memory/TestMemoryPostingsFormat.cs
new file mode 100644
index 0000000..62da9a8
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/memory/TestMemoryPostingsFormat.cs
@@ -0,0 +1,42 @@
+namespace org.apache.lucene.codecs.memory
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Tests MemoryPostingsFormat
+ /// </summary>
+ public class TestMemoryPostingsFormat : BasePostingsFormatTestCase
+ {
+ // TODO: randomize doPack
+ private readonly Codec codec = TestUtil.alwaysPostingsFormat(new MemoryPostingsFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/pulsing/Test10KPulsings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/pulsing/Test10KPulsings.cs b/src/Lucene.Net.Codecs.Tests/pulsing/Test10KPulsings.cs
new file mode 100644
index 0000000..c9fab57
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/pulsing/Test10KPulsings.cs
@@ -0,0 +1,183 @@
+using System.Text;
+
+namespace org.apache.lucene.codecs.pulsing
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+ using MockAnalyzer = org.apache.lucene.analysis.MockAnalyzer;
+ using Document = org.apache.lucene.document.Document;
+ using Field = org.apache.lucene.document.Field;
+ using FieldType = org.apache.lucene.document.FieldType;
+ using TextField = org.apache.lucene.document.TextField;
+ using DocsEnum = org.apache.lucene.index.DocsEnum;
+ using IndexOptions = org.apache.lucene.index.FieldInfo.IndexOptions;
+ using IndexReader = org.apache.lucene.index.IndexReader;
+ using MultiFields = org.apache.lucene.index.MultiFields;
+ using RandomIndexWriter = org.apache.lucene.index.RandomIndexWriter;
+ using TermsEnum = org.apache.lucene.index.TermsEnum;
+ using DocIdSetIterator = org.apache.lucene.search.DocIdSetIterator;
+ using BaseDirectoryWrapper = org.apache.lucene.store.BaseDirectoryWrapper;
+ using LuceneTestCase = org.apache.lucene.util.LuceneTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Pulses 10k terms/docs,
+ /// originally designed to find JRE bugs (https://issues.apache.org/jira/browse/LUCENE-3335)
+ ///
+ /// @lucene.experimental
+ /// </summary>
+//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
+//ORIGINAL LINE: @LuceneTestCase.Nightly public class Test10KPulsings extends org.apache.lucene.util.LuceneTestCase
+ public class Test10KPulsings : LuceneTestCase
+ {
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public void test10kPulsed() throws Exception
+ public virtual void test10kPulsed()
+ {
+ // we always run this test with pulsing codec.
+ Codec cp = TestUtil.alwaysPostingsFormat(new Pulsing41PostingsFormat(1));
+
+ File f = createTempDir("10kpulsed");
+ BaseDirectoryWrapper dir = newFSDirectory(f);
+ dir.CheckIndexOnClose = false; // we do this ourselves explicitly
+ RandomIndexWriter iw = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setCodec(cp));
+
+ Document document = new Document();
+ FieldType ft = new FieldType(TextField.TYPE_STORED);
+
+ switch (TestUtil.Next(random(), 0, 2))
+ {
+ case 0:
+ ft.IndexOptions = IndexOptions.DOCS_ONLY;
+ break;
+ case 1:
+ ft.IndexOptions = IndexOptions.DOCS_AND_FREQS;
+ break;
+ default:
+ ft.IndexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
+ break;
+ }
+
+ Field field = newField("field", "", ft);
+ document.add(field);
+
+ NumberFormat df = new DecimalFormat("00000", new DecimalFormatSymbols(Locale.ROOT));
+
+ for (int i = 0; i < 10050; i++)
+ {
+ field.StringValue = df.format(i);
+ iw.addDocument(document);
+ }
+
+ IndexReader ir = iw.Reader;
+ iw.close();
+
+ TermsEnum te = MultiFields.getTerms(ir, "field").iterator(null);
+ DocsEnum de = null;
+
+ for (int i = 0; i < 10050; i++)
+ {
+ string expected = df.format(i);
+ assertEquals(expected, te.next().utf8ToString());
+ de = TestUtil.docs(random(), te, null, de, DocsEnum.FLAG_NONE);
+ assertTrue(de.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
+ assertEquals(DocIdSetIterator.NO_MORE_DOCS, de.nextDoc());
+ }
+ ir.close();
+
+ TestUtil.checkIndex(dir);
+ dir.close();
+ }
+
+ /// <summary>
+ /// a variant, that uses pulsing, but uses a high TF to force pass thru to the underlying codec
+ /// </summary>
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public void test10kNotPulsed() throws Exception
+ public virtual void test10kNotPulsed()
+ {
+ // we always run this test with pulsing codec.
+ int freqCutoff = TestUtil.Next(random(), 1, 10);
+ Codec cp = TestUtil.alwaysPostingsFormat(new Pulsing41PostingsFormat(freqCutoff));
+
+ File f = createTempDir("10knotpulsed");
+ BaseDirectoryWrapper dir = newFSDirectory(f);
+ dir.CheckIndexOnClose = false; // we do this ourselves explicitly
+ RandomIndexWriter iw = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setCodec(cp));
+
+ Document document = new Document();
+ FieldType ft = new FieldType(TextField.TYPE_STORED);
+
+ switch (TestUtil.Next(random(), 0, 2))
+ {
+ case 0:
+ ft.IndexOptions = IndexOptions.DOCS_ONLY;
+ break;
+ case 1:
+ ft.IndexOptions = IndexOptions.DOCS_AND_FREQS;
+ break;
+ default:
+ ft.IndexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
+ break;
+ }
+
+ Field field = newField("field", "", ft);
+ document.add(field);
+
+ NumberFormat df = new DecimalFormat("00000", new DecimalFormatSymbols(Locale.ROOT));
+
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final int freq = freqCutoff + 1;
+ int freq = freqCutoff + 1;
+
+ for (int i = 0; i < 10050; i++)
+ {
+ StringBuilder sb = new StringBuilder();
+ for (int j = 0; j < freq; j++)
+ {
+ sb.Append(df.format(i));
+ sb.Append(' '); // whitespace
+ }
+ field.StringValue = sb.ToString();
+ iw.addDocument(document);
+ }
+
+ IndexReader ir = iw.Reader;
+ iw.close();
+
+ TermsEnum te = MultiFields.getTerms(ir, "field").iterator(null);
+ DocsEnum de = null;
+
+ for (int i = 0; i < 10050; i++)
+ {
+ string expected = df.format(i);
+ assertEquals(expected, te.next().utf8ToString());
+ de = TestUtil.docs(random(), te, null, de, DocsEnum.FLAG_NONE);
+ assertTrue(de.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
+ assertEquals(DocIdSetIterator.NO_MORE_DOCS, de.nextDoc());
+ }
+ ir.close();
+
+ TestUtil.checkIndex(dir);
+ dir.close();
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/pulsing/TestPulsingPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/pulsing/TestPulsingPostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/pulsing/TestPulsingPostingsFormat.cs
new file mode 100644
index 0000000..249e8e1
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/pulsing/TestPulsingPostingsFormat.cs
@@ -0,0 +1,42 @@
+namespace org.apache.lucene.codecs.pulsing
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Tests PulsingPostingsFormat
+ /// </summary>
+ public class TestPulsingPostingsFormat : BasePostingsFormatTestCase
+ {
+ // TODO: randomize cutoff
+ private readonly Codec codec = TestUtil.alwaysPostingsFormat(new Pulsing41PostingsFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/pulsing/TestPulsingReuse.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/pulsing/TestPulsingReuse.cs b/src/Lucene.Net.Codecs.Tests/pulsing/TestPulsingReuse.cs
new file mode 100644
index 0000000..f35c108
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/pulsing/TestPulsingReuse.cs
@@ -0,0 +1,134 @@
+using System.Collections.Generic;
+
+namespace org.apache.lucene.codecs.pulsing
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+ using MockAnalyzer = org.apache.lucene.analysis.MockAnalyzer;
+ using NestedPulsingPostingsFormat = org.apache.lucene.codecs.nestedpulsing.NestedPulsingPostingsFormat;
+ using Document = org.apache.lucene.document.Document;
+ using Field = org.apache.lucene.document.Field;
+ using TextField = org.apache.lucene.document.TextField;
+ using AtomicReader = org.apache.lucene.index.AtomicReader;
+ using DirectoryReader = org.apache.lucene.index.DirectoryReader;
+ using DocsAndPositionsEnum = org.apache.lucene.index.DocsAndPositionsEnum;
+ using DocsEnum = org.apache.lucene.index.DocsEnum;
+ using RandomIndexWriter = org.apache.lucene.index.RandomIndexWriter;
+ using TermsEnum = org.apache.lucene.index.TermsEnum;
+ using BaseDirectoryWrapper = org.apache.lucene.store.BaseDirectoryWrapper;
+ using Directory = org.apache.lucene.store.Directory;
+ using LuceneTestCase = org.apache.lucene.util.LuceneTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Tests that pulsing codec reuses its enums and wrapped enums
+ /// </summary>
+ public class TestPulsingReuse : LuceneTestCase
+ {
+ // TODO: this is a basic test. this thing is complicated, add more
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public void testSophisticatedReuse() throws Exception
+ public virtual void testSophisticatedReuse()
+ {
+ // we always run this test with pulsing codec.
+ Codec cp = TestUtil.alwaysPostingsFormat(new Pulsing41PostingsFormat(1));
+ Directory dir = newDirectory();
+ RandomIndexWriter iw = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setCodec(cp));
+ Document doc = new Document();
+ doc.add(new TextField("foo", "a b b c c c d e f g g h i i j j k", Field.Store.NO));
+ iw.addDocument(doc);
+ DirectoryReader ir = iw.Reader;
+ iw.close();
+
+ AtomicReader segment = getOnlySegmentReader(ir);
+ DocsEnum reuse = null;
+ IDictionary<DocsEnum, bool?> allEnums = new IdentityHashMap<DocsEnum, bool?>();
+ TermsEnum te = segment.terms("foo").iterator(null);
+ while (te.next() != null)
+ {
+ reuse = te.docs(null, reuse, DocsEnum.FLAG_NONE);
+ allEnums[reuse] = true;
+ }
+
+ assertEquals(2, allEnums.Count);
+
+ allEnums.Clear();
+ DocsAndPositionsEnum posReuse = null;
+ te = segment.terms("foo").iterator(null);
+ while (te.next() != null)
+ {
+ posReuse = te.docsAndPositions(null, posReuse);
+ allEnums[posReuse] = true;
+ }
+
+ assertEquals(2, allEnums.Count);
+
+ ir.close();
+ dir.close();
+ }
+
+ /// <summary>
+ /// tests reuse with Pulsing1(Pulsing2(Standard)) </summary>
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public void testNestedPulsing() throws Exception
+ public virtual void testNestedPulsing()
+ {
+ // we always run this test with pulsing codec.
+ Codec cp = TestUtil.alwaysPostingsFormat(new NestedPulsingPostingsFormat());
+ BaseDirectoryWrapper dir = newDirectory();
+ RandomIndexWriter iw = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setCodec(cp));
+ Document doc = new Document();
+ doc.add(new TextField("foo", "a b b c c c d e f g g g h i i j j k l l m m m", Field.Store.NO));
+ // note: the reuse is imperfect, here we would have 4 enums (lost reuse when we get an enum for 'm')
+ // this is because we only track the 'last' enum we reused (not all).
+ // but this seems 'good enough' for now.
+ iw.addDocument(doc);
+ DirectoryReader ir = iw.Reader;
+ iw.close();
+
+ AtomicReader segment = getOnlySegmentReader(ir);
+ DocsEnum reuse = null;
+ IDictionary<DocsEnum, bool?> allEnums = new IdentityHashMap<DocsEnum, bool?>();
+ TermsEnum te = segment.terms("foo").iterator(null);
+ while (te.next() != null)
+ {
+ reuse = te.docs(null, reuse, DocsEnum.FLAG_NONE);
+ allEnums[reuse] = true;
+ }
+
+ assertEquals(4, allEnums.Count);
+
+ allEnums.Clear();
+ DocsAndPositionsEnum posReuse = null;
+ te = segment.terms("foo").iterator(null);
+ while (te.next() != null)
+ {
+ posReuse = te.docsAndPositions(null, posReuse);
+ allEnums[posReuse] = true;
+ }
+
+ assertEquals(4, allEnums.Count);
+
+ ir.close();
+ dir.close();
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/sep/TestSepPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/sep/TestSepPostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/sep/TestSepPostingsFormat.cs
new file mode 100644
index 0000000..72fef6f
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/sep/TestSepPostingsFormat.cs
@@ -0,0 +1,42 @@
+namespace org.apache.lucene.codecs.sep
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using MockSepPostingsFormat = org.apache.lucene.codecs.mocksep.MockSepPostingsFormat;
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using TestUtil = org.apache.lucene.util.TestUtil;
+
+ /// <summary>
+ /// Tests sep layout
+ /// </summary>
+ public class TestSepPostingsFormat : BasePostingsFormatTestCase
+ {
+ // TODO: randomize cutoff
+ private readonly Codec codec = TestUtil.alwaysPostingsFormat(new MockSepPostingsFormat());
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextDocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextDocValuesFormat.cs b/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextDocValuesFormat.cs
new file mode 100644
index 0000000..a6b8681
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextDocValuesFormat.cs
@@ -0,0 +1,39 @@
+namespace org.apache.lucene.codecs.simpletext
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BaseDocValuesFormatTestCase = org.apache.lucene.index.BaseDocValuesFormatTestCase;
+
+ /// <summary>
+ /// Tests SimpleTextDocValuesFormat
+ /// </summary>
+ public class TestSimpleTextDocValuesFormat : BaseDocValuesFormatTestCase
+ {
+ private readonly Codec codec = new SimpleTextCodec();
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextPostingsFormat.cs b/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextPostingsFormat.cs
new file mode 100644
index 0000000..ff628f8
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextPostingsFormat.cs
@@ -0,0 +1,42 @@
+namespace org.apache.lucene.codecs.simpletext
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+ using Nightly = org.apache.lucene.util.LuceneTestCase.Nightly;
+
+ /// <summary>
+ /// Tests SimpleText's postings
+ /// </summary>
+//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
+//ORIGINAL LINE: @Nightly public class TestSimpleTextPostingsFormat extends org.apache.lucene.index.BasePostingsFormatTestCase
+ public class TestSimpleTextPostingsFormat : BasePostingsFormatTestCase // please figure out why I am so horrendously slow!
+ {
+ private readonly Codec codec = new SimpleTextCodec();
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return codec;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextStoredFieldsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextStoredFieldsFormat.cs b/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextStoredFieldsFormat.cs
new file mode 100644
index 0000000..2a7c3c2
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextStoredFieldsFormat.cs
@@ -0,0 +1,35 @@
+namespace org.apache.lucene.codecs.simpletext
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BaseStoredFieldsFormatTestCase = org.apache.lucene.index.BaseStoredFieldsFormatTestCase;
+
+ public class TestSimpleTextStoredFieldsFormat : BaseStoredFieldsFormatTestCase
+ {
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return new SimpleTextCodec();
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextTermVectorsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextTermVectorsFormat.cs b/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextTermVectorsFormat.cs
new file mode 100644
index 0000000..ef41ca9
--- /dev/null
+++ b/src/Lucene.Net.Codecs.Tests/simpletext/TestSimpleTextTermVectorsFormat.cs
@@ -0,0 +1,36 @@
+namespace org.apache.lucene.codecs.simpletext
+{
+
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ using BaseTermVectorsFormatTestCase = org.apache.lucene.index.BaseTermVectorsFormatTestCase;
+
+ public class TestSimpleTextTermVectorsFormat : BaseTermVectorsFormatTestCase
+ {
+
+ protected internal override Codec Codec
+ {
+ get
+ {
+ return new SimpleTextCodec();
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj b/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj
index ee2ff66..f9a9902 100644
--- a/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj
+++ b/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Lucene.Net.Codecs</RootNamespace>
<AssemblyName>Lucene.Net.Codecs</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
@@ -124,7 +124,6 @@
<Compile Include="SimpleText\SimpleTextUtil.cs" />
<Compile Include="StringHelperClass.cs" />
</ItemGroup>
- <ItemGroup />
<ItemGroup>
<ProjectReference Include="..\Lucene.Net.Core\Lucene.Net.csproj">
<Project>{5d4ad9be-1ffb-41ab-9943-25737971bf57}</Project>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2d850fd7/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs b/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs
index f460225..210b066 100644
--- a/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs
+++ b/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs
@@ -20,13 +20,15 @@ namespace Lucene.Net.Codecs.Memory
using System;
using System.Diagnostics;
using System.Collections.Generic;
-
+
using FieldInfo = Index.FieldInfo;
using IndexFileNames = Index.IndexFileNames;
using SegmentWriteState = Index.SegmentWriteState;
using IndexOutput = Store.IndexOutput;
using BytesRef = Util.BytesRef;
using IOUtils = Util.IOUtils;
+ using System.Collections;
+
/// <summary>
/// Writer for <seealso cref="DirectDocValuesFormat"/>
@@ -62,14 +64,14 @@ namespace Lucene.Net.Codecs.Memory
}
}
- public override void AddNumericField(FieldInfo field, IEnumerable<long> values)
+ public override void AddNumericField(FieldInfo field, IEnumerable<long?> values)
{
meta.WriteVInt(field.Number);
meta.WriteByte(MemoryDocValuesProducer.NUMBER);
AddNumericFieldValues(field, values);
}
- private void AddNumericFieldValues(FieldInfo field, IEnumerable<long> values)
+ private void AddNumericFieldValues(FieldInfo field, IEnumerable<long?> values)
{
meta.WriteLong(data.FilePointer);
long minValue = long.MaxValue;
@@ -81,7 +83,7 @@ namespace Lucene.Net.Codecs.Memory
{
if (nv != null)
{
- var v = nv;
+ var v = nv.Value;
minValue = Math.Min(minValue, v);
maxValue = Math.Max(maxValue, v);
}
@@ -278,10 +280,10 @@ namespace Lucene.Net.Codecs.Memory
}
}
- public override void AddSortedField(FieldInfo field, IEnumerable<BytesRef> values, IEnumerable<long> docToOrd)
+ public override void AddSortedField(FieldInfo field, IEnumerable<BytesRef> values, IEnumerable<long?> docToOrd)
{
meta.WriteVInt(field.Number);
- meta.WriteByte(SORTED);
+ meta.WriteByte((byte)DirectDocValuesProducer.SORTED);
// write the ordinals as numerics
AddNumericFieldValues(field, docToOrd);
@@ -292,10 +294,10 @@ namespace Lucene.Net.Codecs.Memory
// note: this might not be the most efficient... but its fairly simple
public override void AddSortedSetField(FieldInfo field, IEnumerable<BytesRef> values,
- IEnumerable<long> docToOrdCount, IEnumerable<long> ords)
+ IEnumerable<long?> docToOrdCount, IEnumerable<long?> ords)
{
meta.WriteVInt(field.Number);
- meta.WriteByte(SORTED_SET);
+ meta.WriteByte((byte)DirectDocValuesProducer.SORTED_SET);
// First write docToOrdCounts, except we "aggregate" the
// counts so they turn into addresses, and add a final
@@ -310,13 +312,13 @@ namespace Lucene.Net.Codecs.Memory
AddBinaryFieldValues(field, values);
}
- private class IterableAnonymousInnerClassHelper : IEnumerable<long>
+ private class IterableAnonymousInnerClassHelper : IEnumerable<long?>
{
private readonly DirectDocValuesConsumer _outerInstance;
- private readonly IEnumerable<long> _docToOrdCount;
+ private readonly IEnumerable<long?> _docToOrdCount;
public IterableAnonymousInnerClassHelper(DirectDocValuesConsumer outerInstance,
- IEnumerable<long> docToOrdCount)
+ IEnumerable<long?> docToOrdCount)
{
_outerInstance = outerInstance;
_docToOrdCount = docToOrdCount;
@@ -325,18 +327,23 @@ namespace Lucene.Net.Codecs.Memory
// Just aggregates the count values so they become
// "addresses", and adds one more value in the end
// (the final sum):
- public virtual IEnumerator<long> GetEnumerator()
+ public virtual IEnumerator<long?> GetEnumerator()
{
var iter = _docToOrdCount.GetEnumerator();
return new IteratorAnonymousInnerClassHelper(this, iter);
}
- private class IteratorAnonymousInnerClassHelper : IEnumerator<long>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ private class IteratorAnonymousInnerClassHelper : IEnumerator<long?>
{
- private readonly IEnumerator<long> _iter;
+ private readonly IEnumerator<long?> _iter;
public IteratorAnonymousInnerClassHelper(IterableAnonymousInnerClassHelper outerInstance,
- IEnumerator<long> iter)
+ IEnumerator<long?> iter)
{
_iter = iter;
}
@@ -345,38 +352,88 @@ namespace Lucene.Net.Codecs.Memory
private long sum;
private bool ended;
- public virtual bool HasNext()
+ public long? Current
{
- return _iter.HasNext() || !ended;
+ get
+ {
+ return _iter.Current;
+ }
+ }
+
+ object IEnumerator.Current
+ {
+ get
+ {
+ return Current;
+ }
+ }
+
+ public virtual void Remove()
+ {
+ throw new NotSupportedException();
}
- public virtual long Next()
+ public bool MoveNext()
{
long toReturn = sum;
- if (_iter.hasNext())
+ if (_iter.MoveNext())
{
- long n = _iter.Next();
- if (n != null)
+ long? n = _iter.Current;
+ if (n.HasValue)
{
- sum += n;
+ sum += n.Value;
}
+
+ return true;
}
- else if (!ended)
+ else
{
ended = true;
+ return false;
}
- else
+
+ //return toReturn;
+ }
+
+ public void Reset()
+ {
+ throw new NotImplementedException();
+ }
+
+ #region IDisposable Support
+ private bool disposedValue = false; // To detect redundant calls
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposedValue)
{
- Debug.Assert(false);
- }
+ if (disposing)
+ {
+ // TODO: dispose managed state (managed objects).
+ }
+
+ // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
+ // TODO: set large fields to null.
- return toReturn;
+ disposedValue = true;
+ }
}
- public virtual void Remove()
+ // TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources.
+ // ~IteratorAnonymousInnerClassHelper() {
+ // // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
+ // Dispose(false);
+ // }
+
+ // This code added to correctly implement the disposable pattern.
+ public void Dispose()
{
- throw new NotSupportedException();
+ // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
+ Dispose(true);
+ // TODO: uncomment the following line if the finalizer is overridden above.
+ // GC.SuppressFinalize(this);
}
+ #endregion
}
}
}