Lucene-锁定获取超时:快速请求上的SimpleFSLock
我有一个Lucene-锁定获取超时:快速请求上的SimpleFSLock,lucene,httpmodule,Lucene,Httpmodule,我有一个httpmodule,它将站点的每次访问记录到lucene索引中。 该网站托管在godaddy上,即使由于我在页面上几乎什么都没有做测试(大约3kb,包括css),它的运行速度也很慢 如果我尝试刷新几次,在第二次或第三次刷新后,我会得到Lock-get-timed-out:SimpleFSLockerror 我的问题是,我做错什么了吗?还是这是正常的行为? 有没有办法克服这个问题 我的代码: //state the file location of the index
httpmodule
,它将站点的每次访问记录到lucene索引中。
该网站托管在godaddy上,即使由于我在页面上几乎什么都没有做测试(大约3kb,包括css),它的运行速度也很慢
如果我尝试刷新几次,在第二次或第三次刷新后,我会得到Lock-get-timed-out:SimpleFSLock
error
我的问题是,我做错什么了吗?还是这是正常的行为?
有没有办法克服这个问题
我的代码:
//state the file location of the index
string indexFileLocation = System.IO.Path.Combine(HttpContext.Current.ApplicationInstance.Server.MapPath("~/App_Data"), "Analytics");
Lucene.Net.Store.Directory dir = Lucene.Net.Store.FSDirectory.GetDirectory(indexFileLocation, false);
//create an analyzer to process the text
Lucene.Net.Analysis.Analyzer analyzer = new Lucene.Net.Analysis.Standard.StandardAnalyzer();
//create the index writer with the directory and analyzer defined.
Lucene.Net.Index.IndexWriter indexWriter = new Lucene.Net.Index.IndexWriter(dir, analyzer, false);
//create a document, add in a single field
Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();
doc.Add(new Lucene.Net.Documents.Field("TimeStamp", DateTime.Now.ToString(), Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.NOT_ANALYZED, Lucene.Net.Documents.Field.TermVector.NO));
doc.Add(new Lucene.Net.Documents.Field("IP", request.UserHostAddress.ToString(), Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.NOT_ANALYZED, Lucene.Net.Documents.Field.TermVector.NO));
//write the document to the index
indexWriter.AddDocument(doc);
//optimize and close the writer
//indexWriter.Optimize();
indexWriter.Close();