示例#1
0
        }   // End Constructor

        public static void Main1()
        {
            SimpleFileIndexer sfi          = new SimpleFileIndexer();
            SimpleAnalyzer    san          = new SimpleAnalyzer(Lucene.Net.Util.LuceneVersion.LUCENE_48);
            Directory         directory    = FSDirectory.Open(new System.IO.DirectoryInfo("/Users/abhinavjha/Documents/index"));
            IndexWriterConfig writerConfig = new IndexWriterConfig(Lucene.Net.Util.LuceneVersion.LUCENE_48, san);
            IndexWriter       indexWriter  = new IndexWriter(directory, writerConfig);

            sfi.CreateDocument(sfi.PopulateDatabase(), indexWriter);
        } // End Sub Main
示例#2
0
        } // End Sub Main

        public static void Main2()
        {
            // File indexDir = new File("/Users/abhinavjha/Documents/index");
            System.IO.DirectoryInfo dataDir = new System.IO.DirectoryInfo("/Users/abhinavjha/Documents/workspace");
            string            suffix        = "java";
            SimpleFileIndexer sfi           = new SimpleFileIndexer();
            SimpleAnalyzer    san           = new SimpleAnalyzer(Lucene.Net.Util.LuceneVersion.LUCENE_48);
            Directory         directory     = FSDirectory.Open(new System.IO.DirectoryInfo("/Users/abhinavjha/Documents/index"));
            IndexWriterConfig writerConfig  = new IndexWriterConfig(Lucene.Net.Util.LuceneVersion.LUCENE_48, san);
            IndexWriter       indexWriter   = new IndexWriter(directory, writerConfig);

            sfi.IndexTheDataDirectory(indexWriter, dataDir, suffix);

            System.Console.WriteLine(indexWriter.MaxDoc);
            // indexWriter.Close();
            indexWriter.Dispose();
        }