Bug 14907 - Item search: Call Numbers in Item search results are ordered alphabetically
Summary: Item search: Call Numbers in Item search results are ordered alphabetically
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
: 27429 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-09-28 09:33 UTC by Theodoros Theodoropoulos
Modified: 2022-03-16 11:55 UTC (History)
11 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Theodoros Theodoropoulos 2015-09-28 09:33:38 UTC
Call Numbers in Item search results seem to be sorted ALPHABETICALLY, so currently it is displayed:
QA76.76
QA76.760
QA76.77

where the results should be shown in the following order:
QA76.76
QA76.77
QA76.760

The callnumber ordering is a complex issue [it should be partly alphabetical partly numerical] but once done, it would be very useful for sorting and could be applied to several places in Koha (browsing shelves, inventory, etc)
Comment 1 Katrin Fischer 2015-09-29 21:48:30 UTC
There is actually a "sorting form" of the callnumber in cn_sort that is created by using the callnumber and the classification source. It might help to have this added to the table as a hidden field used for sorting, while displaying the callnumber.
Comment 2 Owen Leonard 2018-05-24 17:06:35 UTC
The item search table is rendered server-side, so all sorting happens server-side. This eliminates some of our standard sorting methods, like embedding a sortable string in a title tag.

Renaming the column "cn_sort" has the right effect for the purposes of sorting: The column name "cn_sort" is passed to the query and the rows are sorted correctly by call number.

Unfortunately this breaks the column filter: "cn_sort" is an ambiguous column name for the purposes of the query because of biblioitems.cn_sort. I'm not sure if there is a good way to handle this besides adding some conditional code specific to these columns.

Suggestions welcome!
Comment 3 Joelle Hannert 2020-08-07 15:22:42 UTC
We are using the cn_sort workaround for running item reports to sort by call number, but we've been unable to find a solution that will work within the Item Search. It's too bad, because Item Search could be a really useful tool for title-by-title type work (like weeding or shelf-reading.)
Comment 4 Heather 2021-12-02 20:21:59 UTC
We're on 21.05, and the item search is the *only* place where Library of Congress call numbers are sorting correctly.  I'm a little confused about your example, too--are the call numbers in your example Library of Congress call numbers, or call numbers in a different classification system?  Library of Congress call numbers' initial alpha-numeric sequence are decimals after the period, so there wouldn't be a call number, "QA76.760" because this is the same as "QA76.76"--Library of Congress call numbers never end with a zero after the decimal.  If it were a call number used locally, this sorting is correct:

> Call Numbers in Item search results seem to be sorted ALPHABETICALLY, so
> currently it is displayed:
> QA76.76
> QA76.760
> QA76.77

The filing rule for this, if I remember correctly, is covered in the Library of Congress Filing Rules, illustrated by this example, where the absence of a character comes before the presence of a character--that is, "nothing comes before something:"
A is for anatomy
A4D desert speed run

So this isn't correct, for Library of Congress call numbers:
> where the results should be shown in the following order:
> QA76.76
> QA76.77
> QA76.760

Because "point seven six zero" is less than "point seven seven."  But if these aren't Library of Congress call numbers, then the sorting would be different?  The LC Filing Rules say, "Arrange numerals after a decimal point digit by
digit, one place at a time."  So, also, ".760" can't come after ".77," if you're arranging digit-by-digit, one place at a time.  (This is in section 14 of https://www.loc.gov/catdir/cpso/G100.pdf )
Comment 5 Katrin Fischer 2022-01-09 00:21:10 UTC
(In reply to Owen Leonard from comment #2)
> The item search table is rendered server-side, so all sorting happens
> server-side. This eliminates some of our standard sorting methods, like
> embedding a sortable string in a title tag.
> 
> Renaming the column "cn_sort" has the right effect for the purposes of
> sorting: The column name "cn_sort" is passed to the query and the rows are
> sorted correctly by call number.
> 
> Unfortunately this breaks the column filter: "cn_sort" is an ambiguous
> column name for the purposes of the query because of biblioitems.cn_sort.
> I'm not sure if there is a good way to handle this besides adding some
> conditional code specific to these columns.
> 
> Suggestions welcome!

Hi Owen,

does that mean we should expect similar issues for date sorting for server side rendered tables? Or is it something specific to how this table was implemented?
Comment 6 Owen Leonard 2022-03-16 11:55:59 UTC
*** Bug 27429 has been marked as a duplicate of this bug. ***