0
我嘗試在Web應用程序中使用內容查詢,但它引發異常「Lucene.Net.Store.AlreadyClosedException:此IndexReader已關閉」。請幫我解決這個問題。在Web應用程序中使用內容查詢的Sense/net
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);
}
我們無法重現該問題,能否請您告訴我們您正在使用SN版本?或者可以以某種方式分享整個應用程序? –
作爲一個問題:你真的需要一個擁有自己索引的重型工具嗎?因爲如果可以的話,您可以使用通過REST API連接到門戶的Sense/Net Client庫,這是編寫SN工具的推薦方式。它仍然是你編寫的C#代碼,維護這樣的工具更簡單。 –
我正在使用SN版本6.5.3。 我已經通過REST API使用Sense/Net客戶端,但我無法使用該方法來實現搜索功能。 所以我需要使用ContentQuery來搜索樹中的內容。 – dinhienhy