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); } }
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); }
public virtual void Test() { //Check to see the files were created properly in setup Assert.IsTrue(writer.IsDocumentOpen() == false); Assert.IsTrue(dir.FileExists(seg + TermVectorsWriter.TVD_EXTENSION)); Assert.IsTrue(dir.FileExists(seg + TermVectorsWriter.TVX_EXTENSION)); }