In my post content Modeling in Alfresco we had seen that alfresco supports metadata of different data types like string, integer, and date. Also in this earlier post we had seen how content search work in alfresco.

In content search post we have also learnt about content search in Alfresco repository. Most of the time we need to deal with Lucene queries in order to search though the repository. Now for properties with different data type needs to be handled differently while generating query. Here I am going to show explain you two type of queries where generally developers face difficulties.

Query for property of type Date

All properties with Date value are stored in the Alfresco in ISO 8601 date time format


So query parser expects the date in same ISO 8601 format truncated forms of this date are also supported. Alfresco also support few token like TODAY, NOW, MIN, MAX to make it more easy.

Finding nodes by date and time property values

For instance we have property called empjoiningDate with data type as date where “custom” is the model prefix.


Finding Nodes with token

@cm\:created:NOW (find all the nodes created today)

Range Query for property of type Date

For searching between two given dates we need to create Date Range query.

@custom\:empjoingDate:[2010\-10\-16T00:00:00 TO 2014\-10\-17T00:00:00]
 @custom\:empjoingDate:[2013\-10\-16T00:00:00 TO MAX]
 @custom\:empjoingDate:[NOW TO MAX]
 @custom\:empjoingDate:[MIN TO NOW]


Range Query for property of type integer

For property with data type integer we sometimes have requirement to search for all the nodes which has value of that property set within given range.

For instance we have property called employee id with data type int for custom content type employee bio data and we want to search employees’ bio data with id between 30 and 60.

@custom\:employeeId:[30 TO 60](Inclusive of both range)<b></b>
@custom\:employeeId:{30 TO 60}(Exclusive of both range)

Hope this will give you very good insight of how to generate Range queries for date and integer.

Looking for quality Alfresco Web Hosting? Look no further than Arvixe Web Hosting!


Laisser un commentaire

Choisissez une méthode de connexion pour poster votre commentaire:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion /  Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion /  Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion /  Changer )


Connexion à %s