public override int DoLogic() { ITaxonomyWriter taxonomyWriter = RunData.TaxonomyWriter; if (taxonomyWriter != null) { taxonomyWriter.Commit(); } else { throw new InvalidOperationException("TaxonomyWriter is not currently open"); } return(1); }
public override int DoLogic() { ITaxonomyWriter taxonomyWriter = RunData.TaxonomyWriter; if (taxonomyWriter != null) { taxonomyWriter.Commit(); } else { throw IllegalStateException.Create("TaxonomyWriter is not currently open"); } return(1); }
public override void Run() { try { var seen = new HashSet <string>(); IList <string> paths = new List <string>(); while (true) { Document doc = new Document(); int numPaths = TestUtil.NextInt(Random(), 1, 5); for (int i = 0; i < numPaths; i++) { string path; if (paths.Count > 0 && Random().Next(5) != 4) { // Use previous path path = paths[Random().Next(paths.Count)]; } else { // Create new path path = null; while (true) { path = TestUtil.RandomRealisticUnicodeString(Random()); if (path.Length != 0 && !seen.Contains(path)) { seen.Add(path); paths.Add(path); break; } } } doc.Add(new FacetField("field", path)); } try { w.AddDocument(config.Build(tw, doc)); if (mgr != null && Random().NextDouble() < 0.02) { w.Commit(); tw.Commit(); mgr.MaybeRefresh(); } } catch (IOException ioe) { throw new Exception(ioe.ToString(), ioe); } if (VERBOSE) { Console.WriteLine("TW size=" + tw.Count + " vs " + ordLimit); } if (tw.Count >= ordLimit) { break; } } } finally { stop.Set(true); } }