lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless" <luc...@mikemccandless.com>
Subject Re: 2.1 lock file name
Date Tue, 20 Feb 2007 11:32:49 GMT

On Tue, 20 Feb 2007 10:36:55 +0100, "jm" <jmuguruza@gmail.com> said:

> I updated my code to use 2.1 (IndexWriter deleting docs etc), and when
> using native locks I still get a lock like this:
> lucene-2361bf484af61abc81e6e7f412ad43af-n-write.lock
> and when using SimpleFSLockFactory:
> lucene-2361bf484af61abc81e6e7f412ad43af-write.lock

The defaulting only happens if FSDirectory.getDirectory() is called
without passing your own LockFactory.

If instead you create your own LockFactory and pass that in, then
FSDirectory won't change whichever lockDir you had specified to that
LockFactory.

If you want this same default behavior, but from your own created
LockFactory, you can do something like this:

  LockFactory lf = new NativeFSLockFactory(indexDir);
  Directory d = FSDirectory.getDirectory(indexDir, lf);
  lf.setLockPrefix(null);

That last line tells the lock factory that it's not necessary to use
that large digest prefix to differentiate locks (assuming
no other writer will be storing locks in this directory!).

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message