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();
			}
예제 #3
0
파일: Form1.cs 프로젝트: modulexcite/hOOt
        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;
        }
예제 #4
0
파일: Form1.cs 프로젝트: modulexcite/hOOt
        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);
        }