我正在尝试将 Lucene.Net 集成到网络应用程序中。所以我从 this CodeProject article 下载了示例项目.
但是当我尝试它时,我不断在 Search
方法中收到此消息
No segments* file found in
[My Directory]\Lucene.Net-search-MVC-sample-site-master\LuceneSearch.Mvc\lucene_index
lockFactory=Lucene.Net.Store.NativeFSLockFactory: files:
错误发生在这一行
using (var searcher = new IndexSearcher(_directory, false))
有人遇到过这个错误吗?
最佳答案
Lucene 需要创建索引才能进行搜索。指定目录中似乎缺少索引文件。
您是否点击了 UI 中的创建索引按钮?如果发生了什么,它应该在 MVC 站点下创建“lucene_index”目录,如果没有,请确保为运行网站的帐户提供对该目录的读/写访问权限。
关于c# - 尝试搜索 Lucene 目录时出现错误 "No segments* file found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17294248/