jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dave_gough <bagel10002...@googlemail.com>
Subject Numeric/String comparisons in queries
Date Tue, 01 Dec 2009 17:10:51 GMT

Hi,

I have a a String property stored in the repository, but would like to query
it using conditional logic as if it were a number

I have tried to implement the Atom spec in JCR and allowed extensions to be
added on an ad-hoc basis. In this case there are number of "meta" fields
that extend the Atom model, but they are all saved as Strings in an attempt
to keep it simple.

However I now want to find all Entries that have a width property > 10000,
but the query below does an ASCII comparison, so 20 > 1000

 /jcr:root/element(*,atom:Entry)[./meta/width/@atom:value>'1000'] 

I tried to spoof itby removing the single=quotes around 1000 and this gave
mixed results

 /jcr:root/element(*,atom:Entry)[./meta/width/@atom:value>1000] 

Is there a function  such as "jcr:to_number()" or something similar that
coerces the property to be a number? Or does anyone have any suggestions on
how to do compare strings as numbers

regards

Dave Gough

regards
-- 
View this message in context: http://n4.nabble.com/Numeric-String-comparisons-in-queries-tp932301p932301.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Mime
View raw message