nickva commented on code in PR #4828:
URL: https://github.com/apache/couchdb/pull/4828#discussion_r1380599542


##########
src/mango/src/mango_idx_view.erl:
##########
@@ -417,7 +417,7 @@ range(_, _, LCmp, Low, HCmp, High) ->
 % beginsWith requires both a high and low bound
 range({[{<<"$beginsWith">>, Arg}]}, LCmp, Low, HCmp, High) ->
     {LCmp0, Low0, HCmp0, High0} = range({[{<<"$gte">>, Arg}]}, LCmp, Low, 
HCmp, High),
-    range({[{<<"$lte">>, <<Arg/binary, 16#10FFFF>>}]}, LCmp0, Low0, HCmp0, 
High0);
+    range({[{<<"$lte">>, <<Arg/binary, 16#10FFFF/utf8>>}]}, LCmp0, Low0, 
HCmp0, High0);

Review Comment:
   I think `U+FFFF` is the canonical "highest sorting" string according to the 
collator rules, `U+10FFFF` is just the highest unicode code point numerically 
but not sure if is guaranteed to be the highest sorting one. Collators can be 
tailored in various ways and such.
   
   Verifying that `U+FFFF` sorts higher than `U+10FFFF`
   ```erlang
   ([email protected])80> mango_json:cmp(<<16#10FFFF/utf8>>, <<16#FFFF/utf8>>).
   -1
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to