public override void Run()
{
IndexReader reader = null;
IndexSearcher searcher = null;
Query query = new TermQuery(new Term("content", "aaa"));
for (int i = 0; i < this.NumIteration; i++)
{
try
{
reader = DirectoryReader.Open(Dir);
searcher = OuterInstance.NewSearcher(reader);
}
catch (Exception e)
{
HitException = true;
Console.WriteLine("Stress Test Index Searcher: create hit unexpected exception: " + e.ToString());
Console.Out.Write(e.StackTrace);
break;
}
try
{
searcher.Search(query, null, 1000);
}
catch (IOException e)
{
HitException = true;
Console.WriteLine("Stress Test Index Searcher: search hit unexpected exception: " + e.ToString());
Console.Out.Write(e.StackTrace);
break;
}
// System.out.println(hits.Length() + " total results");
try
{
reader.Dispose();
}
catch (IOException e)
{
HitException = true;
Console.WriteLine("Stress Test Index Searcher: close hit unexpected exception: " + e.ToString());
Console.Out.Write(e.StackTrace);
break;
}
}
}
}