Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-355

Queries silently ignore Collation Locale

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.6.0, 2.7.0
    • 2.7.0
    • LiteCore
    • Security Level: Public
    • None
    • CBL Sprint 5
    • 3

    Description

      The following code will do the wrong thing, on Android API <=23 and do so without warning:

              Collation localeSvenska = Collation.unicode()
                  .locale("se")
                  .ignoreCase(false)
                  .ignoreAccents(false);
       
              Query query = QueryBuilder.select(SelectResult.property("string"))
                  .from(DataSource.database(db))
                  .orderBy(Ordering.expression(Expression.property("string").collate(localeSvenska)));
      

      It returns:

      {"A", "Å", "B", "Z"}

      instead of

      {"A", "B", "Z", "Å"}

      We should not simply ignore our what our API promises.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            blake.meike Blake Meike added a comment -

            I didn't in any way mean to demean the CBL logging system or the work that has been put into them. I am simply saying that the mobile environment makes it really, really hard to see those excellent logs!

            "context" is a term to which Jim Borden introduced me. It appears to be an object that Core passes to SQLite, and which SQLite then queries to get the Locale. I know only about half of what Jim tried to explain to me in an hour or so, last night. It is, apparently, the context that logs the warning. My hope is that, in addition to logging it, it could make that warning programatically accessible.

            blake.meike Blake Meike added a comment - I didn't in any way mean to demean the CBL logging system or the work that has been put into them. I am simply saying that the mobile environment makes it really, really hard to see those excellent logs! "context" is a term to which Jim Borden introduced me. It appears to be an object that Core passes to SQLite, and which SQLite then queries to get the Locale. I know only about half of what Jim tried to explain to me in an hour or so, last night. It is, apparently, the context that logs the warning. My hope is that, in addition to logging it, it could make that warning programatically accessible.
            jens Jens Alfke added a comment -

            I had the idea recently of having an API to downgrade the severity of certain errors. For example: by default we could make 'unknown locale name' an error. The developer can flip a switch to downgrade that to a warning, or suppress it entirely.

            There have been several other things like this, where we don't want to outlaw something completely but we want the developer to know about it. For example, we could do the same thing for using HTTP Basic auth on a non-TLS replication. The first time you do it you'd definitely discover that you did it, and that it's problematic; but if you have a use case that requires it, you could turn off the error and proceed.

            jens Jens Alfke added a comment - I had the idea recently of having an API to downgrade the severity of certain errors. For example: by default we could make 'unknown locale name' an error. The developer can flip a switch to downgrade that to a warning, or suppress it entirely. There have been several other things like this, where we don't want to outlaw something completely but we want the developer to know about it. For example, we could do the same thing for using HTTP Basic auth on a non-TLS replication. The first time you do it you'd definitely discover that you did it, and that it's problematic; but if you have a use case that requires it, you could turn off the error and proceed.
            blake.meike Blake Meike added a comment -

            Wooo!!!

            blake.meike Blake Meike added a comment - Wooo!!!
            jimb Jim Borden added a comment -

            This sounds like it is spinning off into a bigger idea, but in the meantime what is the action for this?  Close in favor of the bigger thing, or something else?

            jimb Jim Borden added a comment - This sounds like it is spinning off into a bigger idea, but in the meantime what is the action for this?  Close in favor of the bigger thing, or something else?
            jens Jens Alfke added a comment -

            We already log a warning, so it sounds like it's good enough for now, IMHO

            jens Jens Alfke added a comment - We already log a warning, so it sounds like it's good enough for now, IMHO

            People

              jimb Jim Borden
              blake.meike Blake Meike
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty