Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.8.0-dp2
-
Fix Version/s: 2.9.0
-
Component/s: None
-
Security Level: Public
-
Labels:None
Description
Views can have integer datatypes. I do see that we check for that in StringUtils, but it's a bit of an odd API at the moment to have to quote your own string if you want your string as a string and not numbers. Perhaps we need to think this through a bit further.
I have a key that looks like an integer in some cases (it is just a sequence of characters). When the string based key looks like a integer, this code in Query.java treats it as one and doesn't quote it:
// Special case
if (key.equals(STARTKEYDOCID)) {
return key + "=" + value;
} else if (value instanceof Stale) {
return key + "=" + ((Stale) value).toString();
} else if (StringUtils.isJsonObject(value.toString())) {
return key + "=" + value.toString();
} else {
return key + "=\"" + value + "\"";
}
For some reason a string like 100 will trigger the StringUtils.isJsonObject to return true.
Passing in a quoted string like "100" ends up NOT firing that same code (even though it is a valid JSON object) which ends up double quoting the string.
As such, for keys that look like "integers", the current Query code fails to return any documents since it is either passing through the literal 100 or the literal ""100"".