I've an asp.net web application which uses Lucene API for search. Here is the problem scenario:
Events:
When event 2 occurs after event 1 has occurred, I am getting error below while copying the index:
The process cannot access the file 'C:\Indexes\segments.gen'
because it is being used by another process.
What am i missing here?
FYI, am using System.IO.File.Copy
with overwrite set to true to copy index files.
问题是因为第一个事件锁定了Lucine文件,您可以创建同一索引的2个副本,并同步您的进程以防止彼此冲突
I described how I used Lucene.NET in an ASP.NET application here:
http://ifdefined.com/blog/post/Full-Text-Search-in-ASPNET-using-LuceneNET.aspx
My code might not be right for a high volume website, but for low volume, it does seem to solve he problem you are having.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.