Exemplo n.º 1
0
 public virtual void  TestWriter()
 {
     try
     {
         TermVectorsWriter writer = new TermVectorsWriter(dir, seg, fieldInfos);
         writer.OpenDocument();
         Assert.IsTrue(writer.IsDocumentOpen() == true);
         WriteField(writer, testFields[0]);
         writer.CloseDocument();
         writer.Close();
         Assert.IsTrue(writer.IsDocumentOpen() == false);
         //Check to see the files were created
         Assert.IsTrue(dir.FileExists(seg + TermVectorsWriter.TVD_EXTENSION));
         Assert.IsTrue(dir.FileExists(seg + TermVectorsWriter.TVX_EXTENSION));
         //Now read it back in
         TermVectorsReader reader = new TermVectorsReader(dir, seg, fieldInfos);
         Assert.IsTrue(reader != null);
         CheckTermVector(reader, 0, testFields[0]);
     }
     catch (System.IO.IOException e)
     {
         System.Console.Error.WriteLine(e.StackTrace);
         Assert.IsTrue(false);
     }
 }
Exemplo n.º 2
0
        protected virtual void  SetUp()
        {
            for (int i = 0; i < testFields.Length; i++)
            {
                fieldInfos.Add(testFields[i], true, true);
            }

            try
            {
                System.Array.Sort(testTerms);
                for (int j = 0; j < 5; j++)
                {
                    writer = new TermVectorsWriter(dir, seg, fieldInfos);
                    writer.OpenDocument();

                    for (int k = 0; k < testFields.Length; k++)
                    {
                        writer.OpenField(testFields[k]);
                        for (int i = 0; i < testTerms.Length; i++)
                        {
                            writer.AddTerm(testTerms[i], i);
                        }
                        writer.CloseField();
                    }
                    writer.CloseDocument();
                    writer.Close();
                }
            }
            catch (System.IO.IOException e)
            {
                System.Console.Error.WriteLine(e.StackTrace);
                Assert.IsTrue(false);
            }
        }
Exemplo n.º 3
0
		protected virtual void  SetUp()
		{
			for (int i = 0; i < testFields.Length; i++)
			{
				fieldInfos.Add(testFields[i], true, true);
			}
			
			try
			{
				System.Array.Sort(testTerms);
				for (int j = 0; j < 5; j++)
				{
					writer = new TermVectorsWriter(dir, seg, fieldInfos);
					writer.OpenDocument();
					
					for (int k = 0; k < testFields.Length; k++)
					{
						writer.OpenField(testFields[k]);
						for (int i = 0; i < testTerms.Length; i++)
						{
							writer.AddTerm(testTerms[i], i);
						}
						writer.CloseField();
					}
					writer.CloseDocument();
					writer.Close();
				}
			}
			catch (System.IO.IOException e)
			{
				System.Console.Error.WriteLine(e.StackTrace);
				Assert.IsTrue(false);
			}
		}
Exemplo n.º 4
0
        private void  WriteDocument(TermVectorsWriter writer, int numFields)
        {
            writer.OpenDocument();
            Assert.IsTrue(writer.IsDocumentOpen() == true);

            for (int j = 0; j < numFields; j++)
            {
                WriteField(writer, testFields[j]);
            }
            writer.CloseDocument();
            Assert.IsTrue(writer.IsDocumentOpen() == false);
        }
Exemplo n.º 5
0
		public virtual void  TestWriter()
		{
			try
			{
				TermVectorsWriter writer = new TermVectorsWriter(dir, seg, fieldInfos);
				writer.OpenDocument();
				Assert.IsTrue(writer.IsDocumentOpen() == true);
				WriteField(writer, testFields[0]);
				writer.CloseDocument();
				writer.Close();
				Assert.IsTrue(writer.IsDocumentOpen() == false);
				//Check to see the files were created
				Assert.IsTrue(dir.FileExists(seg + TermVectorsWriter.TVD_EXTENSION));
				Assert.IsTrue(dir.FileExists(seg + TermVectorsWriter.TVX_EXTENSION));
				//Now read it back in
				TermVectorsReader reader = new TermVectorsReader(dir, seg, fieldInfos);
				Assert.IsTrue(reader != null);
				CheckTermVector(reader, 0, testFields[0]);
			}
			catch (System.IO.IOException e)
			{
				System.Console.Error.WriteLine(e.StackTrace);
				Assert.IsTrue(false);
			}
		}
Exemplo n.º 6
0
		private void  WriteDocument(TermVectorsWriter writer, int numFields)
		{
			writer.OpenDocument();
			Assert.IsTrue(writer.IsDocumentOpen() == true);
			
			for (int j = 0; j < numFields; j++)
			{
				WriteField(writer, testFields[j]);
			}
			writer.CloseDocument();
			Assert.IsTrue(writer.IsDocumentOpen() == false);
		}