[
https://issues.apache.org/jira/browse/OAK-1763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13979492#comment-13979492
]
Davide Giannella commented on OAK-1763:
---------------------------------------
bq. Not sure whether this works correctly e.g for cases like {{\["goofy", "42",
"Arthur"\]}}. How would you ensure that numbers are compared as strings here?
well I didn't type functioning code ;) Anyhow taking from the example
above and expanding the idea
{code}
// ...
// value = <current-node-value>
if (number.matcher(value).matches()) {
// numeric with numeric
Double v = new Double(value):
if ( v.compareTo(d) > 0) {
// ...
}
// ...
} else {
// we fall back on String comparison.
}
{code}
I know it won't really address mixed situations where we have Strings
with numbers and Strings with "string" as property value but IMO in
the vast majority of cases the indexed properties will be consistent;
something like: {{status=ABORTED}} or {{pinned=1}} or
{{endTime=2013-02-03}}.
As said, the proper solution would be passing down the PropertyValue
itself down the stream and let each conten strategy decide if/what to
do with that. The above is a patch for avoiding an API change.
> OrderedIndex does not comply with JCR's compareTo semantics
> -----------------------------------------------------------
>
> Key: OAK-1763
> URL: https://issues.apache.org/jira/browse/OAK-1763
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: core
> Reporter: Michael Dürig
>
> The ordered index currently uses the lexicographical order of the string
> representation of the values. This does not comply with [JCR's compareTo
> sementics |
> http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.6.5.1%20CompareTo%20Semantics]
> for e.g. double values.
--
This message was sent by Atlassian JIRA
(v6.2#6252)