12-12-2016 02:22 PM
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://Spa..."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://Spa..."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.
12-12-2016 04:44 PM
Hi Molin,
Correct syntax is described below.
Thanks,
Yogesh Prajapati
12-12-2016 05:03 PM
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
12-13-2016 10:24 AM
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)
12-13-2016 03:24 PM
Hello,
this solved my problem!
Thank you very much.
Br, Vojtech
12-13-2016 10:06 AM
Hi Molin,
For time I guess you may have to enable time analyzer in lucene.
Thanks,
Yogesh Prajapati
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.