static void Main(string[] args) { LuceneApplication myLuceneApp = new LuceneApplication(); // TODO: ADD PATHNAME string indexPath = @"C:\Users\n10104844\source\repos\IFN647-Practical\Practical 5\Week5_Index"; myLuceneApp.CreateIndex(indexPath); System.Console.WriteLine("Adding Documents to Index"); List <string> l = new List <string>(); l.Add("The magical world of oz"); l.Add("The mad, mad, mad, mad world"); l.Add("Possum magic"); foreach (string s in l) { System.Console.WriteLine("Adding " + s + " to Index"); myLuceneApp.IndexText(s); } System.Console.WriteLine("All documents added."); myLuceneApp.CreateParser(); myLuceneApp.CreateSearcher(); myLuceneApp.DisplayResult(myLuceneApp.SearchIndex("world")); // clean up myLuceneApp.CleanUpIndexer(); myLuceneApp.CleanUpSearcher(); System.Console.ReadLine(); }
static void Main(string[] args) { LuceneApplication myLuceneApp = new LuceneApplication(); // TODO: ADD PATHNAME string indexPath = @"C:\Week_5"; myLuceneApp.CreateIndex(indexPath); System.Console.WriteLine("Adding Documents to Index"); List <string> l = new List <string>(); l.Add("The magical world of oz"); l.Add("The mad, mad, mad, mad world"); l.Add("Possum magic"); l.Add("Harry is a mad guy"); foreach (string s in l) { System.Console.WriteLine("Adding " + s + " to Index"); myLuceneApp.IndexText(s); } System.Console.WriteLine("All documents added."); myLuceneApp.CreateSearcher(); // clean up myLuceneApp.CleanUpIndexer(); myLuceneApp.CreateParser(); string text = "guy"; TopDocs td = myLuceneApp.SearchIndex(text); Console.WriteLine($"Number of results is {td.TotalHits}"); myLuceneApp.DisplayResults(td); myLuceneApp.CleanUpSearcher(); System.Console.ReadLine(); }
static void Main(string[] args) { LuceneApplication myLuceneApp = new LuceneApplication(); // TODO: ADD PATHNAME string indexPath = @"./index"; myLuceneApp.CreateIndex(indexPath); System.Console.WriteLine("Adding Documents to Index"); List <string> l = new List <string>(); l.Add("The magical world of oz"); l.Add("The mad, mad, mad, mad world"); l.Add("Possum magic"); foreach (string s in l) { System.Console.WriteLine("Adding " + s + " to Index"); myLuceneApp.IndexText(s); } System.Console.WriteLine("All documents added."); myLuceneApp.CreateSearcher(); myLuceneApp.CreateParser(); TopDocs doc = myLuceneApp.SearchIndex(TEXT_FN); myLuceneApp.DisplayResults(doc, l); // clean up myLuceneApp.CleanUpIndexer(); myLuceneApp.CleanUpSearcher(); System.Console.ReadLine(); }