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); } }
/// <summary> </summary> /// <param name="writer">The writer to write to /// </param> /// <param name="j">The Field number /// </param> /// <throws> IOException </throws> private void WriteField(TermVectorsWriter writer, System.String f) { writer.OpenField(f); Assert.IsTrue(writer.IsFieldOpen() == true); for (int i = 0; i < testTerms.Length; i++) { writer.AddTerm(testTerms[i], i); } writer.CloseField(); }