public bool SupportModule(string[] modules) { if (modules == null || modules.Length == 0 || modules.Any(m => TextIndexCfg.Modules.All(mi => mi.Name != m))) { return(false); } var indexedModules = DbProvider.GetIndexedModules(); return(modules.All(m => indexedModules.Any(im => im.StartsWith(m)))); }
private void DoIndex(TextIndexerParams parameters) { var indexed = DbProvider.GetIndexedModules().ToList(); foreach (var module in TextIndexCfg.Modules) { if (stop.WaitOne(TimeSpan.Zero)) { return; } var indexer = TextIndexCfg.Chunks > 1 ? new TextIndexerDistributed(module) : new TextIndexer(module); try { if (TextIndexAction.None == parameters.Action && !indexed.Contains(module.Main) || TextIndexAction.Remove == parameters.Action) { indexer.RotateMain(); DbProvider.UpdateLastIndexDate(module.Main, DateTime.UtcNow); } } catch (Exception ex) { log.ErrorFormat("Error first time index {0}, module {1}", ex, module.Name); } try { if (TextIndexAction.Merge == parameters.Action) { var exitCode = indexer.Merge(); if (exitCode == 0) { DbProvider.UpdateLastIndexDate(module.Delta, parameters.LastIndexDate); } } } catch (Exception ex) { log.ErrorFormat("Error rotate {0}, module {1}", ex, module.Name); } try { indexer.RotateDelta(); } catch (Exception ex) { log.ErrorFormat("Error rotate delta {0}, module {1}", ex, module.Name); } } }
public bool SupportModule(string[] modules) { Log.DebugFormat("SupportModule({0})", string.Join(",", modules ?? new string[0])); if (modules == null || modules.Length == 0 || modules.Any(m => TextIndexCfg.Modules.All(mi => mi.Name != m))) { return(false); } var indexedModules = DbProvider.GetIndexedModules(); return(modules.All(m => indexedModules.Any(im => im.StartsWith(m)))); }
private void DoIndex(TextIndexerParams parameters) { var indexed = DbProvider.GetIndexedModules().ToList(); foreach (var module in TextIndexCfg.Modules) { if (stop.WaitOne(TimeSpan.Zero)) { return; } var indexer = new TextIndexer(module); try { if (TextIndexAction.None == parameters.Action && !indexed.Contains(module.Main) || TextIndexAction.Remove == (parameters.Action & TextIndexAction.Remove)) { indexer.FirstTimeIndex(); continue; } } catch (Exception ex) { log.ErrorFormat("Error first time index {0}, module {1}", ex, module.Name); } try { if (TextIndexAction.Index == (parameters.Action & TextIndexAction.Index)) { indexer.Rotate(); } } catch (Exception ex) { log.ErrorFormat("Error rotate {0}, module {1}", ex, module.Name); } } }