LOC sort

Report your bugs here - if someone else has already mentioned the same bug, just add on to their post with as much info as possible to make the hunting easier.
Post Reply
vinteuil
Contributor
Contributor
Posts: 6
Joined: Thu Oct 15, 2015 5:50 pm

LOC sort

Post by vinteuil »

Hi—I've just switched from Delicious Library, and I noticed that I can no longer sort properly by library of congress catalogue—the sort simply goes character by character, so that, for instance "B1290 2008" comes before "B188 .F714 1988". Is there any good solution for this?
User avatar
Conor
Top Dog
Posts: 5335
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: LOC sort

Post by Conor »

Thanks for the feedback. I have code explicitly looking for the LOC and sorting character by character. Now why it does that, there is no comment on the code. But there must have been a good reason, let me investigate and find out why that might be the case.
User avatar
Conor
Top Dog
Posts: 5335
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: LOC sort

Post by Conor »

After some searching, the LCC numbers are meant to be sorted as text and not numbers. The behavior is the correct behavior for the sorting of LCC on a shelf and library.

In a simpler example "B3" needs to come after "B19999".
vinteuil
Contributor
Contributor
Posts: 6
Joined: Thu Oct 15, 2015 5:50 pm

Re: LOC sort

Post by vinteuil »

Is this going to be fixed anytime soon? Or is there a way to manually change how the field is sorted?
vinteuil
Contributor
Contributor
Posts: 6
Joined: Thu Oct 15, 2015 5:50 pm

Re: LOC sort

Post by vinteuil »

Bump/hello?
User avatar
Conor
Top Dog
Posts: 5335
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: LOC sort

Post by Conor »

The sorting is correct.

There is no way to break the proper sorting of LCC numbers. If you want them to sort like regular numbers you could move the data to number field that is not being used, such as paid. You can do this directly in the SQL database with the following command in TerminalL

Code: Select all

sqlite3 ~/Library/Application\ Support/Bookpedia/Database.bookpd
update zentry set zpaid = zlcc;
vinteuil
Contributor
Contributor
Posts: 6
Joined: Thu Oct 15, 2015 5:50 pm

Re: LOC sort

Post by vinteuil »

I'm not sure I understand your response—it seems like you're saying that the LCC sorting is working already. I've attached a picture of how the sort works for my library:
http://imgur.com/dPjyzza
Image

EDIT: On the other hand, your fix worked fine in the opposite direction, sending LCC to a custom text field.
User avatar
Conor
Top Dog
Posts: 5335
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: LOC sort

Post by Conor »

Thank you for the image. Indeed, the sorting is working correctly. I know it seems wrong to sort B1835 before B188. But this is the way LCC is sorted and the way you would find the books at the library. I.e. they are not numbers but categories; B18 is closer to category B2 than B1835.

We actually go out of our way to do this sorting on the LCC field with a custom sort. Hence why moving the data to any other custom field will suddenly sort it the way you expected with the numbers in numerical order.
vinteuil
Contributor
Contributor
Posts: 6
Joined: Thu Oct 15, 2015 5:50 pm

Re: LOC sort

Post by vinteuil »

I see now where the confusion was. But I'm not sure you're right about the correct sorting. Sorting that way completely destroys the topical ordering of books (for instance, it puts random choral works between the piano works), I've never seen a library sort that way, and it's not how the LOC itself sorts it in their outline of the classification: https://www.loc.gov/catdir/cpso/lcco/
DanCornett
Junior Member
Junior Member
Posts: 4
Joined: Thu Feb 15, 2007 11:49 am

Re: LOC sort

Post by DanCornett »

re: "... it's not how the LOC itself sorts it in their outline of the classification ..."

I just looked at that link, and the LOC list is indeed, to my eyes "sorted as text", not as numeric values.

If one thinks of the "numbers" as a "positional hierarchy" of characters, then it may make more sense.

Example: (from a LOC link sub-page, using 'periods' to approximate spacing):

ML1-3930 ... Literature on music
ML1-5 ............... Periodicals. Serials
ML12-21 ........... Directories. Almanacs
User avatar
Conor
Top Dog
Posts: 5335
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: LOC sort

Post by Conor »

Latest Bookpedia beta has a fix for LCC sort.
Post Reply