I'm using query builder to retrieve result. Generated query statement is:
/jcr:root/content/dam/myFolder//element(*, dam:Asset) order by jcr:content/metadata/general/@views descending
The attribute 'views' is of xtype numberfield, but of course numberfield is a textfield with only numbers allowed inside and stored as String.
Ordering by this attribute returns hits ordered in descending alphabetical order.
My question is if it's possible to execute query with ordering by number value of it's attribute, not string value.
Thanks a lot for help
The xpath search cannot do this. So the best option (also in terms of performance) is to make that property a LONG.
It could inherit from the standard JcrPropertyPredicateEvaluator or even from RangePropertyPredicateEvaluator (to support range queries as well, using filtering). Note that such a comparator will be slow if there are many results to order (since it does not make use of any search index).