Thursday, April 16, 2009

How to make Alfresco lucene index store the time part of a datetime field

Due to Alfresco bug [#1791] Lucene indexes contain only date not time, the lucene index in Alfresco only stores the date part of a datetime field. Thought it is fixed from 2.1.1E on, the time is not stored by default in order to maintain backwards compatibility with old indexes.

To solve this problem you should:
  1. Update your (located under WEB-INF/classes/alfresco/model or config/alfresco/model if you are using AMP module)

  2. Rebuild your Lucene indexes by adding the following line to /tomcat/shared/classes/alfresco/extension/


    Once the rebuild process finishes (look at your log file), remember to remove the line added so you don't rebuild your indexes every time you restart your webapp

Sunday, April 5, 2009

How to avoid WTP restart Tomcat after code hotswap

This is not really a topic about frameworks rather than a tip while developing in Eclipse WTP. Since the time of Sysdeo Tomcat plugin, Java developers knew that one could change code on the fly and have the code hot-swapped, without having to restart the Tomcat. In the time of WTP, this is not longer true by default but you can re-enable this feature as follows:

Open Server Tab -> Select your app server and right click "Open" -> Publishing, and choose "Never publish automatically"

We have to do this since the default context.xml that WTP generates forces context reload whenever it detecs changes in WEB-INF/classes. You can check out the server.xml at:


Where you will see reloadable="false" now
reloadable="false" source="org.eclipse.jst.j2ee.server:sample"/>