vegemite4me
vegemite4me

Reputation: 6896

Alfresco: Unable to search via Lucene by date

I am writing an Alfresco webscript to search for content by date, and not having any luck.

My query looks like this:

PATH:\"/app:company_home/st:sites/cm:mysite/cm:documentLibrary/cm:News/*\" 
AND @cm\\:created:[2013-09-25T00:00:00.000Z TO NOW]

I have three folders in my News folder:

My Lucene search is always returning 3 items. Why does it return three items when the first two were created before the 25th?

And why do I have to search with a range to get any results? Why does this not work when Alfresco's documentation says that truncated datetime formats are supported?

PATH:\"/app:company_home/st:sites/cm:mysite/cm:documentLibrary/cm:News/*\" 
AND @cm\\:created:"2013-09-25"

Alfresco version: 3.3

EDIT:

I have checked that the following lines exist in alfresco/model/dataTypeAnalyzers.properties:

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.DateAnalyser
d_dictionary.datatype.d_datetime.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DateTimeAnalyser

Upvotes: 0

Views: 1958

Answers (1)

Tahir Malik
Tahir Malik

Reputation: 6643

A working example from version 3.x in a freemarker template

<#assign startPunt = companyhome.childrenByLuceneSearch["TYPE:\"wn:zaak\" AND @wn\\:vernietigingsdatum:[MIN TO "+date?string("yyyy-MM-dd'T'HH:mm:ss")+"] "]>

Upvotes: 1

Related Questions