As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Hello,
I need to do following query which finds me the last modified content in one hour but with no success. What could be wrong? I've searched for some example with time range but with no success to my case.
My query is following:
http://localhost:8080/alfresco/service/slingshot/node/search?lang=fts-alfresco&store=workspace://SpacesStore&q=TYPE"cm:folder" AND @cm:created:"[2016-12-12T16:00:00 TO 2016-12-12T17:00:00]"
I'm successful with following query example
http://localhost:8080/alfresco/service/slingshot/node/search?lang=fts-alfresco&store=workspace://SpacesStore&q=TYPE:"cm:folder" AND @cm:name:"Use*"
but not with the upper query with datetime range. Does anyone know the syntax for this?
Thank you very much.
Hi Molin,
Correct syntax is described below.
http://localhost:8080/alfresco/service/slingshot/node/search?lang=fts-alfresco&store=workspace://SpacesStore&q=TYPE:%22cm:folder%22%20AND%20cm:created:%22[2016-12-10%20TO%202016-12-12]%22
Thanks,Yogesh Prajapati
Hi Yogesh,
thank you very much for your reply but unfortunately that didn't help me. Also time is missing in your syntax. I need one hour modification time.
Br, Vojtech
For time I guess you may have to enable time analyzer in lucene.
Thanks,
Yogesh Prajapati
You need to use the proper syntax for datetime queries. First of all, you do not need the quotation marks around the [date1 TO date2] Block. Second of all you should ensure special query characters are encoded.
This is a valid query:
TYPE:"cm:content" AND cm:created:[2016\-01\-01T01\:00\:00 TO 2016\-01\-01T12\:00\:00]
Note that the @ is completely superflous when using the Alfresco FTS query language - it is only supported for simpler backwards compatibility with Lucene queries (which should never be used anymore in Alfresco 4.0+)
When you are running Alfresco 5.x with SOLR 4 you can also use SOLRs DateMath expressions, e.g.
TYPE:"cm:content" AND cm:created:[NOW/MONTH-6MONTHS TO NOW/DAY]
(this query looks for all documents created within the last 6 months starting from the 1st day of the calendar month until last midnight)
this solved my problem!