jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Waschkowski <mwaschkow...@gmail.com>
Subject Re: A bug? Query returns wrong records
Date Tue, 28 Jul 2009 17:54:59 GMT
Hi Alex,
Thanks for the info, I am also running into this issue. If I am doing an
xpath query on a double property, does that mean I have to ensure that a
'.0' is on the end? Or is there a way to 'cast' (or otherwise
suggest) the value in the xpath?

ie. something similar to:
nodes/*[@gba> xs:double(10000)]

I would rather cast the double rather than appending '.0' on the end of my
query, as some of the queries we run are generated based on user input which
may or may not include the '.0'. My code will be more understandable with a
cast rather than a check for a '.' and appending of a '.0' if one doesn't
exist...

Thank you,

Mark

On Tue, Jan 20, 2009 at 5:25 AM, Alexander Klimetschek <aklimets@day.com>wrote:

> On Sat, Jan 17, 2009 at 5:48 AM, Cheng Zhang <zhangyongjiang@yahoo.com>
> wrote:
> > Problem: query below returns one row which is wrong.
> >
> >  select * from oag:CustomerReviews where AverageRating > 5
> >
> > but query below is ok:
> >
> >  select * from oag:CustomerReviews where AverageRating > 5.0
> >
> > A bug?
>
> AFAIK a double value (such as AverageRating) must be compared against
> a double literal in sql/xpath queries, ie. include a dot like "5.0".
> The JCR spec does not mandate long<->double conversion in that case:
> "In case of type mismatches in a comparison LONGs can be converted to
> DOUBLEs".
>
> [1] http://www.day.com/specs/jcr/1.0/8.5.4.3_WHERE.html
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message