rotty3000/liferay-portal — pull request #50 by matethurzo (2012-04-10 14:50:19+00:00)
Title: LPS-25816

Hi Ray,

These are the changes what Brian asked for: changing the calls from Liferay to Lucene the appropriate way, I've removed the obsolete calls.

I've removed the optimize feature, according to the lucene teams it's extremely inefficient.

The changes are quite straightforward although there is one change I wan't to highlight. There is a bug in the JRE, this is a known bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038

Because of this bug the OS (typically Windows) cannot release the native file handler while the GC hasn't collected all the underlying objects. This means if you want to delete or overwrite a file and the OS still holds the native file handle, then it might result in an IOException. To prevent this case I've introduced some System.gc() statements - it can be switched off since most of the systems/JREs won't have problems with that. Please read the details here: http://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/api/core/org/apache/lucene/store/FSDirectory.html
This has been revealed during running the IndexAccessorImplTest tests, and for me the test is running perfectly with the GC calls.

The Lucene documentation mentions at multiple places that the windows JRE implementation has multiple bugs.

Please let me know if you have any questions/concerns.

Thanks,

Máté