lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r940959 - /lucene/lucene.net/trunk/C#/src/Test/TestSupportClass.cs
Date Tue, 04 May 2010 17:03:26 GMT
Author: digy
Date: Tue May  4 17:03:25 2010
New Revision: 940959

URL: http://svn.apache.org/viewvc?rev=940959&view=rev
Log:
Test case for LUCENENET-183 (SegmentTermVector IndexOf method always fails)

Modified:
    lucene/lucene.net/trunk/C#/src/Test/TestSupportClass.cs

Modified: lucene/lucene.net/trunk/C#/src/Test/TestSupportClass.cs
URL: http://svn.apache.org/viewvc/lucene/lucene.net/trunk/C%23/src/Test/TestSupportClass.cs?rev=940959&r1=940958&r2=940959&view=diff
==============================================================================
--- lucene/lucene.net/trunk/C#/src/Test/TestSupportClass.cs (original)
+++ lucene/lucene.net/trunk/C#/src/Test/TestSupportClass.cs Tue May  4 17:03:25 2010
@@ -827,6 +827,24 @@ namespace Lucene.Net._SupportClass
     {
         //-------------------------------------------
         [Test]
+        [Description("LUCENENET-183")]
+        public void Test_SegmentTermVector_IndexOf()
+        {
+            Lucene.Net.Store.RAMDirectory directory = new Lucene.Net.Store.RAMDirectory();
+            Lucene.Net.Analysis.Analyzer analyzer = new Lucene.Net.Analysis.WhitespaceAnalyzer();
+            Lucene.Net.Index.IndexWriter writer = new Lucene.Net.Index.IndexWriter(directory,
analyzer, Lucene.Net.Index.IndexWriter.MaxFieldLength.LIMITED);
+            Lucene.Net.Documents.Document document = new Lucene.Net.Documents.Document();
+            document.Add(new Lucene.Net.Documents.Field("contents", new System.IO.StreamReader(new
System.IO.MemoryStream(System.Text.Encoding.ASCII.GetBytes("a_ a0"))), Lucene.Net.Documents.Field.TermVector.WITH_OFFSETS));
+            writer.AddDocument(document);
+            Lucene.Net.Index.IndexReader reader = writer.GetReader();
+            Lucene.Net.Index.TermPositionVector tpv = reader.GetTermFreqVector(0, "contents")
as Lucene.Net.Index.TermPositionVector;
+            //Console.WriteLine("tpv: " + tpv);
+            int index = tpv.IndexOf("a_");
+            Assert.AreEqual(index, 1, "See the issue: LUCENENET-183");
+        }
+
+        //-------------------------------------------
+        [Test]
         [Description("LUCENENET-170")]
         public void Test_Util_Parameter()
         {



Mime
View raw message