public void SomeLittleShit() { const string key = "squadnull"; const string hootFileName = "Fake"; var hootPath = Directory.GetCurrentDirectory(); foreach (var file in Directory.GetFiles(hootPath, hootFileName + ".*", SearchOption.TopDirectoryOnly)) { File.Delete(file); } var h = new Hoot(hootPath, hootFileName, _ => { }, _ => { }, new CharacterTokensParser()); for (int i = 0; i < 11000; i++) { h.Index(i, key); } var rowsBeforeOptimize = h.FindRows(key); rowsBeforeOptimize.Count().Should(Be.EqualTo(11000)); h.OptimizeIndex(true); var rowsAfterOptimize = h.FindRows(key); h.Shutdown(); foreach (var file in Directory.GetFiles(hootPath, hootFileName + ".*", SearchOption.TopDirectoryOnly)) { File.Delete(file); } rowsAfterOptimize.Count().Should(Be.EqualTo(11000)); }
public void ProjectWithSpacebars() { var h = new Hoot(Directory.GetCurrentDirectory(), "Fake", _ => { }, _ => { }, new CharacterTokensParser()); const string key = "project "; var d = h.GenerateWordFreq(key); d.ContainsKey("project").Should(Be.True); h.Shutdown(); }
public DocumentIndex(DocumentIndexTypeToken documentIndexTypeToken, AccountName accountName, Action shuttingDown, DocumentIndexSetup documentIndexSetup, Action <string> log) { _documentType = DocumentIndexTypes[documentIndexTypeToken]; _hoot = new Hoot(GetIndexPath(documentIndexSetup, accountName), _documentType.FileName, log, documentIndexSetup.MinStringLengthToSearch, documentIndexSetup.MaxStringLengthIgnore); _shuttingDown = shuttingDown; _isAlive = true; _gate = new object(); _documentIndexSetup = documentIndexSetup; UpdateToken(); }
private void loadhoot() { if (txtIndexFolder.Text == "") { MessageBox.Show("Please supply the index storage folder."); return; } hoot = new Hoot(Path.GetFullPath(txtIndexFolder.Text), "index", true); button1.Enabled = false; }
private void button1_Click_1(object sender, EventArgs e) { if (txtIndexFolder.Text == "") { MessageBox.Show("Please supply the index storage folder."); return; } hoot = new Hoot(Path.GetFullPath(txtIndexFolder.Text), "index", true); button1.Enabled = false; }
public DocumentIndexTyped(DocumentIndexType indexType, IPluginContext context, Action shuttedDown, DocumentIndexSetup documentIndexSetup, IActivityLoggerFactory loggerFactory, DocumentIndexOptimizeHintFactory optimizeHintFactory) { _indexType = indexType; _logger = loggerFactory.Create(new PluginContextSnapshot(context)); var indexPath = _indexType.GetFileFolder(context.AccountName, documentIndexSetup); _hoot = new Hoot(indexPath, _indexType.FileName, _logger.Debug, _logger.Error, indexType.CreateTokensParser(documentIndexSetup), _logger.IsDebugEnabled); _shuttedDown = shuttedDown; _isAlive = true; _documentIndexSetup = documentIndexSetup; _optimizeHint = optimizeHintFactory.Create(documentIndexSetup); _isOptimized = true; UpdateLastUsedToken(); }
private void btnStart_Click(object sender, EventArgs e) { if (txtIndexFolder.Text == "" || txtWhere.Text == "") { MessageBox.Show("Please supply the index storage folder and the where to start indexing from."); return; } btnStart.Enabled = false; btnStop.Enabled = true; if (hoot == null) { hoot = new Hoot(Path.GetFullPath(txtIndexFolder.Text), "index", true); } string[] files = Directory.GetFiles(txtWhere.Text, "*", SearchOption.AllDirectories); _indextime = DateTime.Now; backgroundWorker1.RunWorkerAsync(files); }
/// <summary> /// Load Hoot /// </summary> private void loadhoot() { if (txtIndexFolder.Text == "") { MessageBox.Show("Please supply the index storage folder."); return; } HootConfig _config = new HootConfig { IndexPath = Path.GetFullPath(txtIndexFolder.Text), FileName = "index", DocMode = true, UseStopList = cbUseStopList.Checked, IgnoreNumerics = cbIgnoreNumeric.Checked }; hoot = new Hoot(_config); button1.Enabled = false; }