cancel
Showing results for 
Search instead for 
Did you mean: 

FreetextSearch Article Validity [MIN TO NOW] issue

sivaanagha
Champ in-the-making
Champ in-the-making
In FreetextSearch for article validity using  '@cm\:from:[MIN TO NOW]' , but it is not checking the Time (hours, mins).

how can i check the date & time?

Thanks,
Siva.
8 REPLIES 8

afaust
Legendary Innovator
Legendary Innovator
Hello Siva,

Alfresco by default does not index the time fragment, so you can not perform a range query that respects hours / minutes out-of-the-box. With a simple configuration change, you can enable this (it is disabled by default for performance reasons as far as I know). Please have a look at Andy Hinds Blog.

Regards
Axel

hemantkpn
Champ in-the-making
Champ in-the-making
Hi Siva,

Just replace your code '@cm\:from:[MIN TO NOW]' with

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
String currentDateTime = dateFormat.format(new Date());
"@cm\\:from:[MIN TO" + currentDateTime + "]";

Basically you have to replace NOW with current time stamp in the required format as above.
NOW by default referes to the date and not the time stamp.

- Hemant

afaust
Legendary Innovator
Legendary Innovator
"NOW" already is the current time stamp including the time, which is only used / effective when Lucene has been configured for millisecond resolution. There is no need to change NOW into anything else. Contrary to the previous comment, "TODAY" is the keyword for the current date without time fragment when Lucene has been configured for millisecond resolution.

The classes DateTokenFilter / DateTimeTokenFilter define how these special tokens are evaluated.

sivaanagha
Champ in-the-making
Champ in-the-making
tried with above approaches but no luck, please suggest any alternate way.

regards,
Siva.

afaust
Legendary Innovator
Legendary Innovator
Hello Siva,

just to make sure: Did you modify / adapt the file dataTypeAnalyzers.properties and perform a full index rebuild?

Regards
Axel

andy
Champ on-the-rise
Champ on-the-rise
Hi

What version of Alfresco are you using?

Andy

sivaanagha
Champ in-the-making
Champ in-the-making
Hi Axel,

i am using Alfresco 3.4.5 Enterprise version.

modified the dataTypeAnalyzers.properties as below

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

Thanks,
Siva.

sivaanagha
Champ in-the-making
Champ in-the-making
Hi All,

Modified the dataTypeAnalyzers.properties as below

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

And added below entry in alfresco-global.properties file

index.recovery.mode=FULL

Then performed full index rebuild. Now date & time is working fine for search.

Thanks,
Siva.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.