Author: sannegrinovero
Date: 2009-05-17 22:06:36 -0400 (Sun, 17 May 2009)
New Revision: 16581
Modified:
search/trunk/src/main/java/org/hibernate/search/store/DirectoryProviderHelper.java
Log:
a fix for HSEARCH-284
Modified:
search/trunk/src/main/java/org/hibernate/search/store/DirectoryProviderHelper.java
===================================================================
---
search/trunk/src/main/java/org/hibernate/search/store/DirectoryProviderHelper.java 2009-05-18
01:59:10 UTC (rev 16580)
+++
search/trunk/src/main/java/org/hibernate/search/store/DirectoryProviderHelper.java 2009-05-18
02:06:36 UTC (rev 16581)
@@ -82,7 +82,10 @@
*/
public static FSDirectory createFSIndex(File indexDir, Properties dirConfiguration)
throws IOException {
LockFactory lockFactory = createLockFactory(indexDir, dirConfiguration);
- FSDirectory fsDirectory = FSDirectory.getDirectory( indexDir, lockFactory );
+ FSDirectory fsDirectory = FSDirectory.getDirectory( indexDir, null );
+ // must use the setter (instead of using the constructor) to set the lockFactory, or
Lucene will
+ // throw an exception if it's different than a previous setting.
+ fsDirectory.setLockFactory( lockFactory );
if ( ! IndexReader.indexExists( fsDirectory ) ) {
log.debug( "Initialize index: '{}'", indexDir.getAbsolutePath() );
IndexWriter.MaxFieldLength fieldLength = new IndexWriter.MaxFieldLength(
IndexWriter.DEFAULT_MAX_FIELD_LENGTH );