#19 ✓resolved
omarvelous

order_by_link by default orders strings with capitalized letters first

Reported by omarvelous | October 29th, 2008 @ 05:37 PM

Not sure if this is a "bug", but order_by_link by default sorts by capitalized first....

Looking through the plugin... can't see how i'd go about turning or changing that.

Do you feel capitalization should proceed when sorting string fields?

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson October 29th, 2008 @ 05:44 PM

    • State changed from “new” to “open”

    Not sure what you mean. You mean the text it produces is capitalized? Do you mean explaining a little better? Thanks!

  • omarvelous

    omarvelous October 29th, 2008 @ 05:52 PM

    My apologies... Was on a conference call...

    Basically the scenario is I have 4 people with logins of Zebra, beta, charlie and alpha... My order_by_link :login will sort ASC as Zebra, alpha, beta, charlie or DESC as charlie, beta, alpha, then Zebra.... Due to the capitals...

    So basically A.....Za.....z is the order, when i'd think it would be a...z.lowercase..... regardless of the case....

  • omarvelous

    omarvelous October 29th, 2008 @ 05:55 PM

    • Title changed from “order_by_link by defaults orders by Capitalized first” to “order_by_link by default orders strings with capitalized letters first”

    updating title...

  • Ben Johnson

    Ben Johnson October 29th, 2008 @ 05:55 PM

    • Title changed from “order_by_link by default orders strings with capitalized letters first” to “order_by_link by defaults orders by Capitalized first”

    That is very strange. Yeah, searchgasm doesn't actually perform the sorting, it just issues the query. What kind of database are you using?

    All that searchgas is doing is:

    order by login ASC

    Which should not be case sensitive.

  • omarvelous

    omarvelous October 29th, 2008 @ 05:58 PM

    • Title changed from “order_by_link by defaults orders by Capitalized first” to “order_by_link by default orders strings with capitalized letters first”

    Well.... I could do some things to monkey patch it, like using String.lowercase.... But i'd think regardless of case, it would sort accordingly, dictionary style...

    I'm using SQLite3, for now

  • Ben Johnson

    Ben Johnson October 29th, 2008 @ 06:06 PM

    It should sort appropriately. I would bet, if you didn't use searchgasm at all and issued a raw query it wouldn't sort properly.

    Try doing:

    User.all(:order => "login ASC")

    The above doesn't get searchgasm involved at all.

    Also, check out:

    http://searchgasm_example.binary...

    Order by the first name DESC. You will see "Zebra" and "zebra" are one after another.

  • omarvelous

    omarvelous October 29th, 2008 @ 06:14 PM

    Yea..... Must be a SQLite thing.....

    Getting the same effect in the console.... I'll google this.

  • Ben Johnson

    Ben Johnson October 30th, 2008 @ 12:28 AM

    • State changed from “open” to “resolved”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket

Pages