> On Wed, Jan 21, 2009 at 9:55 AM, Ard Schrijvers 
> <[email protected]> wrote:
> > But, I can never tell when I see '@someprop < 5' whether 
> the 5 should 
> > be interpreted as a string, as a double or a long.

> Alexander Klimetschek wrote:
> Once the query implementation comes to comparing someprop to 
> "5", it could try to convert 5 to the type of the property, 

But how do you know from a query what the type of a property is? I can
imagine that you can get it pretty much working if you index a long and
a double the same way to have them both working, but, who says if
@someprop < 5 I am actually saying 'someprop' is a double or long. It
very well might be a String property, and I just want all results with
String value < 5, so nodes having someprop = '4', someprop='3', but also
someprop = '43' as this is lexically smaller then 5. Even worse, some
nodes may have someprop as a String, but some might have them as a
double. I really do not see how it could even work properly currently. 

AFAIK, the only way this can done properly, is indexing a long and a
double in a separate lucene field (instead of the current
'FieldNames.PROPERTIES' field), or a separate field value prefix to
indicate the type. Then the query should furthermore specify what kind
of datatype you are querying on. So,

//element(*,nt:unstructured)[...@myprop > xs:long(5)]
//element(*,nt:unstructured)[...@myprop > xs:double(5)]
//element(*,nt:unstructured)[...@myprop > '5']

This way I think it is possible, even if you use the 'myprop' to hold
sometimes a long, sometimes a double, and string values. 


> eg. from long to double, before doing the conversion. This is 
> what the spec suggests (but only saying "can"). I can imagine 

Do you know which section this is? (170 or 283?)

Regards Ard

> 
> Regards,
> Alex
> 
> --
> Alexander Klimetschek
> [email protected]
> 

Reply via email to