Lucene.net 搜不出来,求原因。
本人下载了这个DEMO http://download.csdn.net/detail/linweibo397876058/3494967在DEMO里加了个界面,给几个TXT创建了索引,但是什么也搜不出来。看了好多DEMO,模仿都搜不出来。
代码:
private void button1_Click(object sender, EventArgs e)lucene lucene.net
{
MyIndex.CreateIndex(MyIndex.INDEX_DIR);
var files = Directory.GetFiles(@"C:\LocalTemp");
int i = 1;
files.ToList().ForEach(f =>
{
var content = File.ReadAllText(f);
MyIndex.AddIndex(new MyModel()
{
Content = content,
Title = i.ToString(),
SID = i
});
i++;
});
}
private void button2_Click(object sender, EventArgs e)
{
List<MyModel> mode = MyIndex.Search(this.textBox1.Text);
MessageBox.Show(mode.Count.ToString());
}
补充:.NET技术 , C#