lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nader S. Henein" <>
Subject RE: change directory
Date Mon, 03 May 2004 14:08:35 GMT
When my server restarts, I have a little procedure that validates and "sorts
out" the index in case the server crashes mid-indexing/optimizing, what it
does is it checks for locks and frees them if need be then it optimizes the
whole thing (as a precaution) here's the code I use, try it out in your
lucene init:

		try {
			Directory directory =
			if ( directory.list().length == 0 ) clear() ; //
Create a new index
			Lock writeLock = directory.makeLock(writeFileName); 
			if (!writeLock.obtain()) {
				IndexReader.unlock(directory) ;
			} else {
				writeLock.release() ;
		} catch (IOException e) {
			logger.error("Index Validate",e) ;

Try it out, hope it helps.

Nader Henein

-----Original Message-----
From: Rosen Marinov [] 
Sent: Monday, May 03, 2004 5:52 PM
To: Lucene Users List
Subject: change directory

Hi all,

I have a good working index about 3 GB in one directory
for example in c:/index1

now i want to change the computer and directory for example
to d:/index2    (is this possible ???)

and when i copy it to the new pc and directory  on 
IndeaxReader(indexpath) i get 
  Lock obtain timed out

before coping i closed all java aplications, index was with closed writers,
readers, serachers, terms and etc ... i have finally clauses to close all
this and shut down function, all my methods which works with index are

10x fopr help in advance

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message