Author: epbernard
Date: 2008-11-05 15:44:30 -0500 (Wed, 05 Nov 2008)
New Revision: 15524
Modified:
search/trunk/src/java/org/hibernate/search/backend/Workspace.java
search/trunk/src/java/org/hibernate/search/reader/NotSharedReaderProvider.java
search/trunk/src/java/org/hibernate/search/reader/SharedReaderProvider.java
search/trunk/src/java/org/hibernate/search/reader/SharingBufferReaderProvider.java
search/trunk/src/test/org/hibernate/search/test/RamDirectoryTest.java
search/trunk/src/test/org/hibernate/search/test/TransactionTest.java
search/trunk/src/test/org/hibernate/search/test/indexingStrategy/ManualIndexingStrategyTest.java
Log:
HSEARCH-274 Use Lucene's new readonly IndexReader (2.4)
Modified: search/trunk/src/java/org/hibernate/search/backend/Workspace.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/backend/Workspace.java 2008-11-05 20:14:41
UTC (rev 15523)
+++ search/trunk/src/java/org/hibernate/search/backend/Workspace.java 2008-11-05 20:44:30
UTC (rev 15524)
@@ -122,7 +122,7 @@
return reader;
Directory directory = directoryProvider.getDirectory();
try {
- reader = IndexReader.open( directory );
+ reader = IndexReader.open( directory, false );
log.trace( "IndexReader opened" );
}
catch ( IOException e ) {
Modified: search/trunk/src/java/org/hibernate/search/reader/NotSharedReaderProvider.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/reader/NotSharedReaderProvider.java 2008-11-05
20:14:41 UTC (rev 15523)
+++
search/trunk/src/java/org/hibernate/search/reader/NotSharedReaderProvider.java 2008-11-05
20:44:30 UTC (rev 15524)
@@ -23,7 +23,7 @@
IndexReader[] readers = new IndexReader[length];
try {
for (int index = 0; index < length; index++) {
- readers[index] = IndexReader.open( directoryProviders[index].getDirectory() );
+ readers[index] = IndexReader.open( directoryProviders[index].getDirectory(), true );
}
}
catch (IOException e) {
Modified: search/trunk/src/java/org/hibernate/search/reader/SharedReaderProvider.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/reader/SharedReaderProvider.java 2008-11-05
20:14:41 UTC (rev 15523)
+++ search/trunk/src/java/org/hibernate/search/reader/SharedReaderProvider.java 2008-11-05
20:44:30 UTC (rev 15524)
@@ -147,7 +147,7 @@
* not worse than NotShared and limit the locking time, hence scalability
*/
try {
- reader = IndexReader.open( directoryProvider.getDirectory() );
+ reader = IndexReader.open( directoryProvider.getDirectory(), true );
}
catch ( IOException e ) {
throw new SearchException( "Unable to open Lucene IndexReader", e );
Modified:
search/trunk/src/java/org/hibernate/search/reader/SharingBufferReaderProvider.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/reader/SharingBufferReaderProvider.java 2008-11-05
20:14:41 UTC (rev 15523)
+++
search/trunk/src/java/org/hibernate/search/reader/SharingBufferReaderProvider.java 2008-11-05
20:44:30 UTC (rev 15524)
@@ -145,7 +145,7 @@
//overridable method for testability:
protected IndexReader readerFactory(Directory directory) throws IOException {
- return IndexReader.open( directory );
+ return IndexReader.open( directory, true );
}
/**
Modified: search/trunk/src/test/org/hibernate/search/test/RamDirectoryTest.java
===================================================================
--- search/trunk/src/test/org/hibernate/search/test/RamDirectoryTest.java 2008-11-05
20:14:41 UTC (rev 15523)
+++ search/trunk/src/test/org/hibernate/search/test/RamDirectoryTest.java 2008-11-05
20:44:30 UTC (rev 15524)
@@ -50,7 +50,7 @@
}
private int getDocumentNbr() throws Exception {
- IndexReader reader = IndexReader.open( getDirectory( Document.class ) );
+ IndexReader reader = IndexReader.open( getDirectory( Document.class ), false );
try {
return reader.numDocs();
}
Modified: search/trunk/src/test/org/hibernate/search/test/TransactionTest.java
===================================================================
--- search/trunk/src/test/org/hibernate/search/test/TransactionTest.java 2008-11-05
20:14:41 UTC (rev 15523)
+++ search/trunk/src/test/org/hibernate/search/test/TransactionTest.java 2008-11-05
20:44:30 UTC (rev 15524)
@@ -51,7 +51,7 @@
}
private int getDocumentNumber() throws IOException {
- IndexReader reader = IndexReader.open( getDirectory( Document.class ) );
+ IndexReader reader = IndexReader.open( getDirectory( Document.class ), false );
try {
return reader.numDocs();
}
Modified:
search/trunk/src/test/org/hibernate/search/test/indexingStrategy/ManualIndexingStrategyTest.java
===================================================================
---
search/trunk/src/test/org/hibernate/search/test/indexingStrategy/ManualIndexingStrategyTest.java 2008-11-05
20:14:41 UTC (rev 15523)
+++
search/trunk/src/test/org/hibernate/search/test/indexingStrategy/ManualIndexingStrategyTest.java 2008-11-05
20:44:30 UTC (rev 15524)
@@ -40,7 +40,7 @@
}
private int getDocumentNbr() throws Exception {
- IndexReader reader = IndexReader.open( getDirectory( Document.class ) );
+ IndexReader reader = IndexReader.open( getDirectory( Document.class ), false );
try {
return reader.numDocs();
}