jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: A bug? Query returns wrong records
Date Thu, 30 Jul 2009 10:22:52 GMT
Hi,

On Tue, Jul 28, 2009 at 19:54, Mark Waschkowski<mwaschkowski@gmail.com> wrote:
> 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?

correct, that will indicate to the query handler that it is of type double

> Or is there a way to 'cast' (or otherwise
> suggest) the value in the xpath?
>
> ie. something similar to:
> nodes/*[@gba> xs:double(10000)]

that's currently not supported.

> 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...

it adds some lines of code but the following should do the trick:

        double value = ....
        NumberFormat nf = NumberFormat.getNumberInstance();
        nf.setMinimumFractionDigits(1);
        nf.setMaximumFractionDigits(Integer.MAX_VALUE);
        String v = nf.format(value);

regards
 marcel

Mime
View raw message