static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("Usage: CreateTestIndex <indexDir> <dataDir>");
                return;
            }

            Console.WriteLine("Index *.txt files in a directory into a Lucene index.");
            Console.WriteLine("CreateTestIndex.exe is covered in the 'Adding search to your application' chapter (3).");
            var indexDir = args[0];
            var dataDir = args[1];
            Console.WriteLine("Directory for new Lucene index: [{0}]", indexDir);
            Console.WriteLine("Directory with data files to index: [{0}]", dataDir);


            try
            {
                const LuceneVersion version = LuceneVersion.LUCENE_30;
                var analyzer = new LargeGapStandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30);
                var tester = new LuceneFileDirectoryTester(indexDir, analyzer, version);
                var docGen = new LuceneTestBookFilesDocumentGenerator(dataDir);
                var numFilesIndexed = tester.IndexDataFiles(docGen, true);
                Console.WriteLine("Indexed {0} files", numFilesIndexed);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

        }
        static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("Usage: Searcher <indexDir> query");
                return;
            }

            var indexDir = args[0];
            var query = args[1];

            var stopwatch = new Stopwatch();
            stopwatch.Start();

            try
            {
                var version = Lucene.Net.Util.Version.LUCENE_30;
                var analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30);
                var tester = new LuceneFileDirectoryTester(indexDir, analyzer, version);
                var hits = tester.Search(query);
                stopwatch.Stop();
                Console.WriteLine("Search.hits.MaxScore: {0}", hits.MaxScore);
                Console.WriteLine("Search.hits.TotalHits: {0}", hits.TotalHits);
                Console.WriteLine("Search.hits.ScoreDocs: {0}", hits.ScoreDocs.Length);
                Console.WriteLine("Searcher found {0} documents (in {1} ms) that matched the query.", hits.TotalHits, stopwatch.Elapsed);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

        }
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: IndexDump <indexDir>");
                return;
            }

            var indexDir = args[0];
            Console.WriteLine("Directory for new Lucene index: [{0}]", indexDir);
            try
            {
                var version = Lucene.Net.Util.Version.LUCENE_30;
                var analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30);
                var tester = new LuceneFileDirectoryTester(indexDir, analyzer, version);
                tester.CheckIndex();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

        }
        static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("Usage: Indexer <indexDir> <dataDir>");
                return;
            }

            Console.WriteLine("Index *.txt files in a directory into a Lucene index.");
            Console.WriteLine("Use the Searcher to search this index.");
            Console.WriteLine("Indexer.exe is covered in the 'Meet Lucene' chapter.");
            var indexDir = args[0];
            var dataDir = args[1];
            Console.WriteLine("Directory for new Lucene index: [{0}]", indexDir);
            Console.WriteLine("Directory with data files to index: [{0}]", dataDir);

            var stopwatch = new Stopwatch();
            stopwatch.Start();

            try
            {
                const LuceneVersion version = LuceneVersion.LUCENE_30;
                var analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30);
                var tester = new LuceneFileDirectoryTester(indexDir, analyzer, version);
                var docGen = new LuceneTestTextFileDocumentGenerator(dataDir);
                var numFilesIndexed = tester.IndexDataFiles(docGen, true);
                stopwatch.Stop();
                Console.WriteLine("Indexing {0} files took {1} ms.", numFilesIndexed, stopwatch.Elapsed);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

        }