1 Apr 2007 01:09
Lock files in a read-only application
Nilesh Bansal <nileshbansal <at> gmail.com>
2007-03-31 23:09:06 GMT
2007-03-31 23:09:06 GMT
Hi all, We have a web-based application that searches a large lucene index. This application only creates object of type IndexSearcher only (and no IndexWriters) for searching the index. After the application runs for some time (a few hours), I can see lock files in the temp directory of the form /opt/tomcat/temp/lucene-5f77ffdc821b3f8e861949e9ecc35a53-commit.lock The temp dir is set to /opt/tomcat/temp/ as we are using tomcat. Since the application is read-only, there is no point in it using the lock files. These lock files are creating a lot of trouble for me, as their presence leads to a lock obtained timeout in other threads. It seems like a bug in lucene. The index is updated be a separate process independent of the web-application once in a while. Currently I am using an independent shell script that checks for the temp dir for lock files every few seconds and deletes the lock files if any (to prevent a lock obtained timeout in other threads). Any help will be appreciated. thanks Nilesh Bansal. http://queens.db.toronto.edu/~nilesh/
IndexSearcher is = new ...
...
TopFieldDocs tops = is.search(query, null /*filter*/, 10, Sort.RELEVANCE);
for (int i = 0; i < tops.scoreDocs.length; i++) {
ScoreDoc scoreDoc = tops.scoreDocs[i];
System.out.println(is.doc(scoreDoc.doc));
}
I can see that tops.totalHits, returns all matched documents. So is this
really "paged search", or I'm just doing a complete search and put a window
on the returned result each time?
Thanks.
RSS Feed