public static GetLuceneDirectory ( string>.IDictionary |
||
arguments | string>.IDictionary | |
required | bool | |
Результат | Lucene.Net.Store.Directory |
public static void Run(string[] args) { IDictionary <string, string> arguments = CommandHelpers.GetArguments(args, 1); if (arguments == null) { PrintUsage(); return; } Lucene.Net.Store.Directory directory = CommandHelpers.GetLuceneDirectory(arguments); if (directory == null) { PrintUsage(); return; } if (IndexReader.IndexExists(directory)) { using (IndexWriter writer = new IndexWriter(directory, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30), true, IndexWriter.MaxFieldLength.UNLIMITED)) { writer.DeleteAll(); writer.Commit(new Dictionary <string, string>()); } } Console.WriteLine("All Done"); }
public static void Run(string[] args) { IDictionary <string, string> arguments = CommandHelpers.GetArguments(args, 1); if (arguments == null || arguments.Count == 0) { PrintUsage(); return; } Lucene.Net.Store.Directory directory = CommandHelpers.GetLuceneDirectory(arguments); if (directory == null) { PrintUsage(); return; } string source = CommandHelpers.GetSource(arguments); if (source == null) { PrintUsage(); return; } bool verbose = CommandHelpers.GetVerbose(arguments); if (verbose) { Trace.Listeners.Add(new ConsoleTraceListener()); Trace.AutoFlush = true; } int interval = CommandHelpers.GetInterval(arguments); string registration = CommandHelpers.GetRegistration(arguments); if (registration == null) { Console.WriteLine("Lucene index will be created up to the end of the catalog (alternatively if you provide a registration it will not pass that)"); } string catalogBaseAddress = CommandHelpers.GetCatalogBaseAddress(arguments); if (catalogBaseAddress == null) { Console.WriteLine("No catalogBaseAddress was specified so the Lucene index will NOT contain the storage paths"); } string storageBaseAddress = CommandHelpers.GetStorageBaseAddress(arguments); Trace.TraceInformation("CONFIG source: \"{0}\" registration: \"{1}\" catalogBaseAddress: \"{2}\" storageBaseAddress: \"{3}\" interval: {4} seconds", source, registration ?? "(null)", catalogBaseAddress ?? "(null)", storageBaseAddress ?? "(null)", interval); Loop(source, registration, directory, catalogBaseAddress, storageBaseAddress, verbose, interval).Wait(); }
public static void Run(string[] args) { IDictionary <string, string> arguments = CommandHelpers.GetArguments(args, 1); if (arguments == null || arguments.Count == 0) { PrintUsage(); return; } Lucene.Net.Store.Directory directory = CommandHelpers.GetLuceneDirectory(arguments); if (directory == null) { PrintUsage(); return; } using (IndexReader reader = IndexReader.Open(directory, true)) { Console.WriteLine("Lucene index contains: {0} documents", reader.NumDocs()); IDictionary <string, string> commitUserData = reader.CommitUserData; if (commitUserData == null) { Console.WriteLine("commitUserData is null"); } else { Console.WriteLine("commitUserData:"); foreach (var entry in commitUserData) { Console.WriteLine(" {0} = {1}", entry.Key, entry.Value); } } } }