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 dataTypeAnalyzers.properties (located under WEB-INF/classes/alfresco/model or config/alfresco/model if you are using AMP module)
    replace:

    d_dictionary.datatype.d_datetime.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DateAnalyser

    for:

    d_dictionary.datatype.d_datetime.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DateTimeAnalyser
  2. Rebuild your Lucene indexes by adding the following line to /tomcat/shared/classes/alfresco/extension/custom-repository.properties:

    index.recovery.mode=FULL

    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

2 comments:

SOUL Foundation said...

Having same issue. I do not understand or see what you replaced. Both entries are the same. please help

SOUL Foundation said...

browser issues....unfortunately the sentences are cut off, but i copied to note pad and all seems ok.