You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/02/26 23:37:24 UTC
[36/72] [abbrv] [partial] lucenenet git commit: Lucene.Net.Tests:
Removed \core directory and put its contents in root directory
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Index/TestDoc.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDoc.cs b/src/Lucene.Net.Tests/Index/TestDoc.cs
new file mode 100644
index 0000000..bd65361
--- /dev/null
+++ b/src/Lucene.Net.Tests/Index/TestDoc.cs
@@ -0,0 +1,277 @@
+using Lucene.Net.Documents;
+using Lucene.Net.Support;
+using System;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Index
+{
+ using NUnit.Framework;
+ using System.IO;
+ using Codec = Lucene.Net.Codecs.Codec;
+ using Constants = Lucene.Net.Util.Constants;
+ using Directory = Lucene.Net.Store.Directory;
+ using DocIdSetIterator = Lucene.Net.Search.DocIdSetIterator;
+ using Document = Documents.Document;
+ using InfoStream = Lucene.Net.Util.InfoStream;
+ using IOContext = Lucene.Net.Store.IOContext;
+ using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+
+ /*
+ * 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 = Lucene.Net.Analysis.MockAnalyzer;
+ using MockDirectoryWrapper = Lucene.Net.Store.MockDirectoryWrapper;
+ using TextField = TextField;
+ using TrackingDirectoryWrapper = Lucene.Net.Store.TrackingDirectoryWrapper;
+
+ /// <summary>
+ /// JUnit adaptation of an older test case DocTest. </summary>
+ [TestFixture]
+ public class TestDoc : LuceneTestCase
+ {
+ private DirectoryInfo WorkDir;
+ private DirectoryInfo IndexDir;
+ private LinkedList<FileInfo> Files;
+
+ /// <summary>
+ /// Set the test case. this test case needs
+ /// a few text files created in the current working directory.
+ /// </summary>
+ [SetUp]
+ public override void SetUp()
+ {
+ base.SetUp();
+ if (VERBOSE)
+ {
+ Console.WriteLine("TEST: setUp");
+ }
+ WorkDir = CreateTempDir("TestDoc");
+
+ IndexDir = CreateTempDir("testIndex");
+
+ Directory directory = NewFSDirectory(IndexDir);
+ directory.Dispose();
+
+ Files = new LinkedList<FileInfo>();
+ Files.AddLast(CreateOutput("test.txt", "this is the first test file"));
+
+ Files.AddLast(CreateOutput("test2.txt", "this is the second test file"));
+ }
+
+ private FileInfo CreateOutput(string name, string text)
+ {
+ //TextWriter fw = null;
+ StreamWriter pw = null;
+
+ try
+ {
+ FileInfo f = new FileInfo(Path.Combine(WorkDir.FullName, name));
+ if (f.Exists)
+ {
+ f.Delete();
+ }
+
+ //fw = new StreamWriter(new FileOutputStream(f), IOUtils.CHARSET_UTF_8);
+ pw = new StreamWriter(File.Open(f.FullName, FileMode.OpenOrCreate));
+ pw.WriteLine(text);
+ return f;
+ }
+ finally
+ {
+ if (pw != null)
+ {
+ pw.Dispose();
+ }
+ /*if (fw != null)
+ {
+ fw.Dispose();
+ }*/
+ }
+ }
+
+ /// <summary>
+ /// this test executes a number of merges and compares the contents of
+ /// the segments created when using compound file or not using one.
+ ///
+ /// TODO: the original test used to print the segment contents to System.out
+ /// for visual validation. To have the same effect, a new method
+ /// checkSegment(String name, ...) should be created that would
+ /// assert various things about the segment.
+ /// </summary>
+ [Test]
+ public virtual void TestIndexAndMerge()
+ {
+ MemoryStream sw = new MemoryStream();
+ StreamWriter @out = new StreamWriter(sw);
+
+ Directory directory = NewFSDirectory(IndexDir, null);
+
+ MockDirectoryWrapper wrapper = directory as MockDirectoryWrapper;
+ if (wrapper != null)
+ {
+ // We create unreferenced files (we don't even write
+ // a segments file):
+ wrapper.AssertNoUnrefencedFilesOnClose = false;
+ }
+
+ IndexWriter writer = new IndexWriter(directory, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetOpenMode(OpenMode.CREATE).SetMaxBufferedDocs(-1).SetMergePolicy(NewLogMergePolicy(10)));
+
+ SegmentCommitInfo si1 = IndexDoc(writer, "test.txt");
+ PrintSegment(@out, si1);
+
+ SegmentCommitInfo si2 = IndexDoc(writer, "test2.txt");
+ PrintSegment(@out, si2);
+ writer.Dispose();
+
+ SegmentCommitInfo siMerge = Merge(directory, si1, si2, "_merge", false);
+ PrintSegment(@out, siMerge);
+
+ SegmentCommitInfo siMerge2 = Merge(directory, si1, si2, "_merge2", false);
+ PrintSegment(@out, siMerge2);
+
+ SegmentCommitInfo siMerge3 = Merge(directory, siMerge, siMerge2, "_merge3", false);
+ PrintSegment(@out, siMerge3);
+
+ directory.Dispose();
+ @out.Dispose();
+ sw.Dispose();
+
+ string multiFileOutput = sw.ToString();
+ //System.out.println(multiFileOutput);
+
+ sw = new MemoryStream();
+ @out = new StreamWriter(sw);
+
+ directory = NewFSDirectory(IndexDir, null);
+
+ wrapper = directory as MockDirectoryWrapper;
+ if (wrapper != null)
+ {
+ // We create unreferenced files (we don't even write
+ // a segments file):
+ wrapper.AssertNoUnrefencedFilesOnClose = false;
+ }
+
+ writer = new IndexWriter(directory, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetOpenMode(OpenMode.CREATE).SetMaxBufferedDocs(-1).SetMergePolicy(NewLogMergePolicy(10)));
+
+ si1 = IndexDoc(writer, "test.txt");
+ PrintSegment(@out, si1);
+
+ si2 = IndexDoc(writer, "test2.txt");
+ PrintSegment(@out, si2);
+ writer.Dispose();
+
+ siMerge = Merge(directory, si1, si2, "_merge", true);
+ PrintSegment(@out, siMerge);
+
+ siMerge2 = Merge(directory, si1, si2, "_merge2", true);
+ PrintSegment(@out, siMerge2);
+
+ siMerge3 = Merge(directory, siMerge, siMerge2, "_merge3", true);
+ PrintSegment(@out, siMerge3);
+
+ directory.Dispose();
+ @out.Dispose();
+ sw.Dispose();
+ string singleFileOutput = sw.ToString();
+
+ Assert.AreEqual(multiFileOutput, singleFileOutput);
+ }
+
+ private SegmentCommitInfo IndexDoc(IndexWriter writer, string fileName)
+ {
+ FileInfo file = new FileInfo(Path.Combine(WorkDir.FullName, fileName));
+ Document doc = new Document();
+ StreamReader @is = new StreamReader(File.Open(file.FullName, FileMode.Open));
+ doc.Add(new TextField("contents", @is));
+ writer.AddDocument(doc);
+ writer.Commit();
+ @is.Dispose();
+ return writer.NewestSegment();
+ }
+
+ private SegmentCommitInfo Merge(Directory dir, SegmentCommitInfo si1, SegmentCommitInfo si2, string merged, bool useCompoundFile)
+ {
+ IOContext context = NewIOContext(Random());
+ SegmentReader r1 = new SegmentReader(si1, DirectoryReader.DEFAULT_TERMS_INDEX_DIVISOR, context);
+ SegmentReader r2 = new SegmentReader(si2, DirectoryReader.DEFAULT_TERMS_INDEX_DIVISOR, context);
+
+ Codec codec = Codec.Default;
+ TrackingDirectoryWrapper trackingDir = new TrackingDirectoryWrapper(si1.Info.Dir);
+ SegmentInfo si = new SegmentInfo(si1.Info.Dir, Constants.LUCENE_MAIN_VERSION, merged, -1, false, codec, null);
+
+ SegmentMerger merger = new SegmentMerger(Arrays.AsList<AtomicReader>(r1, r2), si, InfoStream.Default, trackingDir, IndexWriterConfig.DEFAULT_TERM_INDEX_INTERVAL, CheckAbort.NONE, new FieldInfos.FieldNumbers(), context, true);
+
+ MergeState mergeState = merger.Merge();
+ r1.Dispose();
+ r2.Dispose();
+ SegmentInfo info = new SegmentInfo(si1.Info.Dir, Constants.LUCENE_MAIN_VERSION, merged, si1.Info.DocCount + si2.Info.DocCount, false, codec, null);
+ info.SetFiles(new HashSet<string>(trackingDir.CreatedFiles));
+
+ if (useCompoundFile)
+ {
+ ICollection<string> filesToDelete = IndexWriter.CreateCompoundFile(InfoStream.Default, dir, CheckAbort.NONE, info, NewIOContext(Random()));
+ info.UseCompoundFile = true;
+ foreach (String fileToDelete in filesToDelete)
+ {
+ si1.Info.Dir.DeleteFile(fileToDelete);
+ }
+ }
+
+ return new SegmentCommitInfo(info, 0, -1L, -1L);
+ }
+
+ private void PrintSegment(StreamWriter @out, SegmentCommitInfo si)
+ {
+ SegmentReader reader = new SegmentReader(si, DirectoryReader.DEFAULT_TERMS_INDEX_DIVISOR, NewIOContext(Random()));
+
+ for (int i = 0; i < reader.NumDocs; i++)
+ {
+ @out.WriteLine(reader.Document(i));
+ }
+
+ Fields fields = reader.Fields;
+ foreach (string field in fields)
+ {
+ Terms terms = fields.GetTerms(field);
+ Assert.IsNotNull(terms);
+ TermsEnum tis = terms.GetIterator(null);
+ while (tis.Next() != null)
+ {
+ @out.Write(" term=" + field + ":" + tis.Term);
+ @out.WriteLine(" DF=" + tis.DocFreq);
+
+ DocsAndPositionsEnum positions = tis.DocsAndPositions(reader.LiveDocs, null);
+
+ while (positions.NextDoc() != DocIdSetIterator.NO_MORE_DOCS)
+ {
+ @out.Write(" doc=" + positions.DocID);
+ @out.Write(" TF=" + positions.Freq);
+ @out.Write(" pos=");
+ @out.Write(positions.NextPosition());
+ for (int j = 1; j < positions.Freq; j++)
+ {
+ @out.Write("," + positions.NextPosition());
+ }
+ @out.WriteLine("");
+ }
+ }
+ }
+ reader.Dispose();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Index/TestDocCount.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDocCount.cs b/src/Lucene.Net.Tests/Index/TestDocCount.cs
new file mode 100644
index 0000000..3ac9a3c
--- /dev/null
+++ b/src/Lucene.Net.Tests/Index/TestDocCount.cs
@@ -0,0 +1,101 @@
+using System.Collections.Generic;
+using Lucene.Net.Documents;
+
+namespace Lucene.Net.Index
+{
+ using NUnit.Framework;
+ using Directory = Lucene.Net.Store.Directory;
+ using DocIdSetIterator = Lucene.Net.Search.DocIdSetIterator;
+
+ /*
+ * 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 Document = Documents.Document;
+ using Field = Field;
+ using FixedBitSet = Lucene.Net.Util.FixedBitSet;
+ using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+ using TestUtil = Lucene.Net.Util.TestUtil;
+
+ /// <summary>
+ /// Tests the Terms.DocCount statistic
+ /// </summary>
+ [SuppressCodecs("Lucene3x")]
+ [TestFixture]
+ public class TestDocCount : LuceneTestCase
+ {
+ [Test]
+ public virtual void TestSimple()
+ {
+ Directory dir = NewDirectory();
+ RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
+ int numDocs = AtLeast(100);
+ for (int i = 0; i < numDocs; i++)
+ {
+ iw.AddDocument(Doc());
+ }
+ IndexReader ir = iw.Reader;
+ VerifyCount(ir);
+ ir.Dispose();
+ iw.ForceMerge(1);
+ ir = iw.Reader;
+ VerifyCount(ir);
+ ir.Dispose();
+ iw.Dispose();
+ dir.Dispose();
+ }
+
+ private IEnumerable<IIndexableField> Doc()
+ {
+ Document doc = new Document();
+ int numFields = TestUtil.NextInt(Random(), 1, 10);
+ for (int i = 0; i < numFields; i++)
+ {
+ doc.Add(NewStringField("" + TestUtil.NextInt(Random(), 'a', 'z'), "" + TestUtil.NextInt(Random(), 'a', 'z'), Field.Store.NO));
+ }
+ return doc;
+ }
+
+ private void VerifyCount(IndexReader ir)
+ {
+ Fields fields = MultiFields.GetFields(ir);
+ if (fields == null)
+ {
+ return;
+ }
+ foreach (string field in fields)
+ {
+ Terms terms = fields.GetTerms(field);
+ if (terms == null)
+ {
+ continue;
+ }
+ int docCount = terms.DocCount;
+ FixedBitSet visited = new FixedBitSet(ir.MaxDoc);
+ TermsEnum te = terms.GetIterator(null);
+ while (te.Next() != null)
+ {
+ DocsEnum de = TestUtil.Docs(Random(), te, null, null, DocsEnum.FLAG_NONE);
+ while (de.NextDoc() != DocIdSetIterator.NO_MORE_DOCS)
+ {
+ visited.Set(de.DocID);
+ }
+ }
+ Assert.AreEqual(visited.Cardinality(), docCount);
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs b/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
new file mode 100644
index 0000000..0e498c8
--- /dev/null
+++ b/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
@@ -0,0 +1,148 @@
+using Lucene.Net.Documents;
+using Lucene.Net.Support;
+using System;
+using System.Text;
+
+namespace Lucene.Net.Index
+{
+ using NUnit.Framework;
+ using System.IO;
+
+ /*
+ * 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 Analyzer = Lucene.Net.Analysis.Analyzer;
+ using Directory = Lucene.Net.Store.Directory;
+ using Document = Documents.Document;
+ using FieldType = FieldType;
+ using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+ using MockTokenizer = Lucene.Net.Analysis.MockTokenizer;
+ using PrintStreamInfoStream = Lucene.Net.Util.PrintStreamInfoStream;
+ using TextField = TextField;
+ using TokenFilter = Lucene.Net.Analysis.TokenFilter;
+ using Tokenizer = Lucene.Net.Analysis.Tokenizer;
+
+ /// <summary>
+ /// Test adding to the info stream when there's an exception thrown during field analysis.
+ /// </summary>
+ [TestFixture]
+ public class TestDocInverterPerFieldErrorInfo : LuceneTestCase
+ {
+ private static readonly FieldType StoredTextType = new FieldType(TextField.TYPE_NOT_STORED);
+
+ private class BadNews : Exception
+ {
+ internal BadNews(string message)
+ : base(message)
+ {
+ }
+ }
+
+ private class ThrowingAnalyzer : Analyzer
+ {
+ protected internal override TokenStreamComponents CreateComponents(string fieldName, TextReader input)
+ {
+ Tokenizer tokenizer = new MockTokenizer(input);
+ if (fieldName.Equals("distinctiveFieldName"))
+ {
+ TokenFilter tosser = new TokenFilterAnonymousInnerClassHelper(this, tokenizer);
+ return new TokenStreamComponents(tokenizer, tosser);
+ }
+ else
+ {
+ return new TokenStreamComponents(tokenizer);
+ }
+ }
+
+ private class TokenFilterAnonymousInnerClassHelper : TokenFilter
+ {
+ private readonly ThrowingAnalyzer OuterInstance;
+
+ public TokenFilterAnonymousInnerClassHelper(ThrowingAnalyzer outerInstance, Tokenizer tokenizer)
+ : base(tokenizer)
+ {
+ this.OuterInstance = outerInstance;
+ }
+
+ public sealed override bool IncrementToken()
+ {
+ throw new BadNews("Something is icky.");
+ }
+ }
+ }
+
+ [Test]
+ public virtual void TestInfoStreamGetsFieldName()
+ {
+ Directory dir = NewDirectory();
+ IndexWriter writer;
+ IndexWriterConfig c = new IndexWriterConfig(TEST_VERSION_CURRENT, new ThrowingAnalyzer());
+ ByteArrayOutputStream infoBytes = new ByteArrayOutputStream();
+ StreamWriter infoPrintStream = new StreamWriter(infoBytes, Encoding.UTF8);
+ PrintStreamInfoStream printStreamInfoStream = new PrintStreamInfoStream(infoPrintStream);
+ c.InfoStream = printStreamInfoStream;
+ writer = new IndexWriter(dir, c);
+ Document doc = new Document();
+ doc.Add(NewField("distinctiveFieldName", "aaa ", StoredTextType));
+ try
+ {
+ writer.AddDocument(doc);
+ Assert.Fail("Failed to fail.");
+ }
+ catch (BadNews)
+ {
+ infoPrintStream.Flush();
+ string infoStream = Encoding.UTF8.GetString(infoBytes.ToArray());
+ Assert.IsTrue(infoStream.Contains("distinctiveFieldName"));
+ }
+
+ writer.Dispose();
+ dir.Dispose();
+ }
+
+ [Test]
+ public virtual void TestNoExtraNoise()
+ {
+ Directory dir = NewDirectory();
+ IndexWriter writer;
+ IndexWriterConfig c = new IndexWriterConfig(TEST_VERSION_CURRENT, new ThrowingAnalyzer());
+ ByteArrayOutputStream infoBytes = new ByteArrayOutputStream();
+ StreamWriter infoPrintStream = new StreamWriter(infoBytes, Encoding.UTF8);
+ PrintStreamInfoStream printStreamInfoStream = new PrintStreamInfoStream(infoPrintStream);
+ c.InfoStream = printStreamInfoStream;
+ writer = new IndexWriter(dir, c);
+ Document doc = new Document();
+ doc.Add(NewField("boringFieldName", "aaa ", StoredTextType));
+ try
+ {
+ writer.AddDocument(doc);
+ }
+#pragma warning disable 168
+ catch (BadNews badNews)
+#pragma warning restore 168
+ {
+ Assert.Fail("Unwanted exception");
+ }
+ infoPrintStream.Flush();
+ string infoStream = Encoding.UTF8.GetString(infoBytes.ToArray());
+ Assert.IsFalse(infoStream.Contains("boringFieldName"));
+
+ writer.Dispose();
+ dir.Dispose();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Index/TestDocTermOrds.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDocTermOrds.cs b/src/Lucene.Net.Tests/Index/TestDocTermOrds.cs
new file mode 100644
index 0000000..1ea4d2b
--- /dev/null
+++ b/src/Lucene.Net.Tests/Index/TestDocTermOrds.cs
@@ -0,0 +1,541 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Lucene.Net.Documents;
+using Lucene.Net.Search;
+
+namespace Lucene.Net.Index
+{
+ using Attributes;
+ using NUnit.Framework;
+
+ /*
+ * 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 Analyzer = Lucene.Net.Analysis.Analyzer;
+ using BytesRef = Lucene.Net.Util.BytesRef;
+ using Codec = Lucene.Net.Codecs.Codec;
+ using Directory = Lucene.Net.Store.Directory;
+ using Document = Documents.Document;
+ using Field = Field;
+ using Int32Field = Int32Field;
+ using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+ using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
+ using PostingsFormat = Lucene.Net.Codecs.PostingsFormat;
+ using SeekStatus = Lucene.Net.Index.TermsEnum.SeekStatus;
+ using StringField = StringField;
+ using StringHelper = Lucene.Net.Util.StringHelper;
+ using TestUtil = Lucene.Net.Util.TestUtil;
+
+ // TODO:
+ // - test w/ del docs
+ // - test prefix
+ // - test w/ cutoff
+ // - crank docs way up so we get some merging sometimes
+ [TestFixture]
+ public class TestDocTermOrds : LuceneTestCase
+ {
+ [Test]
+ public virtual void TestSimple()
+ {
+ Directory dir = NewDirectory();
+ RandomIndexWriter w = new RandomIndexWriter(Random(), dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergePolicy(NewLogMergePolicy()));
+ Document doc = new Document();
+ Field field = NewTextField("field", "", Field.Store.NO);
+ doc.Add(field);
+ field.SetStringValue("a b c");
+ w.AddDocument(doc);
+
+ field.SetStringValue("d e f");
+ w.AddDocument(doc);
+
+ field.SetStringValue("a f");
+ w.AddDocument(doc);
+
+ IndexReader r = w.Reader;
+ w.Dispose();
+
+ AtomicReader ar = SlowCompositeReaderWrapper.Wrap(r);
+ DocTermOrds dto = new DocTermOrds(ar, ar.LiveDocs, "field");
+ SortedSetDocValues iter = dto.GetIterator(ar);
+
+ iter.SetDocument(0);
+ Assert.AreEqual(0, iter.NextOrd());
+ Assert.AreEqual(1, iter.NextOrd());
+ Assert.AreEqual(2, iter.NextOrd());
+ Assert.AreEqual(SortedSetDocValues.NO_MORE_ORDS, iter.NextOrd());
+
+ iter.SetDocument(1);
+ Assert.AreEqual(3, iter.NextOrd());
+ Assert.AreEqual(4, iter.NextOrd());
+ Assert.AreEqual(5, iter.NextOrd());
+ Assert.AreEqual(SortedSetDocValues.NO_MORE_ORDS, iter.NextOrd());
+
+ iter.SetDocument(2);
+ Assert.AreEqual(0, iter.NextOrd());
+ Assert.AreEqual(5, iter.NextOrd());
+ Assert.AreEqual(SortedSetDocValues.NO_MORE_ORDS, iter.NextOrd());
+
+ r.Dispose();
+ dir.Dispose();
+ }
+
+ [Test]
+ public virtual void TestRandom()
+ {
+ Directory dir = NewDirectory();
+
+ int NUM_TERMS = AtLeast(20);
+ HashSet<BytesRef> terms = new HashSet<BytesRef>();
+ while (terms.Count < NUM_TERMS)
+ {
+ string s = TestUtil.RandomRealisticUnicodeString(Random());
+ //final String s = TestUtil.RandomSimpleString(random);
+ if (s.Length > 0)
+ {
+ terms.Add(new BytesRef(s));
+ }
+ }
+ BytesRef[] termsArray = terms.ToArray(/*new BytesRef[terms.Count]*/);
+ Array.Sort(termsArray);
+
+ int NUM_DOCS = AtLeast(100);
+
+ IndexWriterConfig conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()));
+
+ // Sometimes swap in codec that impls ord():
+ if (Random().Next(10) == 7)
+ {
+ // Make sure terms index has ords:
+ Codec codec = TestUtil.AlwaysPostingsFormat(PostingsFormat.ForName("Lucene41WithOrds"));
+ conf.SetCodec(codec);
+ }
+
+ RandomIndexWriter w = new RandomIndexWriter(Random(), dir, conf);
+
+ int[][] idToOrds = new int[NUM_DOCS][];
+ HashSet<int?> ordsForDocSet = new HashSet<int?>();
+
+ for (int id = 0; id < NUM_DOCS; id++)
+ {
+ Document doc = new Document();
+
+ doc.Add(new Int32Field("id", id, Field.Store.NO));
+
+ int termCount = TestUtil.NextInt(Random(), 0, 20 * RANDOM_MULTIPLIER);
+ while (ordsForDocSet.Count < termCount)
+ {
+ ordsForDocSet.Add(Random().Next(termsArray.Length));
+ }
+ int[] ordsForDoc = new int[termCount];
+ int upto = 0;
+ if (VERBOSE)
+ {
+ Console.WriteLine("TEST: doc id=" + id);
+ }
+ foreach (int ord in ordsForDocSet)
+ {
+ ordsForDoc[upto++] = ord;
+ Field field = NewStringField("field", termsArray[ord].Utf8ToString(), Field.Store.NO);
+ if (VERBOSE)
+ {
+ Console.WriteLine(" f=" + termsArray[ord].Utf8ToString());
+ }
+ doc.Add(field);
+ }
+ ordsForDocSet.Clear();
+ Array.Sort(ordsForDoc);
+ idToOrds[id] = ordsForDoc;
+ w.AddDocument(doc);
+ }
+
+ DirectoryReader r = w.Reader;
+ w.Dispose();
+
+ if (VERBOSE)
+ {
+ Console.WriteLine("TEST: reader=" + r);
+ }
+
+ foreach (AtomicReaderContext ctx in r.Leaves)
+ {
+ if (VERBOSE)
+ {
+ Console.WriteLine("\nTEST: sub=" + ctx.Reader);
+ }
+ Verify((AtomicReader)ctx.Reader, idToOrds, termsArray, null);
+ }
+
+ // Also test top-level reader: its enum does not support
+ // ord, so this forces the OrdWrapper to run:
+ if (VERBOSE)
+ {
+ Console.WriteLine("TEST: top reader");
+ }
+ AtomicReader slowR = SlowCompositeReaderWrapper.Wrap(r);
+ Verify(slowR, idToOrds, termsArray, null);
+
+ FieldCache.DEFAULT.PurgeByCacheKey(slowR.CoreCacheKey);
+
+ r.Dispose();
+ dir.Dispose();
+ }
+
+#if !NETSTANDARD
+ // LUCENENET: There is no Timeout on NUnit for .NET Core.
+ [Timeout(300000)]
+#endif
+ [Test, HasTimeout]
+ public virtual void TestRandomWithPrefix()
+ {
+ Directory dir = NewDirectory();
+
+ HashSet<string> prefixes = new HashSet<string>();
+ int numPrefix = TestUtil.NextInt(Random(), 2, 7);
+ if (VERBOSE)
+ {
+ Console.WriteLine("TEST: use " + numPrefix + " prefixes");
+ }
+ while (prefixes.Count < numPrefix)
+ {
+ prefixes.Add(TestUtil.RandomRealisticUnicodeString(Random()));
+ //prefixes.Add(TestUtil.RandomSimpleString(random));
+ }
+ string[] prefixesArray = prefixes.ToArray(/*new string[prefixes.Count]*/);
+
+ int NUM_TERMS = AtLeast(20);
+ HashSet<BytesRef> terms = new HashSet<BytesRef>();
+ while (terms.Count < NUM_TERMS)
+ {
+ string s = prefixesArray[Random().Next(prefixesArray.Length)] + TestUtil.RandomRealisticUnicodeString(Random());
+ //final String s = prefixesArray[random.nextInt(prefixesArray.Length)] + TestUtil.RandomSimpleString(random);
+ if (s.Length > 0)
+ {
+ terms.Add(new BytesRef(s));
+ }
+ }
+ BytesRef[] termsArray = terms.ToArray();
+ Array.Sort(termsArray);
+
+ int NUM_DOCS = AtLeast(100);
+
+ IndexWriterConfig conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()));
+
+ // Sometimes swap in codec that impls ord():
+ if (Random().Next(10) == 7)
+ {
+ Codec codec = TestUtil.AlwaysPostingsFormat(PostingsFormat.ForName("Lucene41WithOrds"));
+ conf.SetCodec(codec);
+ }
+
+ RandomIndexWriter w = new RandomIndexWriter(Random(), dir, conf);
+
+ int[][] idToOrds = new int[NUM_DOCS][];
+ HashSet<int?> ordsForDocSet = new HashSet<int?>();
+
+ for (int id = 0; id < NUM_DOCS; id++)
+ {
+ Document doc = new Document();
+
+ doc.Add(new Int32Field("id", id, Field.Store.NO));
+
+ int termCount = TestUtil.NextInt(Random(), 0, 20 * RANDOM_MULTIPLIER);
+ while (ordsForDocSet.Count < termCount)
+ {
+ ordsForDocSet.Add(Random().Next(termsArray.Length));
+ }
+ int[] ordsForDoc = new int[termCount];
+ int upto = 0;
+ if (VERBOSE)
+ {
+ Console.WriteLine("TEST: doc id=" + id);
+ }
+ foreach (int ord in ordsForDocSet)
+ {
+ ordsForDoc[upto++] = ord;
+ Field field = NewStringField("field", termsArray[ord].Utf8ToString(), Field.Store.NO);
+ if (VERBOSE)
+ {
+ Console.WriteLine(" f=" + termsArray[ord].Utf8ToString());
+ }
+ doc.Add(field);
+ }
+ ordsForDocSet.Clear();
+ Array.Sort(ordsForDoc);
+ idToOrds[id] = ordsForDoc;
+ w.AddDocument(doc);
+ }
+
+ DirectoryReader r = w.Reader;
+ w.Dispose();
+
+ if (VERBOSE)
+ {
+ Console.WriteLine("TEST: reader=" + r);
+ }
+
+ AtomicReader slowR = SlowCompositeReaderWrapper.Wrap(r);
+ foreach (string prefix in prefixesArray)
+ {
+ BytesRef prefixRef = prefix == null ? null : new BytesRef(prefix);
+
+ int[][] idToOrdsPrefix = new int[NUM_DOCS][];
+ for (int id = 0; id < NUM_DOCS; id++)
+ {
+ int[] docOrds = idToOrds[id];
+ IList<int?> newOrds = new List<int?>();
+ foreach (int ord in idToOrds[id])
+ {
+ if (StringHelper.StartsWith(termsArray[ord], prefixRef))
+ {
+ newOrds.Add(ord);
+ }
+ }
+ int[] newOrdsArray = new int[newOrds.Count];
+ int upto = 0;
+ foreach (int ord in newOrds)
+ {
+ newOrdsArray[upto++] = ord;
+ }
+ idToOrdsPrefix[id] = newOrdsArray;
+ }
+
+ foreach (AtomicReaderContext ctx in r.Leaves)
+ {
+ if (VERBOSE)
+ {
+ Console.WriteLine("\nTEST: sub=" + ctx.Reader);
+ }
+ Verify((AtomicReader)ctx.Reader, idToOrdsPrefix, termsArray, prefixRef);
+ }
+
+ // Also test top-level reader: its enum does not support
+ // ord, so this forces the OrdWrapper to run:
+ if (VERBOSE)
+ {
+ Console.WriteLine("TEST: top reader");
+ }
+ Verify(slowR, idToOrdsPrefix, termsArray, prefixRef);
+ }
+
+ FieldCache.DEFAULT.PurgeByCacheKey(slowR.CoreCacheKey);
+
+ r.Dispose();
+ dir.Dispose();
+ }
+
+ private void Verify(AtomicReader r, int[][] idToOrds, BytesRef[] termsArray, BytesRef prefixRef)
+ {
+ DocTermOrds dto = new DocTermOrds(r, r.LiveDocs, "field", prefixRef, int.MaxValue, TestUtil.NextInt(Random(), 2, 10));
+
+ FieldCache.Int32s docIDToID = FieldCache.DEFAULT.GetInt32s(r, "id", false);
+ /*
+ for(int docID=0;docID<subR.MaxDoc;docID++) {
+ System.out.println(" docID=" + docID + " id=" + docIDToID[docID]);
+ }
+ */
+
+ if (VERBOSE)
+ {
+ Console.WriteLine("TEST: verify prefix=" + (prefixRef == null ? "null" : prefixRef.Utf8ToString()));
+ Console.WriteLine("TEST: all TERMS:");
+ TermsEnum allTE = MultiFields.GetTerms(r, "field").GetIterator(null);
+ int ord = 0;
+ while (allTE.Next() != null)
+ {
+ Console.WriteLine(" ord=" + (ord++) + " term=" + allTE.Term.Utf8ToString());
+ }
+ }
+
+ //final TermsEnum te = subR.Fields.Terms("field").iterator();
+ TermsEnum te = dto.GetOrdTermsEnum(r);
+ if (dto.NumTerms == 0)
+ {
+ if (prefixRef == null)
+ {
+ Assert.IsNull(MultiFields.GetTerms(r, "field"));
+ }
+ else
+ {
+ Terms terms = MultiFields.GetTerms(r, "field");
+ if (terms != null)
+ {
+ TermsEnum termsEnum = terms.GetIterator(null);
+ TermsEnum.SeekStatus result = termsEnum.SeekCeil(prefixRef);
+ if (result != TermsEnum.SeekStatus.END)
+ {
+ Assert.IsFalse(StringHelper.StartsWith(termsEnum.Term, prefixRef), "term=" + termsEnum.Term.Utf8ToString() + " matches prefix=" + prefixRef.Utf8ToString());
+ }
+ else
+ {
+ // ok
+ }
+ }
+ else
+ {
+ // ok
+ }
+ }
+ return;
+ }
+
+ if (VERBOSE)
+ {
+ Console.WriteLine("TEST: TERMS:");
+ te.SeekExact(0);
+ while (true)
+ {
+ Console.WriteLine(" ord=" + te.Ord + " term=" + te.Term.Utf8ToString());
+ if (te.Next() == null)
+ {
+ break;
+ }
+ }
+ }
+
+ SortedSetDocValues iter = dto.GetIterator(r);
+ for (int docID = 0; docID < r.MaxDoc; docID++)
+ {
+ if (VERBOSE)
+ {
+ Console.WriteLine("TEST: docID=" + docID + " of " + r.MaxDoc + " (id=" + docIDToID.Get(docID) + ")");
+ }
+ iter.SetDocument(docID);
+ int[] answers = idToOrds[docIDToID.Get(docID)];
+ int upto = 0;
+ long ord;
+ while ((ord = iter.NextOrd()) != SortedSetDocValues.NO_MORE_ORDS)
+ {
+ te.SeekExact(ord);
+ BytesRef expected = termsArray[answers[upto++]];
+ if (VERBOSE)
+ {
+ Console.WriteLine(" exp=" + expected.Utf8ToString() + " actual=" + te.Term.Utf8ToString());
+ }
+ Assert.AreEqual(expected, te.Term, "expected=" + expected.Utf8ToString() + " actual=" + te.Term.Utf8ToString() + " ord=" + ord);
+ }
+ Assert.AreEqual(answers.Length, upto);
+ }
+ }
+
+ [Test]
+ public virtual void TestBackToTheFuture()
+ {
+ Directory dir = NewDirectory();
+ IndexWriter iw = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, null));
+
+ Document doc = new Document();
+ doc.Add(NewStringField("foo", "bar", Field.Store.NO));
+ iw.AddDocument(doc);
+
+ doc = new Document();
+ doc.Add(NewStringField("foo", "baz", Field.Store.NO));
+ iw.AddDocument(doc);
+
+ DirectoryReader r1 = DirectoryReader.Open(iw, true);
+
+ iw.DeleteDocuments(new Term("foo", "baz"));
+ DirectoryReader r2 = DirectoryReader.Open(iw, true);
+
+ FieldCache.DEFAULT.GetDocTermOrds(GetOnlySegmentReader(r2), "foo");
+
+ SortedSetDocValues v = FieldCache.DEFAULT.GetDocTermOrds(GetOnlySegmentReader(r1), "foo");
+ Assert.AreEqual(2, v.ValueCount);
+ v.SetDocument(1);
+ Assert.AreEqual(1, v.NextOrd());
+
+ iw.Dispose();
+ r1.Dispose();
+ r2.Dispose();
+ dir.Dispose();
+ }
+
+ [Test]
+ public virtual void TestSortedTermsEnum()
+ {
+ Directory directory = NewDirectory();
+ Analyzer analyzer = new MockAnalyzer(Random());
+ IndexWriterConfig iwconfig = NewIndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
+ iwconfig.SetMergePolicy(NewLogMergePolicy());
+ RandomIndexWriter iwriter = new RandomIndexWriter(Random(), directory, iwconfig);
+
+ Document doc = new Document();
+ doc.Add(new StringField("field", "hello", Field.Store.NO));
+ iwriter.AddDocument(doc);
+
+ doc = new Document();
+ doc.Add(new StringField("field", "world", Field.Store.NO));
+ iwriter.AddDocument(doc);
+
+ doc = new Document();
+ doc.Add(new StringField("field", "beer", Field.Store.NO));
+ iwriter.AddDocument(doc);
+ iwriter.ForceMerge(1);
+
+ DirectoryReader ireader = iwriter.Reader;
+ iwriter.Dispose();
+
+ AtomicReader ar = GetOnlySegmentReader(ireader);
+ SortedSetDocValues dv = FieldCache.DEFAULT.GetDocTermOrds(ar, "field");
+ Assert.AreEqual(3, dv.ValueCount);
+
+ TermsEnum termsEnum = dv.GetTermsEnum();
+
+ // next()
+ Assert.AreEqual("beer", termsEnum.Next().Utf8ToString());
+ Assert.AreEqual(0, termsEnum.Ord);
+ Assert.AreEqual("hello", termsEnum.Next().Utf8ToString());
+ Assert.AreEqual(1, termsEnum.Ord);
+ Assert.AreEqual("world", termsEnum.Next().Utf8ToString());
+ Assert.AreEqual(2, termsEnum.Ord);
+
+ // seekCeil()
+ Assert.AreEqual(SeekStatus.NOT_FOUND, termsEnum.SeekCeil(new BytesRef("ha!")));
+ Assert.AreEqual("hello", termsEnum.Term.Utf8ToString());
+ Assert.AreEqual(1, termsEnum.Ord);
+ Assert.AreEqual(SeekStatus.FOUND, termsEnum.SeekCeil(new BytesRef("beer")));
+ Assert.AreEqual("beer", termsEnum.Term.Utf8ToString());
+ Assert.AreEqual(0, termsEnum.Ord);
+ Assert.AreEqual(SeekStatus.END, termsEnum.SeekCeil(new BytesRef("zzz")));
+
+ // seekExact()
+ Assert.IsTrue(termsEnum.SeekExact(new BytesRef("beer")));
+ Assert.AreEqual("beer", termsEnum.Term.Utf8ToString());
+ Assert.AreEqual(0, termsEnum.Ord);
+ Assert.IsTrue(termsEnum.SeekExact(new BytesRef("hello")));
+ Assert.AreEqual("hello", termsEnum.Term.Utf8ToString());
+ Assert.AreEqual(1, termsEnum.Ord);
+ Assert.IsTrue(termsEnum.SeekExact(new BytesRef("world")));
+ Assert.AreEqual("world", termsEnum.Term.Utf8ToString());
+ Assert.AreEqual(2, termsEnum.Ord);
+ Assert.IsFalse(termsEnum.SeekExact(new BytesRef("bogus")));
+
+ // seek(ord)
+ termsEnum.SeekExact(0);
+ Assert.AreEqual("beer", termsEnum.Term.Utf8ToString());
+ Assert.AreEqual(0, termsEnum.Ord);
+ termsEnum.SeekExact(1);
+ Assert.AreEqual("hello", termsEnum.Term.Utf8ToString());
+ Assert.AreEqual(1, termsEnum.Ord);
+ termsEnum.SeekExact(2);
+ Assert.AreEqual("world", termsEnum.Term.Utf8ToString());
+ Assert.AreEqual(2, termsEnum.Ord);
+ ireader.Dispose();
+ directory.Dispose();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/96822396/src/Lucene.Net.Tests/Index/TestDocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDocValuesFormat.cs b/src/Lucene.Net.Tests/Index/TestDocValuesFormat.cs
new file mode 100644
index 0000000..628ddc0
--- /dev/null
+++ b/src/Lucene.Net.Tests/Index/TestDocValuesFormat.cs
@@ -0,0 +1,546 @@
+using NUnit.Framework;
+
+namespace Lucene.Net.Index
+{
+ /*
+ * 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 Codec = Lucene.Net.Codecs.Codec;
+ using TestUtil = Lucene.Net.Util.TestUtil;
+
+ /// <summary>
+ /// Tests the codec configuration defined by LuceneTestCase randomly
+ /// (typically a mix across different fields).
+ /// </summary>
+ [SuppressCodecs("Lucene3x")]
+ public class TestDocValuesFormat : BaseDocValuesFormatTestCase
+ {
+ protected override Codec Codec
+ {
+ get
+ {
+ return Codec.Default;
+ }
+ }
+
+ protected internal override bool CodecAcceptsHugeBinaryValues(string field)
+ {
+ return TestUtil.FieldSupportsHugeBinaryDocValues(field);
+ }
+
+
+ #region BaseDocValuesFormatTestCase
+ // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+ // context in Visual Studio. This fixes that with the minimum amount of code necessary
+ // to run them in the correct context without duplicating all of the tests.
+
+ [Test]
+ public override void TestOneNumber()
+ {
+ base.TestOneNumber();
+ }
+
+ [Test]
+ public override void TestOneFloat()
+ {
+ base.TestOneFloat();
+ }
+
+ [Test]
+ public override void TestTwoNumbers()
+ {
+ base.TestTwoNumbers();
+ }
+
+ [Test]
+ public override void TestTwoBinaryValues()
+ {
+ base.TestTwoBinaryValues();
+ }
+
+ [Test]
+ public override void TestTwoFieldsMixed()
+ {
+ base.TestTwoFieldsMixed();
+ }
+
+ [Test]
+ public override void TestThreeFieldsMixed()
+ {
+ base.TestThreeFieldsMixed();
+ }
+
+ [Test]
+ public override void TestThreeFieldsMixed2()
+ {
+ base.TestThreeFieldsMixed2();
+ }
+
+ [Test]
+ public override void TestTwoDocumentsNumeric()
+ {
+ base.TestTwoDocumentsNumeric();
+ }
+
+ [Test]
+ public override void TestTwoDocumentsMerged()
+ {
+ base.TestTwoDocumentsMerged();
+ }
+
+ [Test]
+ public override void TestBigNumericRange()
+ {
+ base.TestBigNumericRange();
+ }
+
+ [Test]
+ public override void TestBigNumericRange2()
+ {
+ base.TestBigNumericRange2();
+ }
+
+ [Test]
+ public override void TestBytes()
+ {
+ base.TestBytes();
+ }
+
+ [Test]
+ public override void TestBytesTwoDocumentsMerged()
+ {
+ base.TestBytesTwoDocumentsMerged();
+ }
+
+ [Test]
+ public override void TestSortedBytes()
+ {
+ base.TestSortedBytes();
+ }
+
+ [Test]
+ public override void TestSortedBytesTwoDocuments()
+ {
+ base.TestSortedBytesTwoDocuments();
+ }
+
+ [Test]
+ public override void TestSortedBytesThreeDocuments()
+ {
+ base.TestSortedBytesThreeDocuments();
+ }
+
+ [Test]
+ public override void TestSortedBytesTwoDocumentsMerged()
+ {
+ base.TestSortedBytesTwoDocumentsMerged();
+ }
+
+ [Test]
+ public override void TestSortedMergeAwayAllValues()
+ {
+ base.TestSortedMergeAwayAllValues();
+ }
+
+ [Test]
+ public override void TestBytesWithNewline()
+ {
+ base.TestBytesWithNewline();
+ }
+
+ [Test]
+ public override void TestMissingSortedBytes()
+ {
+ base.TestMissingSortedBytes();
+ }
+
+ [Test]
+ public override void TestSortedTermsEnum()
+ {
+ base.TestSortedTermsEnum();
+ }
+
+ [Test]
+ public override void TestEmptySortedBytes()
+ {
+ base.TestEmptySortedBytes();
+ }
+
+ [Test]
+ public override void TestEmptyBytes()
+ {
+ base.TestEmptyBytes();
+ }
+
+ [Test]
+ public override void TestVeryLargeButLegalBytes()
+ {
+ base.TestVeryLargeButLegalBytes();
+ }
+
+ [Test]
+ public override void TestVeryLargeButLegalSortedBytes()
+ {
+ base.TestVeryLargeButLegalSortedBytes();
+ }
+
+ [Test]
+ public override void TestCodecUsesOwnBytes()
+ {
+ base.TestCodecUsesOwnBytes();
+ }
+
+ [Test]
+ public override void TestCodecUsesOwnSortedBytes()
+ {
+ base.TestCodecUsesOwnSortedBytes();
+ }
+
+ [Test]
+ public override void TestCodecUsesOwnBytesEachTime()
+ {
+ base.TestCodecUsesOwnBytesEachTime();
+ }
+
+ [Test]
+ public override void TestCodecUsesOwnSortedBytesEachTime()
+ {
+ base.TestCodecUsesOwnSortedBytesEachTime();
+ }
+
+ /*
+ * Simple test case to show how to use the API
+ */
+ [Test]
+ public override void TestDocValuesSimple()
+ {
+ base.TestDocValuesSimple();
+ }
+
+ [Test]
+ public override void TestRandomSortedBytes()
+ {
+ base.TestRandomSortedBytes();
+ }
+
+ [Test]
+ public override void TestBooleanNumericsVsStoredFields()
+ {
+ base.TestBooleanNumericsVsStoredFields();
+ }
+
+ [Test]
+ public override void TestByteNumericsVsStoredFields()
+ {
+ base.TestByteNumericsVsStoredFields();
+ }
+
+ [Test]
+ public override void TestByteMissingVsFieldCache()
+ {
+ base.TestByteMissingVsFieldCache();
+ }
+
+ [Test]
+ public override void TestShortNumericsVsStoredFields()
+ {
+ base.TestShortNumericsVsStoredFields();
+ }
+
+ [Test]
+ public override void TestShortMissingVsFieldCache()
+ {
+ base.TestShortMissingVsFieldCache();
+ }
+
+ [Test]
+ public override void TestIntNumericsVsStoredFields()
+ {
+ base.TestIntNumericsVsStoredFields();
+ }
+
+ [Test]
+ public override void TestIntMissingVsFieldCache()
+ {
+ base.TestIntMissingVsFieldCache();
+ }
+
+ [Test]
+ public override void TestLongNumericsVsStoredFields()
+ {
+ base.TestLongNumericsVsStoredFields();
+ }
+
+ [Test]
+ public override void TestLongMissingVsFieldCache()
+ {
+ base.TestLongMissingVsFieldCache();
+ }
+
+ [Test]
+ public override void TestBinaryFixedLengthVsStoredFields()
+ {
+ base.TestBinaryFixedLengthVsStoredFields();
+ }
+
+ [Test]
+ public override void TestBinaryVariableLengthVsStoredFields()
+ {
+ base.TestBinaryVariableLengthVsStoredFields();
+ }
+
+ [Test]
+ public override void TestSortedFixedLengthVsStoredFields()
+ {
+ base.TestSortedFixedLengthVsStoredFields();
+ }
+
+ [Test]
+ public override void TestSortedFixedLengthVsFieldCache()
+ {
+ base.TestSortedFixedLengthVsFieldCache();
+ }
+
+ [Test]
+ public override void TestSortedVariableLengthVsFieldCache()
+ {
+ base.TestSortedVariableLengthVsFieldCache();
+ }
+
+ [Test]
+ public override void TestSortedVariableLengthVsStoredFields()
+ {
+ base.TestSortedVariableLengthVsStoredFields();
+ }
+
+ [Test]
+ public override void TestSortedSetOneValue()
+ {
+ base.TestSortedSetOneValue();
+ }
+
+ [Test]
+ public override void TestSortedSetTwoFields()
+ {
+ base.TestSortedSetTwoFields();
+ }
+
+ [Test]
+ public override void TestSortedSetTwoDocumentsMerged()
+ {
+ base.TestSortedSetTwoDocumentsMerged();
+ }
+
+ [Test]
+ public override void TestSortedSetTwoValues()
+ {
+ base.TestSortedSetTwoValues();
+ }
+
+ [Test]
+ public override void TestSortedSetTwoValuesUnordered()
+ {
+ base.TestSortedSetTwoValuesUnordered();
+ }
+
+ [Test]
+ public override void TestSortedSetThreeValuesTwoDocs()
+ {
+ base.TestSortedSetThreeValuesTwoDocs();
+ }
+
+ [Test]
+ public override void TestSortedSetTwoDocumentsLastMissing()
+ {
+ base.TestSortedSetTwoDocumentsLastMissing();
+ }
+
+ [Test]
+ public override void TestSortedSetTwoDocumentsLastMissingMerge()
+ {
+ base.TestSortedSetTwoDocumentsLastMissingMerge();
+ }
+
+ [Test]
+ public override void TestSortedSetTwoDocumentsFirstMissing()
+ {
+ base.TestSortedSetTwoDocumentsFirstMissing();
+ }
+
+ [Test]
+ public override void TestSortedSetTwoDocumentsFirstMissingMerge()
+ {
+ base.TestSortedSetTwoDocumentsFirstMissingMerge();
+ }
+
+ [Test]
+ public override void TestSortedSetMergeAwayAllValues()
+ {
+ base.TestSortedSetMergeAwayAllValues();
+ }
+
+ [Test]
+ public override void TestSortedSetTermsEnum()
+ {
+ base.TestSortedSetTermsEnum();
+ }
+
+ [Test]
+ public override void TestSortedSetFixedLengthVsStoredFields()
+ {
+ base.TestSortedSetFixedLengthVsStoredFields();
+ }
+
+ [Test]
+ public override void TestSortedSetVariableLengthVsStoredFields()
+ {
+ base.TestSortedSetVariableLengthVsStoredFields();
+ }
+
+ [Test]
+ public override void TestSortedSetFixedLengthSingleValuedVsStoredFields()
+ {
+ base.TestSortedSetFixedLengthSingleValuedVsStoredFields();
+ }
+
+ [Test]
+ public override void TestSortedSetVariableLengthSingleValuedVsStoredFields()
+ {
+ base.TestSortedSetVariableLengthSingleValuedVsStoredFields();
+ }
+
+ [Test]
+ public override void TestSortedSetFixedLengthVsUninvertedField()
+ {
+ base.TestSortedSetFixedLengthVsUninvertedField();
+ }
+
+ [Test]
+ public override void TestSortedSetVariableLengthVsUninvertedField()
+ {
+ base.TestSortedSetVariableLengthVsUninvertedField();
+ }
+
+ [Test]
+ public override void TestGCDCompression()
+ {
+ base.TestGCDCompression();
+ }
+
+ [Test]
+ public override void TestZeros()
+ {
+ base.TestZeros();
+ }
+
+ [Test]
+ public override void TestZeroOrMin()
+ {
+ base.TestZeroOrMin();
+ }
+
+ [Test]
+ public override void TestTwoNumbersOneMissing()
+ {
+ base.TestTwoNumbersOneMissing();
+ }
+
+ [Test]
+ public override void TestTwoNumbersOneMissingWithMerging()
+ {
+ base.TestTwoNumbersOneMissingWithMerging();
+ }
+
+ [Test]
+ public override void TestThreeNumbersOneMissingWithMerging()
+ {
+ base.TestThreeNumbersOneMissingWithMerging();
+ }
+
+ [Test]
+ public override void TestTwoBytesOneMissing()
+ {
+ base.TestTwoBytesOneMissing();
+ }
+
+ [Test]
+ public override void TestTwoBytesOneMissingWithMerging()
+ {
+ base.TestTwoBytesOneMissingWithMerging();
+ }
+
+ [Test]
+ public override void TestThreeBytesOneMissingWithMerging()
+ {
+ base.TestThreeBytesOneMissingWithMerging();
+ }
+
+ // LUCENE-4853
+ [Test]
+ public override void TestHugeBinaryValues()
+ {
+ base.TestHugeBinaryValues();
+ }
+
+ // TODO: get this out of here and into the deprecated codecs (4.0, 4.2)
+ [Test]
+ public override void TestHugeBinaryValueLimit()
+ {
+ base.TestHugeBinaryValueLimit();
+ }
+
+ /// <summary>
+ /// Tests dv against stored fields with threads (binary/numeric/sorted, no missing)
+ /// </summary>
+ [Test]
+ public override void TestThreads()
+ {
+ base.TestThreads();
+ }
+
+ /// <summary>
+ /// Tests dv against stored fields with threads (all types + missing)
+ /// </summary>
+ [Test]
+ public override void TestThreads2()
+ {
+ base.TestThreads2();
+ }
+
+ // LUCENE-5218
+ [Test]
+ public override void TestEmptyBinaryValueOnPageSizes()
+ {
+ base.TestEmptyBinaryValueOnPageSizes();
+ }
+
+ #endregion
+
+ #region BaseIndexFileFormatTestCase
+ // LUCENENET NOTE: Tests in an abstract base class are not pulled into the correct
+ // context in Visual Studio. This fixes that with the minimum amount of code necessary
+ // to run them in the correct context without duplicating all of the tests.
+
+ [Test]
+ public override void TestMergeStability()
+ {
+ base.TestMergeStability();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file