我尝试在 Web 应用程序中使用内容查询,但它引发异常“Lucene.Net.Store.AlreadyClosedException:此 IndexReader 已关闭”。请帮我解决这个问题。
var startSettings = new RepositoryStartSettings
{
Console = Console.Out,
StartLuceneManager = true, // <-- this is necessary
IsWebContext = false,
PluginsPath = AppDomain.CurrentDomain.BaseDirectory,
};
using (Repository.Start(startSettings))
{
var resultQuery = ContentQuery.Query("+InTree:@0 + DisplayName:*@1*", null, folderPath, q);
}